Use number helper value as numeric state for automation

I’m trying to manually make an air conditioning system using the home assistant and manually controlled air conditioners plugged into zigbee outlets. I want to make the numeric state condition a of an automation the same as a number value helper. Basically trying to make it so when I type in 67 it makes the value of when to turn off the ac (Numeric state) 67, and thus shuts off at 67 degrees. All I can think of now is using a bunch of separate automations, one per degree Fahrenheit.

Basically, how do I use the number in a Numeric state always the same as a number helper value?

Do you mean condition? Here it is as a trigger, which will fire when the temperature transitions from above the input_number to below it:

  - platform: numeric_state
    entity_id: sensor.your_temperature_sensor
    below: "{{ states('input_number.your_threshold')|int }}" <-- EDIT: doesn't work!

You should also trigger from the state of the input_number so that the HVAC adjusts itself if you change the threshold.

What? There is no HVAC system. Their just air conditioners, and temperature sensors. I need the trigger to fire every 59 seconds, upon triggering i need it to check using conditions if the temperature sensor is below the value in the number helper, or when it is above. (Two Separate automations, one for on one for off)
Can I do what u just said using conditions Instead of triggers?

Also theirs a " after your code. Is that necessary? Or a typo? Sorry I’m not entirely sure how this works and stuff.

Why do you need it to trigger every 59 seconds, instead of when the temperature changes?

Let me know what the sensor and switch (AC) entities are called, and I’ll put something together.

No typo — that’s how single-line templates are written.

Sometimes it doesn’t Register a Change and theirs also multiple sensors. I’ll try that as a trigger and see what happens.

So it’s telling me expected float for dictionary value @ data[‘below’]

platform: numeric_state
entity_id: sensor.indoor_temperature
below: ‘{{ states(’‘input_number.kitchen_ac_temp’’)|int }}’

Really sorry, I was mistaken — you can’t use templates in the below: field. You can use platform: template to do a similar job — I’ll reply later with a solution.

What is platform template?

Read the excellent documentation.

I have, and have just found out you can use the input_number directly:

below: input_number.kitchen_ac_temp

Waaat. That’s easy af I feel retarded.

Wait can I just add it to conditions? It didn’t give me an error so I think I can? Thanks tho dude

You can. Again, covered in the documentation.

However, it’s preferable to trigger from “real events” such as temperature changes rather than doing time-based triggers. You then get the action happening at the exact time of the update rather than up to a minute later, and if there is no change, the automation doesn’t run.

Ya that makes sense. Problem is that if, say it’s 70 degrees in the room in question. Say bedroom. And the number it’s set to is 67. But the air conditioners are already off, and it already triggered once or rebooted with them off. So the state does not change to being above 67 degrees and trigger the event, despite continually heating up to well over 67 degrees. Because it didn’t change to being above 67 degrees. So it won’t trigger. Say I use a 59 second timer and use the general trigger of the state changing on the sensor/sensors in question. It trigger every time the state changes regardless of temperature. So if you set the condition to be a numeric state that’s a variable, you avoid the issues and even if the temperature stays exactly the same because say it rebooted with them off and the sensor stopped working or the temperature didn’t change, their is still a 59 second timer and the condition of a Numeric state. So it covers all the bases. :man_shrugging:

Agreed, but if you have many automations running like that, you’ll have a very busy system.

Perhaps a “startup” automation as well, then:

  - platform: homeassistant
    event: start
  - service: >
      {% if states('sensor.indoor_temperature')|int > states('input_number.kitchen_ac_temp')|int %}
      {% else %}
      {% endif %}
    entity_id: switch.ac_outlet

As a final suggestion, set one of these up instead:

Mine, for my heating, looks like this:


Ya I see what you mean. Start-up automation is definitely a good idea. but I only have this and a few other minor things running on the raspberry pi outside docker. home assistant and most everything else is on home assistant. Only thing that isn’t is a VPN idek when I used last. I never had any issue with response time on my home assistant. The main reason I do this is that sometimes ecowitt sensors don’t actually trigger events when they change state. It only happened like three times total and may be due to network issues, but if I leave for vacation it’s more or less mandatory that this all works without a single hitch as I have a chinchilla that needs it to have the temperature and humidity regulated.