Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ rake preview
```


### Preparation on CentOS
On CentOS (here 7.1.1503) Ruby is not available by default. Please take the notes here as a little guide for the Ruby installation process.
### Preparation on Fedora and CentOS
On Fedora 22 or CentOS 7.1.1503 Ruby is not available by default. Please take the notes here as a little guide for the Ruby installation process.

```bash
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
Expand Down
83 changes: 83 additions & 0 deletions source/cookbook/dim_lights_when_playing_media.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
layout: page
title: "Dim lights when playing media"
description: "Dim lights up or down when playing media"
date: 2015-10-15 19:05
sidebar: false
comments: false
sharing: true
footer: true
---

Like it how the lights dim up/down at the movies? Do it at home as well!

This example uses the media player, Philips Hue (transitions) and the sun component.
We'll use actions to detect media player state changes and scenes to control multiple
lights, color settings and transition between scenes.

#### Scenes
One scene for normal light, one for when movies are on.
A 2 second transition gives a nice 'feel' to the switch.

```yaml
scene:
- name: Livingroom normal
entities:
light.light1:
state: on
transition: 2
brightness: 150
xy_color: [ 0.4448, 0.4066 ]
light.light2:
state: on
transition: 2
brightness: 215
xy_color: [ 0.4448, 0.4066 ]
- name: Livingroom dim
entities:
light.light1:
state: on
transition: 2
brightness: 75
xy_color: [ 0.5926, 0.3814 ]
light.light2:
state: on
transition: 2
brightness: 145
xy_color: [ 0.5529, 0.4107 ]
```


#### Automation
The paused/stopped state is best matched using "from: 'playing'".
Adding in the sun condition as we only want this when it's dark.

```yaml
automation:
- action: "Media player paused/stopped"
trigger:
- platform: state
entity_id: media_player.htpc
from: 'playing'
condition:
- platform: sun
entity_id: sun.sun
state: 'below_horizon'
action:
service: scene.turn_on
entity_id: scene.livingroom_normal

- alias: "Media player playing"
trigger:
- platform: state
entity_id: media_player.htpc
to: 'playing'
condition:
- platform: sun
entity_id: sun.sun
state: 'below_horizon'
action:
service: scene.turn_on
entity_id: scene.livingroom_dim
```