Climate Automation Help

Hello! I’m trying to set an automation for when I leave my house. I want it to set the target temperature to 15 degrees, essentially turning off the heater while I’m away. When I’m home, it should heat up normally (return to 22 degrees target temperature). This is what I have so far, but it doesn’t seem to work:

- alias: Heater when away
  trigger:
    platform: state
    entity_id: group.all_devices
    state: not_home
  action:
    service: climate.set_temperature
    data:
      entity_id: climate.heating
      temperature: 12
      operation_mode: Heat

Any help would be greatly appreciated!

I think I got it to work. I had to add temperature like this:

temperature: ‘12’

So, the code is:

- alias: Heater when away
  trigger:
    platform: state
    entity_id: group.all_devices
    state: not_home
  action:
    service: climate.set_temperature
    data:
      entity_id: climate.heating
      temperature: '12'