You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Errors are displayed when the program is interrupted by Q.
Press Q to quit
q
Quitting...
Traceback (most recent call last):
File "/home/pi/client/raspberry_pi_client.py", line 296, in
asyncio.run(main())
File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/home/pi/client/raspberry_pi_clie
nt.py", line 288, in main
await asyncio.gather(telemetry_loop, reported_loop) File "/home/pi/client/raspberry_pi_client.py", line 161, in send_telemetry
payload = f'{{"cpu_temp": {get_current_cpu_temp()}, "cpu_freq": {get_cpu_frequency_statistics()["current"]}, "cpu_usage": {get_cpu_usage()}, "ram_usage": {get_memory_statistics()["used"]}}}'
File "/home/pi/client/raspberry_pi_client.py", line 91, in get_cpu_usage
return float(cpu_usage)
ValueError: could not convert string to float: ''
Task was destroyed but it is pending!
Please, can you tell me where this error came from ?
"line 91, in get_cpu_usage
return float(cpu_usage)**
ValueError: could not convert string to float: ''"
About, Commands - works ok.
The text was updated successfully, but these errors were encountered:
That was a problem:
#get CPU usage
def get_cpu_usage():
cpu_usage = str(os.popen("top -n1 | awk '/Cpu(s):/ {print $2}'").readline().strip())
return float(cpu_usage)
When I commented on this, the telemetry transmission works. so something wrong in the definition of reading CPU.
In RAW DATA and Overview - no telemetry data.
In RaspberryPi it only displays:
pi@raspberrypi:~ $ cd client
pi@raspberrypi:
/client $ source ./.venv/bin/activate/client $ python raspberry_pi_client.py(04_iot_central) pi@raspberrypi:
Press Q to quit
Sending reported property: {'remaining_disk_space': '19G'}
Errors are displayed when the program is interrupted by Q.
Press Q to quit
q
Quitting...
Traceback (most recent call last):
File "/home/pi/client/raspberry_pi_client.py", line 296, in
asyncio.run(main())
File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/home/pi/client/raspberry_pi_clie
nt.py", line 288, in main
await asyncio.gather(telemetry_loop, reported_loop)
File "/home/pi/client/raspberry_pi_client.py", line 161, in send_telemetry
payload = f'{{"cpu_temp": {get_current_cpu_temp()}, "cpu_freq": {get_cpu_frequency_statistics()["current"]}, "cpu_usage": {get_cpu_usage()}, "ram_usage": {get_memory_statistics()["used"]}}}'
File "/home/pi/client/raspberry_pi_client.py", line 91, in get_cpu_usage
return float(cpu_usage)
ValueError: could not convert string to float: ''
Task was destroyed but it is pending!
Please, can you tell me where this error came from ?
"line 91, in get_cpu_usage
return float(cpu_usage)**
ValueError: could not convert string to float: ''"
About, Commands - works ok.
The text was updated successfully, but these errors were encountered: