Example time dependent brightness level

In this example, you can see how to use logic to switch a dimmer to a certain brightness depending on circumstances.



The first part, sets the dim level to use. Depending on the time of day, or the current status of the lights in de bedroom, the lights will be set very low (byte value for 4%) or normal (byte value for 80%). That way, when you turn on the lights at night, you are not blinded by bright lights. However, when you are already awake and have the lights on in the bedroom, or it is daytime, the lights will turn on as normal.

The second part will actually switch the lights. When you turn on the switch, the light will be set to the right dim level, when you turn it off, it will be set to 0.