Compare commits
No commits in common. "1d98bbe2278ea5334fe4c8485a60e0a50039d74d" and "2609f729412abffa9dd21fe71b40e5bf4245c46d" have entirely different histories.
1d98bbe227
...
2609f72941
@ -40,13 +40,10 @@ def subscribe(client: mqtt_client):
|
|||||||
def on_message(client, userdata, msg):
|
def on_message(client, userdata, msg):
|
||||||
topic = msg.topic
|
topic = msg.topic
|
||||||
if "tele" in topic:
|
if "tele" in topic:
|
||||||
try:
|
if "STATE" in topic:
|
||||||
if "STATE" in topic:
|
data = json.loads(msg.payload.decode())
|
||||||
data = json.loads(msg.payload.decode())
|
device = topic.split('/')[1]
|
||||||
device = topic.split('/')[1]
|
powerState[device] = data['POWER']
|
||||||
powerState[device] = data['POWER']
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
if "stat" in topic:
|
if "stat" in topic:
|
||||||
device = topic.split('/')[1]
|
device = topic.split('/')[1]
|
||||||
powerState[device] = msg.payload.decode()
|
powerState[device] = msg.payload.decode()
|
||||||
@ -87,4 +84,4 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
checkPC()
|
checkPC()
|
||||||
sleep(1)
|
sleep(1)
|
@ -1,11 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Automatic smart plug manager for audio devices
|
|
||||||
After=multi-user.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
User=angoosh
|
|
||||||
ExecStart=python /home/angoosh/Scripts/audio_automation_pc.py
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
Loading…
x
Reference in New Issue
Block a user