I am trying to change to a light scene (which works when I click activate in HA), when I pause media, but only under the conditions that specific lights are on, at exactly 206 brightness, and rgb of 255,0,0.
I’ve tried a number of configurations (as can be seen by my commented lines), but honestly I am completely new to yaml and even the documentation is difficult to parse.
you should use the template editor to see what values come from states. Also, use the states menu. Things like power_on just don’t exist on items.
seeing that you already have working code for the brightness, you can use that same line for the rgb color.
- alias: 'Family Room Media Pause switch light scene'
trigger:
- platform: state
entity_id: media_player.family_room
from: 'playing'
to: 'paused'
condition:
- condition: value_template
value_template: "{{ states.light.lamp.attributes.brightness == 206 and states.light.lamp.attributes.rgb_color == '255,0,0' }}"
action:
- service: scene.turn_on
entity_id: scene.media_paused
this is of course assuming that the rgb_color attribute returns 3 values separated by a comma inside a string. I cannot answer this because I don’t own an rgb bulb that supports this. You should be able to verify that this will work by going to the template editor and placing this code in it when your light is turned on:
{{ states.light.lamp.attributes.brightness == 206 and states.light.lamp.attributes.rgb_color == '255,0,0' }}
Firstly, huge help. Simply telling me to use the editors pointed me to read up on usage of those tools, which was a huge boon to my ability to test. Being day 1 to HA, I had basically zero knowledge, and wasn’t really sure how to start.
Now that I can use template editor, I’ve found the problem. But, I’m unsure what the deal is.
Brightness = 206
RGB = (255, 0, 0)
Test 1 = False
Test 2 = False
Test 3 = False
Test 4 = False
Test 5 = False
Test 6 = False
Test 7 = False
Test 8 = False