Geofencing -- non-unique entity ID

So I’ve tried setting geo-fencing for my iphone and my house, with the purpose of automating the arming/disarming of my alarm and connection/disconnection to Nabu Casa Cloud service. I have HASS companion app installed on my iPhone, and I have joined Nabu Casa Cloud and it is enabled/connected in my iphone. I have location enabled in the iphone.

I’ve followed the instructions in this YouTube video to the letter
Geofencing Tutorial for Home Assistant –
https://www.youtube.com/watch?v=pjAyRN5UiBg but it seems the “proximity” integration, which has to be set up manually by editing the “configuration.yaml” file with the lines below, is not working at all.

image

When I go to list the entities I see that both my proximity.home, and zone.home entities are blocked, and “not-editable”, and so proximity.home is not delivering my location to the rest of the geofencing automation, and so the whole thing is not working. The problems seems to be the proximity.home integration and its non-ID…

when I click on either of the entities, and then click on the “gear icon” I see the message below:

image

I read the documentation that is pointed out, and the documentation pointed at within the first document, and I do not see how to fix things (links below)

I assume the good fellow in the video did get it working, so not sure why I am getting the error I am getting…

Any ideas or suggestions on what I may have missed or am doing wrong ? I am a beginner at this, and learning as I go…

Cheers

The “entity does not have a unique ID” is not a problem - it just means you can’t edit it in the UI, you have to edit it using the YAML. Originally all entities were edited with YAML, and slowly the devs are migrating this over to UI, which also introduced the concept of unique_id. Some entities like template sensors are in a half-way house - simple ones can be created through the UI, but more complex ones require YAML. I expect one day the Proximity sensor will be migrated to UI-only with no YAML. Until then you can’t edit it in the UI and it will display that “error”.

Anyway… Your proximity.home entity should have a numeric state of say 13, meaning you’re 13km away, and a “dir_of_travel” attribute like “stationary” or “away_from”. If it’s got these, I’d say it’s working.

1 Like

@michaelblight Thank you for the note ! I was away from home earlier this afternoon, and used my iphone and Nabu cloud to look into my HASS installation, and I recall seeing somethin that since the proximity.home did not have a unique ID it coudl not be used in my automation… I wish I could remember where I saw this, because now that I am home at my computer I cannot find it…

So when I got home I looked into every detail I could think of, and one thing I did change was my name. In proximity.home I only had “mark”, yet looking at the “People” records, I had also entered my last name, so I;ve changed that in the proximity.home integration to “mark_lastname”. Probably that was causing troubles ?

Just went into Developer Tools and looked at the current state of proximity.home and it states distance “0”, and state “arrived”, so maybe it is working now. I will test tomorrow when I cas drive away far enough.

While researching all this, I have found, in the automations > blueprints a blueprint called “zone notification” and set it up, and will also test it tomorrow. Perhaps I should be using the code in this blueprint for what I am trying to do with my alarm ?..

Anyways, I’ll report tomorrow… Thanks again for the comments !

@michaelblight

Just did an experiment by driving away from home and back; and have two different bits to report.

First, is my geofencing automation –
The proximity.home integration part of the automation “seems” to be working, as evidenced by the two screenshots I took off my iphone while stopped on the road, the one showing I was 3km away, and the other showing I was within the zone.home (0km away)zone. I had Nabu Casa Cloud connected so I could see everything in my HASS installation back at my home server. However I have a question about what these screeshots show – as stated at the bottom of each shot, they show that the state was “last changed” and “last updated” at the very time I went to the Developer Tools on my phone to look it up. Does this mean that otherwise proximity.home is not keepting track, unless I actually ask HASS to tall me what the state of proximity.home is ?


Regardless, none of the automations that were suposed to be triggered were triggered; like arming the alarm, connecting and disconencting from Nabu Casa, or sending my phone a notification that I had left or entered the zone.home.

So while the integration proximity.home may be indeed working, it is not being accessed by the rest of my automation (or vice-versa), which is here:

- id: '1701572359610'
  alias: Geofencing_Alarmo_HACloud
  description: ''
  trigger:
  - platform: numeric_state
    entity_id:
    - proximity.home
    above: 1
    id: leaving home
  - platform: numeric_state
    entity_id:
    - proximity.home
    below: 0.5
    id: nearing home
  condition: []
  action:
  - choose:
    - conditions:
      - condition: trigger
        id:
        - leaving home
      sequence:
      - service: alarm_control_panel.alarm_arm_away
        data: 
          code: '1234'
      - service: cloud.remote_connect
        data: {}
      - service: notify.mobile_app_iphone8
        data:
          message: Left zone.home
    - conditions:
      - condition: trigger
        id:
        - nearing home
      sequence:
      - service: alarm_control_panel.alarm_disarm
        data:
          code: '1234'
      - service: cloud.remote_disconnect
        data: {}
      - service: notify.mobile_app_iphone8
        data:
          message: Entered zone.home
  mode: single

I probably have something wrong, but I am not able to see it. Seems the automation is not cheking in with proximity.home…

Second bit is the notify_leaving_zone.yaml blueprint –
that was included in my HASS installation, and is aparetnly a core of HASS (as stated in its Github page) as given in the URL of the yaml file, see below.

This worked PERFECTLY, notifying my phone everytime I left the zone.home. I was thinking perhaps I could use the code in the blueprint to implement the geofencing I am trying above, but when opening the blueprint I fail to see how it is being done. For example there is no proximity.home entity… so I do not see how I can change it to meet the needs of the geofencing automation above… sorry, just a beginner at all this…

The blueprint is here

…found that I could look at the traces of the execution, and did find errors – with ID’s. Looks like the automation is indeed running, and talking to the proximity.home entity, and being triggered when the proximity.home exceeded the threshold, but then it stops due to ID issues…



I’ll see if I can figure out what the missing ID’s are – though am wondering if this is indeed because of th enon-unique ID’s for proximity.zone and zone.home that we started at top with…

SOLVED … has nothing to do with the non-unique IDs of zone.home or proximity.home.

The issue was missing choices in the actions part of the automation, before I had not chosen any area, device or entity for the alarm, since the alerm covered my whole house, and I assumed just calling the arming service would be enough – not so. new settings are below, though probably could have gotten away with just specifying the Alarmo CTL Panel entity, might try that.

…still not getting Nabu Casa to disconnect automatically from my iPhone when I am home, but wonder if that is because I am still in the 30-day trial period…