Climate away_mode sets temperature to minimum when double triggered

Hi there

I wrote some automations.

  1. When no one is at home, set away_mode=on
  2. set away_mode=on after 2300 (night downshift)

Funny thing: When both trigger (no one is at home and it is after 2300) the away_mode is off, but the target temperature is set to the away_mode temp.

Does one of you experience the same?
When I manually activate away mode and wait for a automation trigger, it seems to be normal.

At the moment, I’m writing on conditions, but I do not know the away_mode state check. Can someone point be to the function documentation?

Regards, Luke

Do you have the yaml for those automations?

sure:

  - alias: Heating off when no one is at home #works
    initial_state: True
    hide_entity: False
    # Condition missing: check if away_mode is not already active
    trigger:
      platform: state
      entity_id: device_tracker.94652d8060fc
      to: 'not_home'
    action:
      - service: climate.set_away_mode
        data:
          entity_id: climate.heating
          away_mode: 'on'

  - alias: Heating on when Lukas arrives #works
    initial_state: True
    hide_entity: False
    trigger:
      platform: state
      entity_id: device_tracker.94652d8060fc
      to: 'home'
    action:
      - service: climate.set_away_mode
        data:
          entity_id: climate.heating
          away_mode: 'off'

  - alias: Heating to away_mode at 23:00 #check this!!!
    initial_state: True
    hide_entity: False
    trigger:
      platform: time
      at: '23:00:00'
    condition:
    #here we have the problem: When I do not check for availability and just set away_mode, it overwrites the flag when 94652d8060fc is not present.
      condition: and
      conditions:
       - condition: state
         entity_id: device_tracker.94652d8060fc 
         state: 'home'
       - condition: state
         entity_id: 'binary_sensor.workday_sensor'
         state: 'on'
    action:
      - service: climate.set_away_mode
        data:
          entity_id: climate.heating
          away_mode: 'on'

  - alias: Heating back from away_mode at 09:00 #check this!!!
    initial_state: True
    hide_entity: False
    trigger:
      platform: time
      at: '9:00:00'
#      at: '{{ input_datetime.input_startheating_workdays }}'
    condition:
      condition: and
      conditions:
       - condition: state
         entity_id: device_tracker.94652d8060fc #Lukas
         state: 'home'
       - condition: state
         entity_id: 'binary_sensor.workday_sensor'
         state: 'on'
    action:
      - service: climate.set_away_mode
        data:
          entity_id: climate.heating
          away_mode: 'off'

I assume it’s a bug. Any thoughts?

is never firing if you aren’t at home, because that is in your condition. Unless I’m confused, the only automation that would occur if you aren’t at home is

So, this looks like it is working as expected. I may be following the logic wrong though. One thing to note as well, you don’t have a from: ‘home’ and to: ‘not_home’. This may be needed depending on your presence detection. Some presence detection devices, like owntracks, will report changes in your location whenever you move. So you’ll get from: “not_home”, to “not_home” events. Super annoying if you ask me. You may want to filter those out. That also may be the cause of your oddities.

If you want to check the status of away mode, you can use a conditional template:

condition:
  condition: template
  value_template: {{ states.device_tracker.94652d8060fc.attributes.away_mode == 'on' }}

That value template may change depending on where away_mode is inside the device_tracker object. Typically its inside attributes.

away_mode is going to be platform specific. I can set away_mode as many times as I want for ecobee and it makes no difference.

If you really want to know how a specific platform works, click on the component and then click the source code and just search for “turn_away_mode_on” and start from there.

1 Like

Yes. I changed that to work around the problem at least when I’m at home.

- alias: Heating off when no one is at home #works initial_state: True hide_entity: False
If I leave after 2300, the _saved_target_temp is 16°C. I assume that’s the problem.

Plattform is generic_thermostat (misst that obviously)

I have two climate of generic_thermostat. And have the same issue with away_mode for both of them. The simplest way to reproduce the issue is to call climate.set_away_mode from Developer tool -> Services twice for the same climate entity.
@LukasQ, did you managed to resolve an issue?

Well, it was a gorgeous summer in Germany and I didn’t have the need for.
Let me Check…

No need to check. The issue is still there. I created a pull request with fix.
Unless it will be merged, you can use a custom component for your generic thermostat. Just save this file to \custom_components\climate in your Home Assistant config directory.

I have not seen the need for away mode. I use automation to detect when people are away and change the setpoint on the thermostats. What does away mode add?

It is described in documentation.

Ok, so it reverts to the previous setting when it’s turned off. I can see why this may be useful, instead of just forcing a new setting with an automation.

1 Like

Do you know what happens if you use an automation to change the temperature whilst the thermostat is in away mode?

It will change current temperature as well as enabling away mode. So in fact it will change temperature for away mode, but only for current one. Next time you will enable away mode, the temperature will the same as in config away_temp

So I should detect away mode in my automation and then have multiple actions to put back to normal mode, change the temperature and then put back into away mode.

Well, in this case I have to change the target temp as fixed value and back. Thus, the thermostat is less flexible, as the target temperature is hardcoded in the automation.
Long story short, I worked around with
- condition: template
value_template: ‘{{states.climate.heater.attributes.away_mode == “off”}}’
But didn’t implement it as mentioned. I’ll wait for the merge :wink:

Fixed in v0.82.1: