Set HVAC_MODE at Air Condition to value of variable

Hi, I have problem with air condition device.

At a automation start I store

variables:
  current_hvac_mode: "{{ states('climate.klimatizace_loznice') }}"

And finally at end of automation I need to restore value of HVAC_MODE that is already stored in my variable current_hvac_mode

The problem is that this code

device_id: ed7eb00713ddbf76e922498f8dc229c4
domain: climate
entity_id: 925f3671743e92433193c41edd18e7c8
type: set_hvac_mode
hvac_mode: {{ current_hvac_mode }}

cannot be saved because of error

Message malformed: value must be one of [‘auto’, ‘cool’, ‘dry’, ‘fan_only’, ‘heat’, ‘heat_cool’, ‘off’] for dictionary value @ data[‘hvac_mode’]

That is nonsense for… variable has valid value. But validator probably looks only at code… means see it as static text not dynamic value

Do you anybody see where I do mistake?

Put some quotes around it

I don’t think this will work with a device id - you need to use an entity id.

I did no know how to write it better… Here you can see printscreen from HA, detail of automation, excatly Actions part

Defined variable current_hvac_mode get heat

And finally when I want to set hvac_mode back to heat… I get error that this data malformed

If I change this line to

hvac_mode: heat

Everything would work well… But I need it change to value stored in variable not by static text

Use a Call Service Action, not a Device action.

service: climate.set_hvac_mode
target:
  entity_id: 925f3671743e92433193c41edd18e7c8
data:
  hvac_mode: "{{ current_hvac_mode }}"