rudders / homebridge-http

HTTP Plugin for Homebridge
Apache License 2.0
178 stars 110 forks source link

Update index.js #59

Closed MrsDelish closed 7 years ago

MrsDelish commented 7 years ago

Added support for Motion, it has a string http response for ON/Active it is now a easy way to turn on and off motion detection.

config.json { "accessory": "Http", "name": "Motion Status", "switchHandling": "yes", "http_method": "GET", "on_url": "http://localhost:8082/0/detection/start", "off_url": "http://localhost:8082/0/detection/pause", "status_url": "http://localhost:8082/0/detection/status", "service": "Switch", "brightnessHandling": "no", "brightness_url": "", "brightnesslvl_url": "", "sendimmediately": "", "username" : "", "password" : "" }

NovaGL commented 7 years ago

So basically this means if active then ACTIVE becomes 1?

MrsDelish commented 7 years ago

Yes, Thanks for a great plugin :-) cheers

Here is the output from my "status_url": "http://localhost:8082/0/detection/status http://localhost:8082/0/detection/status",

motion returns the following html when detection is running <!DOCTYPE html>

Motion 4.0.1 <– back

Camera 0 Detection status ACTIVE

And this when detection is paused <!DOCTYPE html>

Motion 4.0.1 <– back

Camera 0 Detection status PAUSE

On 9 Jan 2017, at 23:00, NovaGL notifications@github.com wrote:

So basically this means if active then ACTIVE becomes 1?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rudders/homebridge-http/pull/59#issuecomment-271421134, or mute the thread https://github.com/notifications/unsubscribe-auth/AXk3LvWoGnTy7htUDJK1Y1XColZYW000ks5rQq3hgaJpZM4LeL0O.

NovaGL commented 7 years ago

So have you done 0 for pause. Don't thank me I didn't make this, rudders did I'm just maintaining it

MrsDelish commented 7 years ago

A dedicated check for pause is not needed, I think. I can make one if you want. It will return 0 if it is not active since the html response will be handled by the original check.

home.app will update the switch status both ways if I either manually start or stop motion, or click the switch ofc.

NovaGL commented 7 years ago

I think this should be fine