Philips Hue "Home and Away" geofence sensor in Domoticz?

Others (MiLight, Hue, Toon etc...)

Moderator: leecollings

Post Reply
User avatar
Domoberry
Posts: 116
Joined: Tuesday 30 May 2017 19:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Contact:

Philips Hue "Home and Away" geofence sensor in Domoticz?

Post by Domoberry »

Hi Forum,
The Hue platform supports geofencing: "Home and Away". You can use it to trigger scenes. In the Hue app, you can see the events created by the virtual geofencing 'sensors'; one sensor per mobile device participating in the Home and Away routine. See in the Hue App: Explore / Hue Labs / Settings / information on your bridge / Manage resources / Geofence users.
Is it possible to use these sensor events in Domoticz?
I dare to ask since the Hue Motion sensor, when activated in Domoticz, shows up as Switch, so you can use it in scripting. So why not the (software) geofence sensor?
I tried the "allow new devices for 5 mins /disable Hue hardware / wait few mins / reenable Hue hardware" sequence to see if a new sensor would show up, but did not see a new one. Nevertheless, it could be I took a wrong turn somewhere.
Any experience?
The obvious alternative is to use one of the other geofencing mechanisms working with Domoticz.
Using Domiticz beta releases and iPhone mobile devices.
Last edited by Domoberry on Sunday 10 February 2019 14:15, edited 1 time in total.
joostnl
Posts: 68
Joined: Wednesday 03 February 2016 19:22
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Philips Hue "Home and Away" geofence sensor in Domoticz?

Post by joostnl »

+1 wanna use this idea
User avatar
Domoberry
Posts: 116
Joined: Tuesday 30 May 2017 19:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Contact:

Re: Philips Hue "Home and Away" geofence sensor in Domoticz?

Post by Domoberry »

Technically this seems possible. Following some hints in https://community.openhab.org/t/use-iph ... cing/43724 and taking my first few and careful steps using the Hue CLIP API debugger (see https://developers.meethue.com/develop/get-started-2/), I noted that indeed a GET on

Code: Select all

https://<bridge_IP>/api/<username>/sensors
gives a long list of all sensors in your Hue system. You will come across any motion sensor (type: 'ZLLPresence') you might have and... you will also see sensors of type 'Geofence'. A dedicated GET on such a sensor tells you if the related phone is present on not.
Next is obviously the real stuff: get this into Domoticz such that you can read the status and have a change in status trigger a script. It does look similar to the already supported motion sensors. but, probably, the devil is in the details, and this is where the experts come in ;)
limar
Posts: 6
Joined: Thursday 31 January 2019 21:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Philips Hue "Home and Away" geofence sensor in Domoticz?

Post by limar »

Guess Domoberry is on the right track. Just do GET requests to the respective geofence sensors as stated by Domoberry. One before and one after the geofence was triggered using hue itself. After that I would create a dummy switch and update that one in the same manner as done in the below url for lights and groups, but then specifically for that one sensor:
viewtopic.php?f=56&p=205493

Details can all be found here on the hue bridge api:
https://developers.meethue.com/
JesseKlaasse
Posts: 2
Joined: Tuesday 28 April 2015 13:29
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Philips Hue "Home and Away" geofence sensor in Domoticz?

Post by JesseKlaasse »

Just wanted to let you know that, based on this idea, I have added some code to enable detection of the Geofence Hue 'sensors' in Domoticz. They will be detected as motion sensors. The good news is that gizmocuz has approved by pull request, and the code will appear starting with beta version 11074.
User avatar
Domoberry
Posts: 116
Joined: Tuesday 30 May 2017 19:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Contact:

Re: Philips Hue "Home and Away" geofence sensor in Domoticz?

Post by Domoberry »

Well done!
I’m of the beta track at the moment until I pick up somewhere that ZWave is ‘Beta+’ but tempted to go beta sooner 8-)
Eager to give this new ‘sensor’ a go!
User avatar
Domoberry
Posts: 116
Joined: Tuesday 30 May 2017 19:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Contact:

Re: Philips Hue "Home and Away" geofence sensor in Domoticz?

Post by Domoberry »

Just to confirm and a 'thank you!'
If you upgrade to stable Domoticz 2020 and check for Hue, you will notice a new Motion sensor of type Light/Switch subtype Switch called "Geofence <phone name>". You can have multiple Hue geofence users.
I had to fiddle a bit in the Hue app to activate the Home and Away routine, without actually doing anything (I want Domoticz to handle), but with that done, the 'sensor' works fine.
Just for the record, in the Hue app, go to Explore -> Hue Labs -> Settings -> [tab the (i) after the bridge concerned] -> Manage resources -> Geofence users to see the actual geofence users on this bridge.
User avatar
Domoberry
Posts: 116
Joined: Tuesday 30 May 2017 19:00
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Contact:

Re: Philips Hue "Home and Away" geofence sensor in Domoticz?

Post by Domoberry »

Hi All,
It seems this Hue Home and Away GeoFencing option, using a specific interface found on the Hue API, does not work anymore. I noted my 'GeoFence' Domoticz device originating from Hue had not been updated since August '21.
Not sure what has changed, but my guess is that something changed on Hue side causing this to fail.
Clearly, someone more familiar with the Hue API could dive in a level deeper on this.
In the meantime, using the following work-around:
- use Hue Home and Away in the Hue app as per normal
- assign a light in a room to be controlled by Home and Away
- use the status of this light in Domoticz, where it appears as a device like any other Hue device obviously
- and ... it seems you can also disconnect the device (e.g. unplug it such that it becomes 'unreachable') while it maintains the same functionality in Domoticz. You 'sort of' created a 'virtual' Hue device. I'm checking to see if this holds for a longer period.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest