Yeah things are a bit goofy. I’m going to read over the template docs to see what’s wrong with this (somewhat simple) test that also fails:
condition: template
value_template: |
{{ is_state(light.kitchen_island, 'off') }}
Yeah things are a bit goofy. I’m going to read over the template docs to see what’s wrong with this (somewhat simple) test that also fails:
condition: template
value_template: |
{{ is_state(light.kitchen_island, 'off') }}
Should be:
{{ is_state(‘light.kitchen_island’, 'off')}}
Hmm, ok, here’s the entire script that’s not working:
alias: Test
description: ''
trigger: []
condition: []
action:
- service: script.family_room_tv_lights_on_daily_color
- scene: scene.family_room_normal_scene
- condition: template
value_template: |
{{ is_state(light.kitchen_island, 'off') }}
- scene: scene.kitchen_island_normal_scene
mode: single
Dropping the last curly braces “}}” gives an error about an incomplete dict so unless I misunderstood your suggestion I don’t think that worked for me.
I’ve read through all the templating documentation and can’t find any references to the “|” pipe right after the value_template. Does it mean “or” or something else? A lot of examples in the docs show a “>” but they don’t explain why, so that’s confusing.
Should be:
‘light.kitchen_island’
OK! Thanks that fixed this test script. I went back to my original script and made one small change:
action:
- service: script.family_room_tv_lights_on_daily_color
- scene: scene.family_room_normal_scene
- condition: template
value_template: >
{% set light = 'light.kitchen_island_center' %} {{ is_state(light, 'off')
or
(state_attr(light, 'brightness') != 15 and
state_attr(light, 'hs_color') != [120.472, 49.804]) }}
- scene: scene.kitchen_island_normal_scene
I changed the line here:
{% set light = light.kitchen_island_center %}
to
{% set light = 'light.kitchen_island_center' %}
Once the single quotes were added the function in the template was operating as expected and the whole thing works now! Thanks for everyone’s help in getting this working for me.