rework mqtt api
This commit is contained in:
@ -45,7 +45,8 @@ def on_message(channel, method_frame, header_frame, body):
|
||||
if msg_json['probability'] > 0.5:
|
||||
r = requests.get(f"http://{config.INPUT_HOSTNAME}/sample/{msg_json['tag']}")
|
||||
r.raise_for_status()
|
||||
mqtt.publish(json.dumps({"deviceID": r.json()['device_id'], "sensorID": "", "command": "doAlert"}))
|
||||
mqtt.publish(subtopic=r.json()['device_id'],
|
||||
message=json.dumps({"command": "doAlert"}))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Reference in New Issue
Block a user