adjusted for mains switch
This commit is contained in:
parent
b688303694
commit
02669c0bb5
8
mqtt.lua
8
mqtt.lua
@ -4,9 +4,9 @@ BRUSER = ""
|
||||
BRPWD = ""
|
||||
CLIENTID = "ESP8266-" .. node.chipid()
|
||||
|
||||
SWITCH_PIN = 0
|
||||
SWITCH_PIN = 3
|
||||
|
||||
SWITCH_ID = 0
|
||||
SWITCH_ID = 1
|
||||
|
||||
topics = {"IoT/Watchdog", "IoT/Switch" .. SWITCH_ID}
|
||||
TOPIC_WATCHDOG = 1
|
||||
@ -90,9 +90,9 @@ function run_main_prog()
|
||||
if (switch_state ~= old_switch_state) then
|
||||
old_switch_state = switch_state
|
||||
if (switch_state) then
|
||||
gpio.write(SWITCH_PIN, gpio.HIGH)
|
||||
else
|
||||
gpio.write(SWITCH_PIN, gpio.LOW)
|
||||
else
|
||||
gpio.write(SWITCH_PIN, gpio.HIGH)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user