#Restore HVAC to previous state both scenes and variables not working

1 messages · Page 1 of 1 (latest)

true surge
#

I would like to save the current HVAC state of my Tado termostates and restore it within an automation.

First I tried creating a scene on the fly within the automation but upon restoring it i ran into problems a sceen which contained the thermostate in auto was alway erratically restored as heat

Then I tried storing the HVAC state in a variable

  current_hvac_tado: "{{ states('climate.office') }}"

but when I try restoring the HVAC mode

data:
  hvac_mode: "{{  current_hvac_tado }}"
target:
  entity_id: climate.office

I get an error message

true surge
#

I did some more research

case 1: climate.office is in hvac_mode=off --> then the variable contains 'off'

case 2: climate.office is in hvac_mode=auto --> then the variable contains auto

seems odd that in auto mode the '' are missing could this be the reason?

fringe skiff
#

it can very well be.
I don't have an HVAC for trying it out and also don't have this exact logic that you're applying in any of my automation (I use something different) so can't really use mine to test.

But, try:

variables:
current_hvac_tado: >
"{{ states('climate.office') }}"

This forces adding quotes. Because if you add quotes at the same level of the variable like you do, those double quotes are used to open the template code.
Instead, by using the > you do not need quotes and your code goes one row below.
But, if you add quotes again, you trick it into force adding the quotes