Creating Smart Cinema Lighting Automations
This guide will show you how to create a set of automations that dim the lights when a movie starts playing on an Apple TV, turn them on when paused, and adjust the color based on the streaming app in use.
Prerequisites
- Hardware: An Apple TV, and color-capable smart lights (e.g., Philips Hue, LIFX).
- Home Assistant Integrations: The Apple TV integration and the integration for your smart lights must be configured.
Key Entities and States
Before building the automation, it's crucial to understand the entities we'll be working with. You can find their exact names under Developer Tools > States.
- Media Player:
media_player.apple_tv_family_room
(your name may vary).- State: We are interested in the
playing
andpaused
states. - Attribute:
app_name
will tell us which application is running (e.g., "Netflix", "Hulu").
- State: We are interested in the
- Lights:
light.family_room_lights
andlight.ambient_lightstrip
(your names may vary).- State:
on
andoff
. - Attributes:
brightness
,rgb_color
.
- State:
Automation Guide (GUI Mode)
We'll create two separate automations for easier management.
1. Movie Playing: Dim Lights
Create an automation that triggers when the Apple TV state changes to playing
. In the actions, use a "Choose" block to create different sequences based on the app_name
attribute (e.g., one for "Netflix" and another for "Hulu").
2. Movie Paused: Brighten Lights
Create a second automation that triggers when the Apple TV state changes to paused
. The action should be a simple service call to turn on your main lights to a comfortable brightness.
YAML Configuration
For those who prefer code, here are the same automations in YAML format. You can add them to your automations.yaml
file.
# automations.yaml
- alias: "Cinema - Movie Playing"
trigger:
- platform: state
entity_id: media_player.apple_tv_family_room
to: "playing"
action:
- choose:
# Option for Netflix
- conditions:
- condition: state
entity_id: media_player.apple_tv_family_room
attribute: app_name
state: "Netflix"
sequence:
- service: light.turn_on
target:
entity_id: light.ambient_lightstrip
data:
rgb_color: [255, 0, 0] # Red
brightness_pct: 50
- service: light.turn_on
target:
entity_id: light.family_room_lights
data:
brightness_pct: 10
# Default option for other apps
default:
- service: light.turn_off
target:
entity_id: light.family_room_lights
- alias: "Cinema - Movie Paused"
trigger:
- platform: state
entity_id: media_player.apple_tv_family_room
to: "paused"
action:
- service: light.turn_on
target:
entity_id: light.family_room_lights
data:
brightness_pct: 80
transition: 1
References and Resources
To dive deeper, check out these official documents and community tutorials.
- Official Documentation:
- YouTube Tutorial:
This video provides a great visual overview of creating home theater scenes and automations.