Condition from list does not validate

Hi, I am trying to set up a script that does something, depending on the state (color) of an entity (Ikea light). But I run into a problem regarding the fact that the state is a list of two items. I’m looking for the correct format of the value for the condition.

This is the output of the trace:

if/condition/0/entity_id/0
[If Xy color of IKEA of Sweden TRADFRI bulb GU10 CWS 345lm Licht is (0.243992, 0.408988)]
Executed: January 14, 2025 at 20:34:13
Result:
result: false
state:
  - 0.243992
  - 0.408988
wanted_state: (0.243992, 0.408988)
entity: light.ikea_of_sweden_tradfri_bulb_gu10_cws_345lm_licht

This is the code of the script:

sequence:
  - if:
      - condition: state
        entity_id: light.ikea_of_sweden_tradfri_bulb_gu10_cws_345lm_licht
        attribute: xy_color
        state: (0.243992, 0.408988)
    then:
      - action: notify.mobile_app_pixel_7_pro
        data:
          message: >-
            Ik sta op {{
            state_attr('light.ikea_of_sweden_tradfri_bulb_gu10_cws_345lm_licht','xy_color')
            }}
          title: Mijn licht status
alias: Licht status - bericht naar Pixel 7
description: ""

I suggest you use a Template Condition.

      - condition: template 
        value_template: >
          {{ is_state_attr('light.ikea_of_sweden_tradfri_bulb_gu10_cws_345lm_licht', 'xy_color', (0.243992, 0.408988)) }}

I tested it with a light on my system and it worked.

Thank you very much. That works!

1 Like