I’m new in HA and I want to set an automation, what is simple I think, but I don’t know and can’t find perfect sample for me.
My device tracking is works well.
It works well. But I don’t know how can i set the trigger.
Action is when my device arrived HOME, and presence switch home frome away, than my Google home (set volume 4, than) say Welcome home Michael. Action is works fine when trigger is a time or something simple. But the trigger bad. What is wrong?
This is my automation in configuration.yaml:
automation Welcome:
alias: Michael
trigger:
platform: state
entity_id: known_devices.huawei_mate_8
state: home
action:
- service: media_player.volume_set
data:
entity_id: media_player.living_room_home
volume_level: "0.4"
- service: tts.google_say
data:
entity_id: media_player.living_room_home
language: en
message: Welcome home Michael.
I’m not sure you would want to use “state” as the platform on this automation anyway. Once he is ‘home’ then going by state it may cause the automation to infinitely loop until he leaves that state. I could be wrong but going with the zone platform and event being enter it should only trigger one time when he enters the home zone.
@oembob This zone thing is not working, but (@rabittn solution) state is working. Are you sure this will be create an infinitely loop?
I need a solution for this situation with device tracker.
I need when switch to home from away. This switch is one time… Can I do it?
entries in yours. Which means it is looking for a state change. The OPs code does not have that so it is just looking for a state of “home” to activate it.
I only said it “may” cause an infinite loop of activations because I wasn’t sure if it would or wouldn’t. I just try to keep code as specific as possible to avoid issues like that.
I have my family device tracker entities all in a group called “family”. I then use the state condition. Here is my example:
alias: 'Motion when nobody home'
trigger:
platform: state
entity_id: binary_sensor.living_room_motion_motion
state: 'on'
condition:
condition: state
entity_id: group.family
state: 'not_home'
action:
service: notify.HomeAssistantFE
data:
message: 'Motion detected in the Living Room'