So as a quick follow-up to yesterday's post I wanted to give you a simple rule-set to get started with.
In that post we got OpenHAB up and running. We were also able to turn the Christmas tree off and on via the web ui. In this post we need to automate that.
Log into the OpenHAB box and cd into the OpenHAB directory (in our case under /opt/openhab)
cd /opt/openhab/configurations/rules vim default.rules
We will sock in there the following code
rule "TurnOnTree" when Time cron "0 0 18 * * ?" then sendCommand(Z_socket1, ON) end rule "TurnOffTree" when Time cron "0 0 22 * * ?" then sendCommand(Z_socket1, OFF) end
That's really it. OpenHAB can re-source the config files while running, so at 6pm your xmas tree will light up, and at 10pm it will turn off.