Clock from Target, $4
Magnets from the refrigerator, $0
GoControl Door Window Sensor on clearance at Home Depot, $8
Reliable Polling, Priceless.
Put the magnets on the second hand for minute polls.
Put the magnets on the minute hand for hour polls.
Put the magnets on the hour hand for once a day polls.
If the hands are not magnetic, put a magnet on each side of the hand.
The clock will show open for about 40-50 minutes and closed for 10-20 minutes
…depending on how you position things and magnet strength on the minute hand.
…Once positioned its very consistent.
You can trigger on the open, or the close…or both!
Use state or atomic state variables to keep track if you need to.
Use Date() if you really want to know what time it is.
Don’t include the Clock door sensor in your alarm system unless…
Place the clock horizontally if its plastic and the magnets are heavy.
Turn the door Sensor so the magnets pass over the reed
…and don’t get stuck on the sensor battery.
If it’s too hard to make work…
…Get a bigger better clock with a sturdy second hand and a heavy duty movement.
Write your own version of cron in groovy.
Throw the analog clock away and use a Repeat Cycle Timer
…with the contact connection inside the sensor.