Numeric state does not always trigger

I have following automation:

- alias: "Activate manual mode with level 4 if humidity is too high"
  trigger:
    - platform: numeric_state
      entity_id: sensor.bathroom_relative_humidity_11_5
      above: 47
  condition:
    - condition: state
      entity_id: 'sensor.mode'
      state: 'auto'
  action:
    # activate manual mode
    - service: shell_command.write_variable
      data_template:
        rtr: 5
        variable: v00101
        value: 1
    # set fan level to 4
    - service: shell_command.write_variable
      data_template:
        rtr: 5
        variable: v00102
        value: 4
    - service: notify.ios_fabian_iphone
      data:
        title: "Manuelle Lüftung Stufe 4 aktiviert"
        message: "Luftfeuchtigkeit im Bad: {{ states.sensor.bathroom_relative_humidity_11_5.state }}%"

- alias: "Activate automatic mode if humidity is ok"
  trigger:
    - platform: numeric_state
      entity_id: sensor.bathroom_relative_humidity_11_5
      below: 47
  condition:
    - condition: state
      entity_id: 'sensor.mode'
      state: 'manual'
  action:
    # activate manual mode
    - service: shell_command.write_variable
      data_template:
        rtr: 5
        variable: v00101
        value: 0
    - service: notify.ios_fabian_iphone
      data:
        title: "Automatische Lüftung aktiviert"
        message: "Luftfeuchtigkeit im Bad: {{ states.sensor.bathroom_relative_humidity_11_5.state }}%"

Which basically sets the fan level to 4 (highest) for my house ventilation system if the humidity in the bathroom is above 47% and sets it back to automatic if it is below.
From time to time the “below” is not triggered. How can I find out why? Or does anyone have an idea why?
The sensor reports the state as I can see it in Grafana as well.

Thanks.

is sensor.mode reporting ‘manual’ at the same time sensor.bathroom_relative_humidity_11_5 goes below 47?

That’s too obvious :smiley:
I’ll check that.

It was set to manual. What else could be the reason?


I am wondering if I have got a case of this: https://github.com/home-assistant/home-assistant/issues/7170
Updated config, let’s see.
Edit “equal” did not work, so I specified now above 47 and below 46…

Edit: seems to work with the fix above.