update
This commit is contained in:
parent
6541e34ab5
commit
633212d0e1
6
MQTT.py
6
MQTT.py
|
@ -36,6 +36,8 @@ class MQTTClient:
|
|||
qos=0)
|
||||
# 关闭摄像机电
|
||||
subprocess.Popen(['sudo /usr/bin/python close_led.py'], shell=True)
|
||||
# 关闭LED灯
|
||||
subprocess.Popen(['sudo /usr/bin/python close_blue_led.py'], shell=True)
|
||||
|
||||
def on_message(self, client, userdata, msg):
|
||||
if not valid(msg, client):
|
||||
|
@ -71,6 +73,10 @@ class MQTTClient:
|
|||
open_led()
|
||||
elif data == "close_led":
|
||||
close_led()
|
||||
elif data == "open_blue_led":
|
||||
open_blue_led()
|
||||
elif data == "close_blue_led":
|
||||
close_blue_led()
|
||||
else:
|
||||
# 错误类型
|
||||
client.publish(info_topic, payload=publish_payload(code=404, msg='No Such Msg Type'), qos=0)
|
||||
|
|
8
tool.py
8
tool.py
|
@ -127,3 +127,11 @@ def open_led():
|
|||
|
||||
def close_led():
|
||||
subprocess.Popen(['sudo /usr/bin/python close_led.py'], shell=True)
|
||||
|
||||
|
||||
def open_blue_led():
|
||||
subprocess.Popen(['sudo /usr/bin/python open_blue_led.py'], shell=True)
|
||||
|
||||
|
||||
def close_blue_led():
|
||||
subprocess.Popen(['sudo /usr/bin/python close_blue_led.py'], shell=True)
|
||||
|
|
Loading…
Reference in New Issue