Optional attribute trigger

Hello,

i am trying to write a blueprint with the following trigger:

trigger:
  - platform: state    
    entity_id: !input control
    attribute: target_temp_low

this describes the change of a wall mounted thermostat, which is a climate entity with the attribute: target_temp_low in which the temperature setpoint is stored.

This works, however not every room of my has a wall mounted thermostat, some only have an external temperature sensor, so i want to make the “control” input to be optional.

I tried the following which unfortunately doesn’t seem to work:

trigger_variables:
  control_trigger: !input control

trigger:
  - platform: template
    value_template: "{{ state_attr(control_trigger, 'target_temp_low')  }}"

the input for the “control” entity looks like this:

          control:
            name: Control
            default:
            selector:
              entity:
                filter:
                  - domain: climate

What am i doing wrong? Any help is much appreciated.

Hi Slomo11,

You can try fancy template stuff in the trigger but I seldom do because I have no idea what falls into the limited_template restrictions and what doesn’t.
I usually would do a trigger on the state of the entity, then in the conditions statements where I know all template stuff works, do your sort of your attributes against the triggered entity.

Ok thanks, i will try to find a solution within the conditions.

1 Like