To/From Zone Automation

I’ve attempted to create an automation that will send a push notification if there is mail in my mailbox when I get near my house only from away->near home, not just when I leave or arrive. That way my car will read it out over the speakers. Simply using arrive ‘home’ doesn’t work as this can be delayed by a couple of minutes due to the update rate.

Using this:

- id: mail_near_home_notification
  alias: 'Notification - Mail Near Home'
  trigger:
    - platform: state
      entity_id: device_tracker.nick
      from: 'not_home'
      to: 'near_home'
#  condition:
#    - condition: state
#      entity_id: binary_sensor.mail_in_mailbox
#      state: 'on'
  action:
    - service: script.send_push_message
      data:
        message: 'There is mail that needs to be collected.'

When there is mail, it doesn’t fire, so I disabled the condition and still no go. Looking at the logbook, it looks like the device tracker is not actually registering entering the zone, although the webpage does show it.

This is all logbook shows, no near_home shown:
3:01 PM
Nick is at home
12:35 PM
Nick is away
1:04 AM
Nick is at home

These are my zones:

zone 1:
  name: Home
  latitude: xxx
  longitude: yyy
  radius: 100
  icon: mdi:home
  passive: false
zone 5:
  name: Near Home
  latitude: xxx
  longitude: yyy
  radius: 3000
  icon: mdi:home
  passive: true

Zone passive or not, didnt fire.

Any tips, not a lot of detail on this in the help doco.

Bump, no one else done arrive near home automations?

What kind of device tracker do you use?
I’ve never seen a near_home state on device tracker :slight_smile:

Take a look at the proximity component, maybe there’s something there to help you?

No, near_home is not a state on the device_tracker, it’s a zone I created. It sits on to of the ‘home’ zone, but is 3000m in radius.

When I look at my device tracker, it shows me transition through this zone as I arrive home. But the logbook as above, does not seem to record it, just away and home.

Looks like proximity might be more what I was after, I’ll have a look at it.

Ah, got it.

Yeah take a look at proximity, looks like it provides exactly the tools you ll need

@callifo How do you detect if you have mail in your mailbox?
I had seen this blog post a while back, and I really like the idea, but unfortunately, I am afraid that I don’t have the skills required to build one.

I used this as a guide, and made a few changes

I use a tilt sensor instead of vibration sensor, as it didn’t seem to work reliably. I’ve also added a battery voltage sensor so I can see how charged it is.

I can post my modified code if you are interested.

I am currently still playing around with the solar charge side of it, as my ebay ‘2W’ panel doesnt seem to be recharging enough during the day to keep it running infinitely.

@callifo … Thanks for your reply, but this seems to be over my head still.
I will need to start learning / experimenting though as I don’t think that there is nothing commercially that will work reliably.