update
This commit is contained in:
parent
7a39502fe5
commit
57fb9b9ea6
4
MQTT.py
4
MQTT.py
|
@ -5,9 +5,7 @@ import paho.mqtt.client as mqtt
|
||||||
|
|
||||||
from tool import push_stream, close_stream, update, exec_sh, get_record, get_list_record, get_status
|
from tool import push_stream, close_stream, update, exec_sh, get_record, get_list_record, get_status
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
device_name = os.getenv('device_name')
|
|
||||||
|
|
||||||
|
|
||||||
def on_connect(client, userdata, flags, rc):
|
def on_connect(client, userdata, flags, rc):
|
||||||
|
@ -16,6 +14,8 @@ def on_connect(client, userdata, flags, rc):
|
||||||
|
|
||||||
|
|
||||||
def valid(msg, client):
|
def valid(msg, client):
|
||||||
|
import os
|
||||||
|
device_name = os.getenv('device_name')
|
||||||
origin_data = json.loads(msg.payload.decode('utf-8'))
|
origin_data = json.loads(msg.payload.decode('utf-8'))
|
||||||
if 'msg' not in origin_data:
|
if 'msg' not in origin_data:
|
||||||
client.publish('error', payload='msg must be supplied', qos=0)
|
client.publish('error', payload='msg must be supplied', qos=0)
|
||||||
|
|
Loading…
Reference in New Issue