---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----
Name of Rule: LivingRoomTV status controls lighting
Comments:
I use this rule each time I turn on my living room TV. There is nothing special about the rule itself; however, it makes use of two useful integrations/drivers written by others. The two integrations are:
- @armand’s Roku TV Device Handler. This integration is useful for lots of things; the sole use in this rule is to determine when my Roku TV is turned on or off.
- @ogiewon’s HTTP Momentary Switch. In this rule, I make use of two momentary switches created with this driver - Sonos-pause and Sonos-join. Sonos-pause pauses the living room speakers when the TV turns on, and Sonos-join re-joins them to other Sonos speakers when the TV is turned off.
Useful Rule Machine features that this rule makes use of, include:
- A global variable (daylight) which is set to 1 shortly after sunrise and to 0 shortly before sunset.
- A local variable (lights-on) that is set to 1 if certain lights were on when the TV was turned on, and to 0 when the TV is turned off.
- Capture - which captures that state of lights
- Restore - which restores lights to their pre-existing state when the TV is turned off.
This rule works like this:
- When the TV is turned ON, Sonos speakers are silenced and bias lighting behind the TV is turned on.
- If certain lights are on, the local variable “lights-on” is set to 1 and the status of those lights is captured before they are either turned off, or depending on the global variable “daylight” are set to different color temperature and intensity. The variable “daylight” also determines the intensity of bias lighting.
- When the TV is turned OFF, the living room Sonos are re-joined to other Sonos and bias lighting is turned off.
- If the mode is NOT Sleep, then lighting is restored to the parameters in play before the TV was turned on. On the other hand, if the mode is Sleep, different lighting conditions are chosen.
---- TO ENSURE A LONG UNINTERRUPTED LIST PLEASE REFRAIN FROM COMMENTING ----
