Help needed on climate preset modes in automations

I need some help with some automation yaml code to set my thermostat to preset ‘away’ when entity_id ‘group.parents’ is ‘not_home’ and to ‘none’ when they are ‘home’.

So far I have this, but don’t know what to put at the end to set the preset. Do I set it to preset_mode: "away" and preset_mode: "none"?

- id: '1575231618454'
  alias: Thermostat - We're Not Home
  description: ''
  trigger:
  - entity_id: group.parents
    platform: state
    to: away
  condition: []
  action:
  - alias: ''
    data: {}
    service: climate.set_preset_mode
    entity_id: climate.thermostat
- id: '1575231618455'
  alias: Thermostat - We're Home
  description: ''
  trigger:
  - entity_id: group.parents
    platform: state
    to: not_away
  condition: []
  action:
  - alias: ''
    data: {}
    service: climate.set_preset_mode
    entity_id: climate.thermostat

Go to developer tools > states and look for climate.thermostat. Do you see preset_modes: in the state attributes? If you do, those would be what you use.

Thanks. I’m all a bit new to this, so still finding my way around. Found the preset mode thanks:

This is the code I have. The ‘Thermostat - We’re Not Home’ works in that it sets the thermostat to ‘away’ but the ‘Thermostat - We’re Home’ does not set the thermostat to ‘none’, it just stays as ‘away’

Can anyone help please?

- id: '1575231618454'
  alias: Thermostat - We're Not Home
  description: ''
  trigger:
  - entity_id: group.parents
    platform: state
    to: not_home
  condition: []
  action:
  - alias: ''
    data:
      preset_mode: away
    service: climate.set_preset_mode
- id: '1575233619529'
  alias: Thermostat - We're Home
  description: ''
  trigger:
  - entity_id: group.parents
    platform: state
    to: home
  condition: []
  action:
  - data:
      preset_mode: none
    service: climate.set_preset_mode
1 Like

Upon further review, I think it does set the thermostat back to ‘none’ but it does not set the temperature back to the same as it was pre ‘away’

Hello… In the automation to change the preset mode, you need (I think) to have something like this

 action:
    - service: climate.set_preset_mode
      data:
        entity_id: <your entity>
        preset_mode: 'none'

For my instance, this is working (I have a lot of automations like this) but I am running in a virtual environment… not sure about other config but this should be the same.

4 Likes

Thanks @browetd , working now.

Hi
I was looking exactly for this automation. Do you think will be possible to have just one automation using template mapping on trigger.state ?
group home => preset none
group not_home => preset away

Thank you

And from AppDeamon? ‘none’ desn’t works…

You have to write an automation where the trigger is the state of your group. The automation will be triggered each time the group state changes (from home to not_home for example)

In the action, you have to test if the group has the value “home”, if ok than set preset to “none”, else set preset to “away”. To be tested but that’s the idea… :slight_smile:

- alias: test
  trigger:
    - platform: state
      entity_id: <your group>
  action:
    - service: climate.set_preset_mode
      data_template:
        entity_id: <your entity>
        preset_mode: >
          {% if <state of your group> == "home" %}
               none
          {% else %}
               away
          {% endif %}    

Hi,
in my case, I cannot see any “preset_mode” in the developer tool window, have you any idea about the reason?
I’m running the official Netatmo integration.

I fixed it, reinstalling the integration, now it looks like everything is working fine.