Hi, I am new in Home Assistant. My first goal is to track when my kids get home. I have this working and I can see it in the dashboard. What I cannot figure out is how it can send me an email when the kids arrive home.
I am having trouble getting device tracker automations to work. I have two automations that are very similar. One works and one doesn’t and I can’t figure out why.
This automation detects when I arrive and it works fine:
# Any device can indicate that I am home. If any device can see me, I should be here.
- alias: Jeremy Detected Live
initial_state: True
hide_entity: False
trigger:
- platform: state
entity_id: device_tracker.jeremy_phone_bt, device_tracker.jeremy_phone_ip
from: 'not_home'
to: 'home'
action:
- service: input_boolean.turn_on
entity_id:
- input_boolean.jeremy_home_live
- input_boolean.jeremy_home
This automation should detect when I leave. It never updates.
# All devices need to agree that I am not home. Any device can trigger the checking of whether all devices indicate I am gone.
- alias: Jeremy Gone Live
initial_state: False
hide_entity: False
trigger:
- platform: state
entity_id: device_tracker.jeremy_phone_bt, device_tracker.jeremy_phone_ip
from: 'home'
to: 'not_home'
condition:
condition: and
conditions:
- condition: state
entity_id: device_tracker.jeremy_phone_bt
state: 'not_home'
- condition: state
entity_id: device_tracker.jeremy_phone_ip
state: 'not_home'
action:
- service: input_boolean.turn_off
entity_id:
- input_boolean.jeremy_home_live
- input_boolean.jeremy_home
@RonJ103, this is exactly the approach I’ve been gravitating toward, so it’s awesome to see this example of it working as intended. Did you try with any other tracking components? I don’t keep my BT on but I like the idea of using ping or nmap to verify that a device is gone, as long as I won’t get false negatives.
My problem with now with router tracking through AsusWRT is that one phone constantly goes into sleep mode and gives false negatives on presence, which triggers a bunch of unintended consequences…
I currently use this approach with bluetooth, wifi (nmap) and GPS with zanzito (was using owntracks). If any source says I’m home, my status will indicate home. In order for my status to change to away, all sources must indicate that I am away. This seems to help avoid false triggers and has been working quite well for me.
I see all these examples with ‘value’ in quotes. I put the values in quotes but it keeps removing them. Here’s the automation I’ve got. It runs when triggered manually, so I know the triggers are the problem.
- id: '1527986882929'
alias: Front Light - Arrival
trigger:
entity_id: device_tracker.b4f7a1e3bdad
from: not_home
platform: state
to: home
entity_id: device_tracker.b4f1daefb5c7
from: not_home
platform: state
to: home
condition:
after: sunset
before: sunrise
condition: sun
action:
Any thoughts? If it’s the quotes, how do I get it to stop deleting them? I can do this easily with PLEG on the Vera, but I’m working towards using it for little more than the device radios…