Automation with multiple entitites with numeric_state is not triggered

Hi folks!

I have the following automation which should observe the temperature outside and check this against some room temperatures to notify me, when I can open the windows to cool the rooms down.

Actually this automation isn’t called and I dont know why. Meanwhile I’ve searched the forum and I came to the conclusion, that this should work. What am I missing?

alias: Lüften im Sommer
description: ""
trigger:
  - platform: numeric_state
    above: sensor.aussentemperatur
    below: sensor.aussentemperatur
    entity_id:
      - sensor.lumi_lumi_weather_temperature_2
      - sensor.lumi_lumi_weather_temperature_3
      - sensor.lumi_lumi_weather_temperature_4
      - sensor.lumi_lumi_weather_temperature_8
      - sensor.lumi_lumi_weather_temperature_9
      - sensor.wohnzimmer_temperature
condition:
  - condition: state
    entity_id: sensor.season
    state: summer
action:
  - variables:
      area: "{{ area_name(trigger.entity_id) }}"
      openWindows: "{{ trigger.below }}"
      device_state_icon: 🪟
      device_state_name: "{% if openWindows == false %}öffnen{% else %}schließen{% endif %}"
      device_state: "{% if openWindows == false %}öffnen{% else %}schließen{% endif %}"
  - service: notify.notify
    data:
      title: "{{ device_state_icon }} Fenster in {{ device_state_name }}"
      message: Du solltest die Fenster in {{area}} nun {{device_state_name}}
mode: parallel
max: 10

I don’t think you can put sensors into the trigger like this.

I think you need to look at template triggers in the documentation.

You want those sensors to be both above and below the same value? That’s not possible.

If you want it just to be either above or below that’s two separate triggers.

Yeah I see. My intension was to check later if the value is above or below. I actually thought the above and below would be an or check when both are applied. I guess I have to check them in two triggers. Too bad, I really would prefer such a “small” automation for this to avoid a double declaration of those triggers, which are basically the same.

I guess there is something pretty wrong. I only set the entity_id to the sensor outside and fixed value for above or below and the automation doesnt get triggered.

The numeric state trigger only fires when the state crosses the threshold figure.

Also, the trigger does not fire if the threshold value moves — this isn’t obvious or intuitive.

You probably want to just trigger on simple state changes for any of the seven entities in your original config, then work out what to do with them in the action. An alternative would be one or more template triggers with trigger ids attached to them.

2 Likes

Yeah, see the docs:

Listing above and below together means the numeric_state has to be between the two values

Thank you, this works pretty fine :slight_smile:

alias: Lüften im Sommer
description: ''
trigger:
  - platform: state
    entity_id:
      - sensor.lumi_lumi_weather_temperature_2
      - sensor.lumi_lumi_weather_temperature_3
      - sensor.lumi_lumi_weather_temperature_4
      - sensor.lumi_lumi_weather_temperature_8
      - sensor.lumi_lumi_weather_temperature_9
      - sensor.wohnzimmer_temperature
condition:
  - condition: state
    entity_id: sensor.season
    state: summer
action:
  - variables:
      area: '{{ area_name(trigger.entity_id) }}'
      openWindows: >-
        {{ states('trigger.entity_id') >
        states('sensor.garten.garten_temperature') }}
      device_state_icon: 🪟
      device_state_name: '{% if openWindows == true %}öffnen{% else %}schließen{% endif %}'
  - service: notify.notify
    data:
      title: '{{ device_state_icon }} Fenster "{{area}}"'
      message: Du solltest die Fenster in {{area}} nun {{device_state_name}}