How do i make a TemplateSensor Go Unavaliable when the sensor goes offline

so Say
if sensor.hallway_temp_sensor_temperature reads 10
so
template sensor “Hallway Temperature Display” reads 10
and normally pass’s 10 to climate.furnace_current_temperature

now when sensor.hallway_temp_sensor_temperature goes unavaliable
template sensor “Hallway Temperature Display” goes unavaliable
but it doesnt pass climate.furnace_current_temperature unavaliable or null

so then i tried doing that in the avaliabity code
if sensor.hallway_temp_sensor_temperature set climate.furnace_current_temp to value if its not avaliable set climate.furnace_current_temp to null

again, not possible.

Can you please explain what the end goal of this entire setup is?

set Climate Current Temp to a Value or Null null works when you reboot HA
since Climate Current Temp does not update if the Temperature goes from a Value to Unavalable
so when the state is a number send the number when the state is unavaliable send “null” which is “n/a” option

Why.

if you have a Furnace running and you set it to 20degrees and the sensor goes unavalible for 6 months say that Furnace is going to run for 6 months non stop and there is nothing to turn it off as it will think the temperatue is 20 even when the temperature is say 50 degrees

as i have a automation if the temperature is unavaliable to turn off the furnace but if it never gets that null it will never shut off

And how will setting the climate device to null accomplish anything? The state inside HA will just be unavailable until the climate device updates again, that doesn’t mean the climate device will halt it’s current process.

From what it sounds like, you really just need to build a simple automation that turns off the Furnace if it’s been running for a long period of time and if the sensor has been unavailable for an extended period of time.

automation

if climate.furnace_current_temperature = null it shuts off the furnace relay
but it never gets that null

but ill try that make another simple one

ok since i tried to do this how do you change a Attribbute?
as the automation i had was well didnt work but trying to make an attribute change

  • action: python_script.set_state
    metadata: {}
    data:
    entity_id: {{state_attr(‘climate.moms_furnace’, ‘current_temperature’)}}
    state: null

how can i change a value attribute…

- alias: Turn off furnace
  triggers:
  - trigger: state
    entity_id: climate.moms_furnace
    to: heat
    for:
      minutes: 60
  conditions:
  - condition: state
    entity_id: sensor.hallway_temp_sensor_temperature
    state: unavailable
  actions:
  - action: climate.turn_off
    target:
      entity_id: climate.moms_furnace

ok ill try that

Yeah, you don’t need that at all. You’re thinking about this from a single standpoint and you’re not budging from your thought process.

If you really just want an automation that turns off the climate entity when the sensor goes unavailable.

- alias: Turn off furnace
  triggers:
  - trigger: state
    entity_id: sensor.hallway_temp_sensor_temperature
    to: unavailable
    for:
      minutes: 5
  conditions:
  - condition: state
    entity_id: climate.moms_furnace
    state: heat
  actions:
  - action: climate.turn_off
    target:
      entity_id: climate.moms_furnace

i tried the 2nd one since i had that first one… 2nd one doesnt work i changed it to 5 seconds… if i delete the sensor and hallway_temp_sensor_temperature goes unavaliable it never actually executes
and i wanna be able to change the Current Temp display to n/a

might work better?
how do i run this in the automation

set 'climate.moms_furnace', 'current_temperature'
to “null”
alias: "!!Furnace shut off"
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.hallway_temp_sensor_temperature
    to: unavailable
    for:
      hours: 0
      minutes: 0
      seconds: 5
conditions:
  - condition: state
    entity_id: climate.moms_furnace
    state: heat
actions:
  - action: climate.turn_off
    metadata: {}
    data: {}
    target:
      entity_id: climate.moms_furnace
mode: single

at moment im still playing around making it go unavalible but so far it wont trigger the automation but ill keep playing around

You cannot set states in home assistant. The state is set by the entity and the entity will always override it when it updates.

If you want to test this automation properly, go to developer tools → states page and push the word unavailable to the entity (sensor.hallway_temp_sensor_temperature). Otherwise you have to wait for it to go unavailable. And remember, even if you push the unavailable state to the entity, if the entity updates, it will overwrite what you just typed in because

the climate sensor doesnt get update only when its forced it sits there if the sensor is unavalaible the Temperature stays the state like i said

here its set to null


Did I mention the climate entity?

its not an entity its an attritubte… you see if you set it to NULL to goes to N/A

Dude. Stop focusing on the climate entity. Please test the automation with sensor.hallway_temp_sensor_temperature

i did that told you it never runs

Is the state getting overwritten? I feel like I’m going in circles here.

1 Like

the state is 12 you delete the esp32 from devices it goes to unavaliable
it never runs the automation for being unavalible for 5 seconds