How I have automated my lights

I just scanned the code and I’m a bit tired after a day of hiking, but my first thought is I see a lot of delicates code.

  • instead of having a switch statement with cases for evening and day and night where the only difference is the amount of time, just set the timer value in a global when the time of day change happens and simplify your rule to just use the value. You can even set the dinner value to 0 to handle the night case with the same createTimer code. See Design Pattern: How to Structure a Rule

  • as you expect this, consider Design Pattern: Associated Items and storing your time and dinner values using Design Pattern: Encoding and Accessing Values in Rules. Then you only need over rule you handle all of your motion sensor lights.

If I remember I’ll post something more when I get to a computer.

3 Likes