From 059218e428117fa462e2cc3ba73c07c778befad6 Mon Sep 17 00:00:00 2001 From: Tom Duijf Date: Fri, 16 Oct 2015 00:32:24 +0200 Subject: [PATCH 1/3] Cookbook: Dim lights when playing media --- .../dim_lights_when_playing_media.markdown | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 source/cookbook/dim_lights_when_playing_media.markdown diff --git a/source/cookbook/dim_lights_when_playing_media.markdown b/source/cookbook/dim_lights_when_playing_media.markdown new file mode 100644 index 00000000000..5b4e2ba9d6e --- /dev/null +++ b/source/cookbook/dim_lights_when_playing_media.markdown @@ -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 +``` + From 9ee5914901fc7ea6320a5bf55d670ed2f04c4c6e Mon Sep 17 00:00:00 2001 From: Tom Duijf Date: Fri, 16 Oct 2015 00:32:24 +0200 Subject: [PATCH 2/3] Cookbook: Dim lights when playing media --- .../dim_lights_when_playing_media.markdown | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 source/cookbook/dim_lights_when_playing_media.markdown diff --git a/source/cookbook/dim_lights_when_playing_media.markdown b/source/cookbook/dim_lights_when_playing_media.markdown new file mode 100644 index 00000000000..5b4e2ba9d6e --- /dev/null +++ b/source/cookbook/dim_lights_when_playing_media.markdown @@ -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 +``` + From 7344b18633ec5a465f22421ac7427c37670e4202 Mon Sep 17 00:00:00 2001 From: Tom Duijf Date: Fri, 16 Oct 2015 19:27:48 +0200 Subject: [PATCH 3/3] Fixed formatting --- .../dim_lights_when_playing_media.markdown | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/source/cookbook/dim_lights_when_playing_media.markdown b/source/cookbook/dim_lights_when_playing_media.markdown index 5b4e2ba9d6e..b3162bd8e4d 100644 --- a/source/cookbook/dim_lights_when_playing_media.markdown +++ b/source/cookbook/dim_lights_when_playing_media.markdown @@ -23,28 +23,28 @@ A 2 second transition gives a nice 'feel' to the switch. 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 ] + 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 ] + 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 ] ```