Telemetry
This commit is contained in:
@@ -11,6 +11,7 @@ MQTT_TOPIC_COOKING = b"smartwave/cooking"
|
||||
MQTT_KEEPALIVE = 30
|
||||
USE_TLS = True
|
||||
MQTT_QOS = 1
|
||||
CLOUD_MQTT_QOS = 2
|
||||
# Long because messages are stored into the broker and will be sent when the orchestrator is back online.
|
||||
MQTT_HELLO_INTERVAL = 30
|
||||
|
||||
|
||||
@@ -51,4 +51,18 @@ def mqtt_cooking_config(id_microwave, cook_time, power_level, target_temp):
|
||||
"cook_time": cook_time,
|
||||
"power_level": power_level,
|
||||
"target_temp": target_temp
|
||||
})
|
||||
|
||||
def telemetry_payload(device_id, microwave_states, button_state, cloud_alert, gps_data, ambient_temp, ambient_humidity, connected_components, logs):
|
||||
return as_json({
|
||||
"device_id": device_id,
|
||||
"timestamp": int(time()),
|
||||
"states": microwave_states,
|
||||
"button_state": button_state,
|
||||
"cloud_alert": cloud_alert,
|
||||
"gps": gps_data,
|
||||
"ambient_temp": ambient_temp,
|
||||
"ambient_humidity": ambient_humidity,
|
||||
"connected_components": connected_components,
|
||||
"logs": logs
|
||||
})
|
||||
Reference in New Issue
Block a user