PeteLawrence / homebridge-people

204 stars 52 forks source link

Have sensors only defined by HTTP GET (no Ping) #57

Open gilesmartin opened 7 years ago

gilesmartin commented 7 years ago

I currently have two sensors that are receiving HTTP GET commands from IFTTT maker. The devices don't actually exist for ping requests so I have just set this to an arbitrary value. It would be great to be able to set a sensor based only on HTTP requests and not have the system attempting to ping but this does not appear to be possible.

Here is what I am currently doing (integrating blink with HomeKit): https://t.co/vo1wN1mFgM

gilesmartin commented 7 years ago

I am also seeing an issue with how i have this set up right now. It seems that people is not treating webhooks the same as pings (at least thats my guess). The webhook to activate the sensor works but the sensor never resets to go back to its default state after the timeout (5 minutes in my case). I last sent the trigger 30 minutes ago and the sensor is still showing occupied.

benzman81 commented 7 years ago

@gilesmartin: setting ping interval to -1 will deaktivate ping. This way only the webhooks change the state.

gilesmartin commented 7 years ago

But I also have some regular devices for people that I am using as well. If that weren't a global setting it would work perfectly.

benzman81 commented 7 years ago

@gilesmartin: yes, you are right. A webhook sets a new state "forever". The only way to change it back is to call the webhook with the opposite state or the wifi recognizes a different state. Thats the use case for occupancy. Its not a motion sensor that switches back to "no motion" after a while.

benzman81 commented 7 years ago

@gilesmartin: its not only global, you cannoverwrite it per person/device ;-)

benzman81 commented 7 years ago

See configuration in the readme for example.

gilesmartin commented 7 years ago

Is it possible to modify that behavior? I can imagine it would generally be expected for the webhooks to act similarly to the ping requests

gilesmartin commented 7 years ago

@benzman81 my bad. I see that it's per device now. Trying with pinginterval "-1" now

gilesmartin commented 7 years ago

Even with that pinginterval at -1 it never goes back. Just stays permanently set to triggered.

benzman81 commented 7 years ago

Why should it? If my webhook aktivates that I am at home, why should it ever switch back unless an action occurs that tells the system I am away. If I am sick and dont leave my house for a week it shouldnt switch back, as I am still home. The ping is a different case as it is used as additional hint to guess if I am still at home or not. Webhook calls via a location service are more accurate. This is all about occupancy and I see no use case for a change, altough I am not the author of the plugin. If you want a motion sensor like stated in your blog post, this is not the right plugin to use. You might try my plugin https://www.npmjs.com/package/homebridge-http-webhooks that only works with webhooks and supports motion sensors, but iI dont know how apple homekit it handles if you dont call a webhook to signal "no motion". Maybe it switches back automatically, my zwave system does. But if it signals no motion, than I call the webhook, too.

gilesmartin commented 7 years ago

http-webhooks has the same issue. It is only triggered by an on event and stays on until triggered with an off event. This really isn't how occupancy sensors work anyway. Most occupancy sensors will trigger on when they detect presence and stay on as long as they continue to detect presence. They will default back to no presence after a pre-defined amount of time. This is how your plugin works in ping mode but not how it works in webhook mode.

I understand the personal use case above and that makes sense. Would't it make sense to add this as an option though?

benzman81 commented 7 years ago

Just came across this plugin, maybe it helps. https://www.npmjs.com/package/homebridge-camera-motion

gilesmartin commented 7 years ago

nope, the blink cameras use a dynamic stream so it can't be captured through normal methods as required by that plugin. only way to get motion alerts is to hook into that something that can be triggered by IFTTT (like maker)