lagunacomputer / homebridge-MotionSensor

HomeBridge HomeKit Plugin for arduino based PIR motion sensors
23 stars 14 forks source link

Motion status not being pushed to HomeKit #5

Open rodhall opened 7 years ago

rodhall commented 7 years ago

This may be a HomeKit problem but the only way I can get HomeKit to check the state of the Motion sensor is to manually poll via the HomeKit or Home app. Otherwise, HomeKit just thinks that the state of the sensor is the same as when the sensor was last polled manually. Is there any way to have Homebridge regularly push the Motion state out to HomeKit?

lagunacomputer commented 7 years ago

yeah i don't think HB will push back to Homekit. I think it is Apple HomeKit that asks HB for info, at its own interval.

rodhall commented 7 years ago

Yes - but HomeKit doesn’t appear to be asking. The only way to get the motion state to update is to force HomeKit to ask manually.

Rod personal@rodhall.net

On Oct 30, 2017, at 6:27 PM, lagunacomputer notifications@github.com wrote:

yeah i don't think HB will push back to Homekit. I think it is Apple HomeKit that asks HB for info, at its own interval.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

lagunacomputer commented 7 years ago

that is probably best discussed in the HomeKit forum, indeed.

rodhall commented 7 years ago

OK - will do. Is it a known issue?

On Oct 31, 2017, at 7:43 AM, lagunacomputer notifications@github.com wrote:

that is probably best discussed in the HomeKit forum, indeed.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lagunacomputer/homebridge-MotionSensor/issues/5#issuecomment-340784258, or mute the thread https://github.com/notifications/unsubscribe-auth/ACY1ILvf3hubS1G9_68P4_OIyBkqasKXks5sxzIIgaJpZM4QL6iU.

rodhall commented 7 years ago

Can I ask if MotionSensor is working with your setup and Homekit currently? If so can you let me know what version of NodeJS you are running on and any other technical details that you think might be a problem in my setup. Otherwise, I think there is an open issue with the plugin since it doesn't seem to work with Homekit.

lagunacomputer commented 7 years ago

Sure I can verify this later today, it was working last time I tried it.

NorthernMan54 commented 7 years ago

@lagunacomputer This will send an update back to HomeKit, without waiting for an update or the user to open the home app

this.accessories[name].getService(Service.TemperatureSensor).getCharacteristic(Characteristic.MotionDetected).updateValue(value);

Where this.accessories[name] is your accessory, and the value is the current status of your motion sensor.

If you want to see that in context, take a look at this:

https://github.com/NorthernMan54/homebridge-wssensor

The code base is not ready for primetime yet, as I'm still tweaking it, but the motion sensor portion is rock solid.

rodhall commented 6 years ago

Is "name" the accessory name in the config.json or some other identifier?

TheDoudou commented 6 years ago

Same probleme here.

for homebridge -V : npm info using npm@5.3.0
npm info using node@v8.4.0
npm info ok
0.4.27

Config file :

{
            "accessory": "Motion",
            "name": "Alarme Sound",
            "url": "http://192.168.0.10/iot/webcam.php?motion=1",
            "http_method": "GET",
            "json_response": "value"
}

or add option "interval", i use this mod for sound detection (php script return json with boolean 0 or 1 if exceeds 50 db need more speed use it for baby phone 3/5 sec)

lagunacomputer commented 6 years ago

Hello, I cannot stress enough that I am not a programmer and probably have no idea how to fix this. I was lucky enough to cut and paste my way into a working first version. Please feel free to fix the code, and I will do my best to repackage the NPM.

Try the update_interval option.

@NorthernMan54 , line 154 of your plugin?

NorthernMan54 commented 6 years ago

@lagunacomputer This line in your plugin looks perfect

            this.motionService
               .getCharacteristic(Characteristic.MotionDetected).updateValue(value, null, "updateState");

If you run homebridge in debug mode, you should see the updated value being send back to HomeKit. If it works on WiFi but not when your remote, then your suffering from this issue. https://github.com/KhaosT/HAP-NodeJS/issues/418

TheDoudou commented 6 years ago

Sorry it's ok just bad folder with docker.

sorriso93 commented 6 years ago

Save behaviour here; I get the sensor update in homekit only if I close and reopen the home app. Anyone solved the problem?

phenotypic commented 6 years ago

It seems that the version of the plugin installed by npm is not the same as the one in this repository. For me, I used the following command to install the repository directly from the GitHub page and now it works perfectly:

sudo npm install -g git+https://github.com/lagunacomputer/homebridge-MotionSensor.git

If you still receive permission errors after using sudo (usually on Raspberry Pis), run sudo -i to enter root shell then run the command above again.

Hope this helps!

lagunacomputer commented 5 years ago

so this is a bit out of my programming league but recently i tried this one https://github.com/washcroft/HttpGarageDoorController and it works perfectly for pushing notifications.

I suppose someone smarter than I could hack it up and make a motion sensor w/ push notifications plugin with it