AzureIoTCSendDeviceProperty.py
import os | |
import iotc | |
def getCPUtemperature(): | |
res = os.popen('vcgencmd measure_temp').readline() | |
return(res.replace("temp=","").replace("'C\n","")) | |
def sendTempAndConnectionDate(): | |
print("Sending temp and connection date ..") | |
propJson = "{\"rpiTemp\": \"" + str(getCPUtemperature()) + "\"}" | |
iotc.sendProperty(propJson) | |
telemetryMessage = "{\"temp\": " + str(getCPUtemperature()) + "}" | |
iotc.sendTelemetry(telemetryMessage) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment