added relay switch in mqtt_on_message

Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>
master
Ebbe Baß 2022-07-13 09:53:27 +02:00
parent ee1a5ac09d
commit 4ef914fa19
1 changed files with 8 additions and 8 deletions

16
main.py
View File

@ -101,24 +101,24 @@ def mqtt_on_message(client, userdata, msg):
if topic == "strawberry-pi-greenhouse/relay/channel/1": if topic == "strawberry-pi-greenhouse/relay/channel/1":
if payload == "on": if payload == "on":
pass relay_ch_1.on()
elif payload == "off": elif payload == "off":
pass relay_ch_1.off()
elif topic == "strawberry-pi-greenhouse/relay/channel/2": elif topic == "strawberry-pi-greenhouse/relay/channel/2":
if payload == "on": if payload == "on":
pass relay_ch_2.on()
elif payload == "off": elif payload == "off":
pass relay_ch_2.off()
elif topic == "strawberry-pi-greenhouse/relay/channel/3": elif topic == "strawberry-pi-greenhouse/relay/channel/3":
if payload == "on": if payload == "on":
pass relay_ch_3.on()
elif payload == "off": elif payload == "off":
pass relay_ch_3.off()
elif topic == "strawberry-pi-greenhouse/relay/channel/4": elif topic == "strawberry-pi-greenhouse/relay/channel/4":
if payload == "on": if payload == "on":
pass relay_ch_4.on()
elif payload == "off": elif payload == "off":
pass relay_ch_4.off()
if __name__ == "__main__": if __name__ == "__main__":