Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using only Geofencing & iBeacons #31

Closed
nitaybz opened this issue Dec 18, 2016 · 17 comments
Closed

Using only Geofencing & iBeacons #31

nitaybz opened this issue Dec 18, 2016 · 17 comments

Comments

@nitaybz
Copy link

nitaybz commented Dec 18, 2016

Hi,
I wanted to know if it's possible to use only geofencing and iBeacons to change the status of the sensor.
since my wife is not always connected to wifi, it's quite hard to automate actions for her or for "anyOne/noOne".
If i'll use some location or beacon app on her phone I will be able to automate everything for her more accurately.
anyway, I feel like it would be more accurate if only the arrival and departure will be monitored.

Think about it...
Thanks.

@erfind
Copy link

erfind commented Dec 21, 2016

I agree, this may reduce some of the errors we are experiencing with users not being released from occupancy.

@nitaybz
Copy link
Author

nitaybz commented Dec 21, 2016

I solved it by forking this plugin to a new and similar plugin that use geofence or iBeacon only. not considering any connection to wifi.
homebridge-people-geofence

@benzman81
Copy link
Contributor

Just a side note. I don't know if only using beacons or geolocation is a good thing to do. In my experience all beacon apps are not that reliable that you can just depend on that (maybe due to apple and ist beacon implementation). I pretty often don't get an event if I leave my home or arrive there. So the ping in the Network is definetly a good addon tu use ;-)

@nitaybz
Copy link
Author

nitaybz commented Dec 21, 2016

i use IFTTT app for geo location function and the Maker channel to send the HTTP request.
works like a charm

@benzman81
Copy link
Contributor

Will be fixed with pull request "Major Rework #35". You can set the new configuration parameter "pingInterval" to -1 if you dont want to use the ping. But again, it is a good fallback in case you iPhone turns off due to low battery or the webhook is just not being called, maybe due to missing network connection.

@nitaybz
Copy link
Author

nitaybz commented Dec 22, 2016

I'm not sure if I understand how it will work.
let's say I use 15 min threshold, when I leave the house if my IFTTT app pushes a request to notify I'm out, even if the ping stops for 15 min the last time I was synced will still show I'm home for the same amount of time and will not make any automation happen immediately, cause "isTargetActive" will always look for the current time minus threshold.

Also in that case, what happen if I enter the house without WiFi turned on on my device and it's been more than 15 minutes since the webhook received "status=true"? will it show I'm not at home again?

One last case i'm interested to know how it work is when I use "pinginterval: -1" like you said, what happen with the threshold? will it still calculate the last time I logged? cause the ping is off so it shouldn't change the status of the sensor until it gets a webhook, right?

Basically what would be perfect to happen is if it would save the last data received and react accordingly. for example:
If I entered the house with the WiFi off, and a webhook is received, it won't change the status until another webhook change it, unless I turn on the wifi while I'm in the house. if during any time the ping could spot the iPhone on wifi, only than, a wifi disconnection will trigger "Away" status.

that way I think it would be more accurate and create a fallback if the wifi is off.
and people who always have wifi on will not be affected by this change.

Let me know your thoughts,

Thanks.

@benzman81
Copy link
Contributor

let's say I use 15 min threshold, when I leave the house if my IFTTT app pushes a request to notify I'm out, even if the ping stops for 15 min the last time I was synced will still show I'm home for the same amount of time and will not make any automation happen immediately, cause "isTargetActive" will always look for the current time minus threshold.

The last ping time is stored, thats right. But isTargetActive will return false as the threshold already exceeded and you cannot be pinged.

Also in that case, what happen if I enter the house without WiFi turned on on my device and it's been more than 15 minutes since the webhook received "status=true"? will it show I'm not at home again?

If you come home and have your Wifi turned off and you won't turn it on within the threashold you will be marked as Away. If this is a common case, you should deactivate the ping mechanism (see below).

One last case i'm interested to know how it work is when I use "pinginterval: -1" like you said, what happen with the threshold? will it still calculate the last time I logged? cause the ping is off so it shouldn't change the status of the sensor until it gets a webhook, right?

Using the Option "pinginterval: -1" will completly turn of the ping. That means, that only Webhooks will Trigger state changes.

Basically what would be perfect to happen is if it would save the last data received and react accordingly. for example:
If I entered the house with the WiFi off, and a webhook is received, it won't change the status until another webhook change it, unless I turn on the wifi while I'm in the house. if during any time the ping could spot the iPhone on wifi, only than, a wifi disconnection will trigger "Away" status.

This could be a good Addition to handle the wifi off case. Actually I have not thought about turning Wifi of :-)) I write it on my list and hope @PeteLawrence merges my outstanding merge regest.

@JonSilver
Copy link

since my wife is not always connected to wifi, it's quite hard to automate actions for her or for "anyOne/noOne".

Just as an aside, I wanted something to detect presence more passively, even when someone wasn't connected to the network. I also wanted things to happen more quickly than 15-20 mins, and with fewer false positives. This would cope with occasional visitors. This is a tricky combination of requirements. So I started using a combination of nmap scanning for MAC addresses to capture wifi clients, and an ESP8266 unit in promiscuous mode to sniff packets from every wifi client in the area, with RSSI for proximity. It turns out that using a combination of these two methods, I can detect everyone I need to detect - me, my wife, my son occasionally back from university, my younger son who's here a few times a week, our house sitter, friends who come to stay... and nobody is left sitting in the dark with the heating off wondering what kind of an automation nightmare they've walked into. My heating isn't turned on by pets (thanks, Nest). Everyone's happy.

@nitaybz
Copy link
Author

nitaybz commented Dec 23, 2016

what you describe sounds really good... though I have no idea how to accomplish that, or even how to begin connecting that to my homekit.
if there was a plugin that does it I would be the first to try!

@benzman81
Copy link
Contributor

@nitaybz Now, webhooks are never outdated. A ping only triggers a change if at least one time a successful ping was done after a webhook was called. This should solve the "wifi not activated" scenario.

@nitaybz
Copy link
Author

nitaybz commented Dec 25, 2016

man... you rock!
Thanks...

I think 'people' plugin just became a very powerful tool. I can tell you that it's working perfectly with IFTTT app geolocation feature and now I can really tel who is at home and react accordingly.

@nitaybz
Copy link
Author

nitaybz commented Dec 25, 2016

@benzman81 I think there is some kind of problem there since lastSuccessfulPing_(user) shows that both me and my wife were detect on the wifi but it didn't seem to trigger a change and I see No One as triggered.
that happened after restarting homebridge after installing your last update. just to mentioned that our status was triggered for both of our sensor before the restart.

UPDATE: on second restart it did update our status. seems to work now.

@benzman81
Copy link
Contributor

@nitaybz I double check the code just to make sure there isn't a bug.

@benzman81
Copy link
Contributor

@nitaybz should work now, there was an issue that prevented a state change if a webhook was never called. This must have been the issue as the key changed that saved the webhook state.

@nitaybz
Copy link
Author

nitaybz commented Dec 26, 2016

@benzman81 I also noticed a problem today when I left the house and the webhook was not received due to IFTTT app problem, the problem is that your plugin did not change the state when I logged out from the WiFi (after threshold of 15 min) though It was connected before leaving the house and a successful ping was noted , something prevented it from triggering a change.
do you think your last update will fix it as well?

@benzman81
Copy link
Contributor

@nitaybz sounds pretty much like it will fix this, too.

@PeteLawrence
Copy link
Owner

This should now be fixed in v0.5, thanks to @benzman81.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants