parent
376f2582da
commit
ee1a5ac09d
36
main.py
36
main.py
|
@ -13,6 +13,22 @@ except ImportError:
|
|||
print(ImportError)
|
||||
exit()
|
||||
|
||||
RELAY_PIN_CH_1 = 4
|
||||
RELAY_PIN_CH_2 = 17
|
||||
RELAY_PIN_CH_3 = 27
|
||||
RELAY_PIN_CH_4 = 11
|
||||
|
||||
global relay_ch_1
|
||||
relay_ch_1 = gpiozero.OutputDevice(RELAY_PIN_CH_1, active_high=True, initial_value=False)
|
||||
|
||||
global relay_ch_2
|
||||
relay_ch_2 = gpiozero.OutputDevice(RELAY_PIN_CH_2, active_high=True, initial_value=False)
|
||||
|
||||
global relay_ch_3
|
||||
relay_ch_3 = gpiozero.OutputDevice(RELAY_PIN_CH_3, active_high=True, initial_value=False)
|
||||
|
||||
global relay_ch_4
|
||||
relay_ch_4 = gpiozero.OutputDevice(RELAY_PIN_CH_4, active_high=True, initial_value=False)
|
||||
|
||||
def debug_print(message: str):
|
||||
now = datetime.now()
|
||||
|
@ -84,13 +100,25 @@ def mqtt_on_message(client, userdata, msg):
|
|||
payload = str(msg.payload.decode("utf-8"))
|
||||
|
||||
if topic == "strawberry-pi-greenhouse/relay/channel/1":
|
||||
pass
|
||||
if payload == "on":
|
||||
pass
|
||||
elif payload == "off":
|
||||
pass
|
||||
elif topic == "strawberry-pi-greenhouse/relay/channel/2":
|
||||
pass
|
||||
if payload == "on":
|
||||
pass
|
||||
elif payload == "off":
|
||||
pass
|
||||
elif topic == "strawberry-pi-greenhouse/relay/channel/3":
|
||||
pass
|
||||
if payload == "on":
|
||||
pass
|
||||
elif payload == "off":
|
||||
pass
|
||||
elif topic == "strawberry-pi-greenhouse/relay/channel/4":
|
||||
pass
|
||||
if payload == "on":
|
||||
pass
|
||||
elif payload == "off":
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in New Issue