Temperature sensor automation never triggering

I know I’ve seen this question asked elsewhere, but I have tried all the suggestions that I could find in those threads, but I still have a non-functioning automation based on the temperature value of my Mysa AC controller.

Here is the yaml:

alias: 'Studio AC: If room temp gets above 80 turn on AC'
description: ''
  - platform: numeric_state
    entity_id: sensor.mysa_59be2c_current_temperature_2
    above: '80'
  - condition: or
      - condition: state
        entity_id: climate.studio_ac
        state: 'off'
      - condition: state
        entity_id: climate.studio_ac
        state: heat
  - condition: time
    before: '23:59:59'
    after: '09:00:00'
    weekday: []
  - device_id: c9fa6c66277a13dd9bec2c5f8bf85c5b
    domain: climate
    entity_id: climate.studio_ac
    type: set_hvac_mode
    hvac_mode: cool
mode: single

I have other automations that turn the unit off around 1am if left on, and two more that turn it on an hour before I enter the home studio/office where the AC unit is located based on what the forcasted high for the day is. Both those sets of automations work just fine.

But this one above, which is triggering on the numeric state of the current_temperature sensor just never triggers. I check the traces, and it’s not even like the conditions are blocking the actions, I just don’t get a trigger.

I have checked to make sure that the automation was enabled while the temp was below the “above” threshold, and every night it most certainly drops well below that temp.

Any ideas on what else I can look at to get this working reliably?

You could try just using a template trigger

{{ states(“sensor.mysa_59be2c_current_temperature_2”) | int(0) > 80 }}

And then also test that template in developer tool / templates to verify it returns true and false as expected

Tell us how you are testing this automation. Because it will only trigger at the moment the sensor’s value increases from below 80 to above 80. In other words, it triggers exclusively at the crossing of 80. After triggering, it will not trigger again until the value first decreases below 80 and then increases above 80.

@123 I am testing this by turning off the unit when the current temp is under the 80 threshold, and then watching the sensors temp climb over 80. No trigger.

I’ve tested this over and over again with temp being under the threshold, waiting for it to go above, and nothing.

@PeteRage is that approach more likely to trigger than what I have? Why is that the case?

Have you tried removing the quotes from around the ‘80’ ? Docs don’t have quotes. Pretty sure I don’t have quotes in my automations for the numeric state values.

1 Like

Well we could really do with seeing one of the traces to see what isn’t working.

I’d also point out that:

before: '23:59:59'

is not necessary, that will always be true when the time is after 9am, and at midnight it will no longer be after 9am.

Advantage of using a template is you can test it in developer tools directly to see if it works. If it does work it’ll trigger on every sensor value that is greater than 80.

The quotes don’t matter. The Numeric State Trigger understands the value of the above and below options is to be handled as a number

Create a simple automation with a Numeric State Trigger and an input_number (whose range is 1 to 10 with an initial value of 1). Set above to 5. Set the automation’s action to send a persistent notification. Move the input_number’s slider from 1 to 6. The automation should trigger and send the notification.

If it works, then something else is wrong with your original automation.
If it fails, then something is amiss on your system, notably with Numeric State Triggers.

How about commenting out the entire condition: section to ensure that it isn’t one of those which is actually preventing your automation from running. I know you said it isn’t triggering, but just give it a try.