This commit is contained in:
xyj 2024-01-05 16:47:27 +08:00
parent 6541e34ab5
commit 633212d0e1
2 changed files with 14 additions and 0 deletions

View File

@ -36,6 +36,8 @@ class MQTTClient:
qos=0) qos=0)
# 关闭摄像机电 # 关闭摄像机电
subprocess.Popen(['sudo /usr/bin/python close_led.py'], shell=True) 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): def on_message(self, client, userdata, msg):
if not valid(msg, client): if not valid(msg, client):
@ -71,6 +73,10 @@ class MQTTClient:
open_led() open_led()
elif data == "close_led": elif data == "close_led":
close_led() close_led()
elif data == "open_blue_led":
open_blue_led()
elif data == "close_blue_led":
close_blue_led()
else: else:
# 错误类型 # 错误类型
client.publish(info_topic, payload=publish_payload(code=404, msg='No Such Msg Type'), qos=0) client.publish(info_topic, payload=publish_payload(code=404, msg='No Such Msg Type'), qos=0)

View File

@ -127,3 +127,11 @@ def open_led():
def close_led(): def close_led():
subprocess.Popen(['sudo /usr/bin/python close_led.py'], shell=True) 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)