#Message when coming home

1 messages · Page 1 of 1 (latest)

pseudo lantern
#

“I’m trying to create an automation so that I receive a notification when someone comes home. What am I doing wrong?” Can someone please help.

alias: Nachricht wenn jemand nach Hause kommt
description: >-
  xxx
triggers:
  - entity_id:
      - person.xxx
      - person.xxx
      - person.xxx
    to:
      - home
    trigger: state
    from:
      - not_home
conditions: []
actions:
  - data:
      title: Ankunft zu Hause
      message: |
        {{ states[to_state.entity_id].name }} ist gerade nach Hause gekommen.
    action: notify.mobile_app_iphone_xxx
mode: single
mental owlBOT
#

To format your text as code, enter three backticks on the first line, press Enter for a new line, paste your code, press Enter again for another new line, and lastly three more backticks.
```yaml
example: here
```
Don't forget you can edit your post rather than repeatedly posting the same thing.

unreal laurel
#

I guess it's "away" instead of "not_home"

#

You can also drop the from part completely

pseudo lantern
#

I always get the error 'to_state' is undefined but i do not know how to handle it I deleted the from part

unreal laurel
#

Are you using the UI to create the automation?

lean tiger
pseudo lantern
unreal laurel
lean tiger
#

not_home is the correct technical name of the state which is translated as Away

pseudo lantern
#

Thjis is the error i get when using trigger.to_state

Fehler: Error rendering data template: UndefinedError: 'dict object' has no attribute 'to_state'

lean tiger
#

That means it wasn't triggered by a state trigger

#

did you trigger it manually?

pseudo lantern
#

yes by start action

lean tiger
#

so in that case the trigger variable will be blank

#

and you'll have to handle that specially if you want that to work correctly

pseudo lantern
#

ok and how ?

lean tiger
#

What do you want to happen?

pseudo lantern
#

If someone enters the home zone i wann get a message about that

lean tiger
#

Yes, and it will.

But if you just force the automation to run, nobody will have entered the home zone, so it can't generate a meaningful message

#

If you want to just test this, then test it by modifying an entity state in developer tools, not by just forcing the automation to run with no trigger

pseudo lantern
#

this means the state has to change first to trigger the message right

lean tiger
#

correct

pseudo lantern
#

with thest you mean in developer tools Template

lean tiger
#

not template, developer tools -> state

#

you can force change the state of an entity

#

select one of your persons and change it to not_home, and then change it to home

#

that should trigger the automation and do a meaningful test