Compare commits

..

No commits in common. "1d98bbe2278ea5334fe4c8485a60e0a50039d74d" and "2609f729412abffa9dd21fe71b40e5bf4245c46d" have entirely different histories.

2 changed files with 5 additions and 19 deletions

View File

@ -40,13 +40,10 @@ def subscribe(client: mqtt_client):
def on_message(client, userdata, msg):
topic = msg.topic
if "tele" in topic:
try:
if "STATE" in topic:
data = json.loads(msg.payload.decode())
device = topic.split('/')[1]
powerState[device] = data['POWER']
except:
pass
if "STATE" in topic:
data = json.loads(msg.payload.decode())
device = topic.split('/')[1]
powerState[device] = data['POWER']
if "stat" in topic:
device = topic.split('/')[1]
powerState[device] = msg.payload.decode()
@ -87,4 +84,4 @@ if __name__ == "__main__":
while True:
checkPC()
sleep(1)
sleep(1)

View File

@ -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