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.
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
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.
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
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…
- 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.