Nest event problem

Hi trying to get a notification every time the nest away_mode switches but can’t see to

What is working: Tasker http post to turn away mode on
via
http://myip:8123/api/services/climate/set_away_mode?api_password=mypassword
json{“entity_id”:“climate.hallway”, “away_mode”:“on”} or “off”

turns the nest away mode on/off. Great.

Not working: configuration yaml

    notify:
      - name: mypushbullet
        platform: pushbullet
        api_key: mykey
    #####################################
    automation:  
    - alias: nesthome
      initial_state: True
      hide_entity: False
      trigger:
        platform: state
        entity_id: climate.hallway
        state: 'away_mode:off'
      action:  
        service: notify.mypushbullet
        data_template:
            title: "Nest"
            message: 'Nest set to Home @ {{now().strftime("%H:%M:%S [%Y-%m-%d]")}}'
    - alias: nestaway
      initial_state: True
      hide_entity: False
      trigger:
        platform: state
        entity_id: climate.hallway
        state: 'away_mode:on'
      action:  
        service: notify.mypushbullet
        data_template:
            title: "Nest"
            message: 'Nest set to Away @ {{now().strftime("%H:%M:%S [%Y-%m-%d]")}}

neither fire. yet if i trigger the item manually a pushullet notification results. it’s as though the trigger state entity isnt registering correctly.
Any thoughts as to what is wrong?

Can you post your config with formatting maintained. See the first post for instructions

notify:
  - name: mypushbullet
    platform: pushbullet
    api_key: mykey
#############################################

automation: 
- alias: nesthome
  initial_state: True
  hide_entity: False
  trigger:
    platform: state
    entity_id: climate.hallway
    state: 'away_mode:off'
  action:  
    service: notify.mypushbullet
    data_template:
        title: "Nest"
        message: 'Nest set to Home @ {{now().strftime("%H:%M:%S [%Y-%m-%d]")}}'
- alias: nestaway
  initial_state: True
  hide_entity: False
  trigger:
    platform: state
    entity_id: climate.hallway
    state: 'away_mode:on'
  action:  
    service: notify.mypushbullet
    data_template:
        title: "Nest"
        message: 'Nest set to Away @ {{now().strftime("%H:%M:%S [%Y-%m-%d]")}}'

The trigger is wrong. Since “away_mode” is an attribute, I believe you’ll need to use a template trigger instead

trigger:
  platform: template
  value_template: "{{ is_state_attr('climate.hallway', 'away_mode', 'off') }}"

Your automations are not triggering as climate.hallway does not have a state “away_mode:off” Away mode is an attribute of climate.hallway not a state. That is why it is in the third column of the states page and not the second.

Here is how I implemented this…

Create a template sensor:

sensor:     
  - platform: template
    sensors:
      hallway_away_mode:
        entity_id: climate.downstairs
        value_template: "{{ is_state_attr('climate.hallway', 'away_mode', 'on') }}" 

From there replace the following in your above automations under trigger:

entity_id from ‘climate.hallway’ to ‘sensor.hallway_away_mode’

and

state: from ‘away_mode:off’ to ‘false’ in the first automation
state: from ‘away_mode:on’ to ‘true’ in the second automation

No need for the extra sensor. Just use a template trigger like I mentioned above.

Yep, multiple ways to skin a cat. I just like sensor option as then I can keep a history of that away_mode usage. Also helpful in troubleshooting my automation as I have conditions based on the away_mode. Reviewing the logbook to see why it didn’t trigger and I can check the away_mode status when it should have triggered.

 trigger:
platform: template
value_template: "{% if is_state_attr('climate.hallway', 'away_mode', 'on') %}true{% endif %}" 

Is working. Thanks for all the help

Fair enough. Although you can handle conditions and log attribute changes to the logbook without the extra sensor as well. I already have enough sensors, so I prefer to avoid creating more that just duplicate data. Nice thing is, HASS is flexible enough to let you do it whichever way you want :sunglasses:.