Cheap iBeacon

Could you post your ha configs?
It could be very useful… :slight_smile:

Thanks!

Sure.

  1. First I created a home zone in my config:
zone:
  - name: 'Home'
    latitude: !secret home_lat
    longitude: !secret home_long
    radius: 3

  1. Then in customize.yaml I put the details of the beacon (the uuid will depend on your beacon):
zone.home:
  track_ios: true
  beacon: 
    uuid: 123456789-1234-1234-1234-1234567891234
    major: 0
    minor: 0
  1. Then to change the status from not_home to home I came up with this:
  • 3a. I selected the phone as device tracker for my “person”

  • 3b. I then created the following python script that changes the status of the device tracker that gets called in the automations in step 3c:

entity_id = data.get('entity_id')
if not entity_id:
    logger.error('No entity_id provided')
state = data.get('state')
if not state:
    logger.error('No state provided')
hass.states.set(entity_id, state)
  • 3c. Lastly I created the following automations that get called by the Pushcut app (through Webhooks) when the beacon is detected:
- alias: Set Away Status
  description: ''
  trigger:
  - platform: webhook
    webhook_id: set_away_status
  condition: []
  action:
  - choose:
    - conditions:
      - condition: state
        entity_id: person.you
        state: home
      sequence:
      - data:
          entity_id: device_tracker.your_iphone
          state: not_home
        service: python_script.set_state
  mode: single
- alias: Set Home Status
  description: ''
  trigger:
  - platform: webhook
    webhook_id: set_home_status
  condition: []
  action:
  - data:
      entity_id: device_tracker.your_iphone
      state: home
    service: python_script.set_state
  mode: single

So in summary here’s what happens:

  1. Beacon is within/out of range, Pushcat detects it and calls relevant webhook
  2. Automations set device tracker status to either home/not_home

Then you can use the change of status as a trigger for an automation of your choice.