This is my first project using ESP Easy / Sonoff. My goal is to make a standalone lamp timer that will turn the light on at sunset (actually 1 hour earlier, but I haven't gotten that far). I could do this with Home Assistant or something else, but I'm trying to keep the timer a 'drop in' replacement for a regular old mechanical lamp timer, so would prefer no server required. The built-in button allows manual override.
As such, I flashed a Sonoff Basic with mega-20180615 and it works fine manually. I set DST/timezone offset so I see the correct local time on the "Main" tab and also enabled NTP.
However, using the following rule, the light never turns-on automatically at 'sunset'. I'm obviously missing something despite the exceptionally basic nature of what I'm trying to do. Any ideas?
Code: Select all
// =============
// Button overrride
// =============
on button#switch do
if [button#switch]=1
gpio,12,1
gpio,13,0 // LED needs to be low when relay is closed to indicate power on.
else
gpio,12,0
gpio,13,1
endif
endon
// ==============
// Turn on at sunset
// ==============
On Clock#Time=All,%sunset% do
gpio,12,1
gpio,13,0
endon
// ===============
// Turn off at midnight
// ===============
on Clock#Time=All,00:00 do
gpio,12,0
gpio,13,1
endon
Mike