parent
3a6a9e61a1
commit
e11994bde1
8
main.py
8
main.py
|
@ -91,9 +91,13 @@ 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":
|
||||||
relay_controller(channel_1, "True")
|
# relay_controller(channel_1, "True")
|
||||||
|
relay = gpiozero.OutputDevice(4, active_high=True, initial_value=False)
|
||||||
|
relay.on()
|
||||||
elif payload == "off":
|
elif payload == "off":
|
||||||
relay_controller(channel_1, "False")
|
# relay_controller(channel_1, "False")
|
||||||
|
relay = gpiozero.OutputDevice(4, active_high=True, initial_value=False)
|
||||||
|
relay.on()
|
||||||
elif topic == "strawberry-pi-greenhouse/relay/channel/2":
|
elif topic == "strawberry-pi-greenhouse/relay/channel/2":
|
||||||
if payload == "on":
|
if payload == "on":
|
||||||
relay_controller(channel_2, "True")
|
relay_controller(channel_2, "True")
|
||||||
|
|
Loading…
Reference in New Issue