rthewhite / homebridge-homewizard

23 stars 13 forks source link

Doorbell support #50

Open basvdploeg opened 7 years ago

basvdploeg commented 7 years ago

I would like to know if it's possible to add doorbell support into the plugin. Since the last big iOS update HomeKit supports doorbells to send push notifications (with pictures if a camera is available in the same room).

Since the HomeWizard can't really "push" new states I thought it might be possible to use a virtual switch in the HomeWizard app to push a (UDP / HTTP?) message to Homebridge. I saw that @ygageot came up with a similar idea here:

https://github.com/rthewhite/homebridge-homewizard/issues/5#issuecomment-208820047

There are a couple of doorbell plugins already, but none of them can be triggered with a message like that. See for example this one:

https://github.com/Samfox2/homebridge-doorbell

The doorbell in that demo plugin is triggered by the "identity" button in the Home app. Instead of using the identify button it would be great if it could be triggered by the HomeWizard virtual switch. This way you should get an instant push notification when the doorbell is pressed.

Am I right about this and is there a (simple) way to add this support? I would be a unique feature since I could not find a similar project.

ygageot commented 7 years ago

You can probably connect your doorbell to HW and have notifications without HomeKit. In my configuration I have a motion sensor in my letterbox and I receive directly notifications from my HW in iPhone, Apple Watch and Android. The transmission delay is short and it is confortable... Unhappily I have no doorbell button to configure. In the HW app you can configure a doorbell. If you have one and want to interface it with the plugin, try first to configure the button with notifications (task menu) in HW app. If it works, give me the info and I will have next week so time to look at it.

basvdploeg commented 7 years ago

The doorbell is indeed connected to my HW already. It sends notifications trough the HomeWizard app, but unfortunately that's not with the cool HomeKit interface. When the button is placed in a room with a HomeKit connected camera (which I have), it displays a picture or/and live stream when the doorbell is pressed:

17336-14748-ios10-homekit-l

rthewhite commented 7 years ago

The big problem is the pushing of changes to HomeKit. Currently i don't have much free time to look into it and see if i can find a solution. The other problem is that i don't have a HomeWizard anymore which makes testing this etc a lot harder.

basvdploeg commented 7 years ago

Currently I use a virtual switch in the HomeWizard app to request a php page on my NAS, which sends messages to Telegram and Twitter. If there was a way to do something similar to the Homebridge plugin.

It doesn't necessarily need an HomeWizard if there is a URL which can be requested to replicate a button press.

For example:

Doorbell pressed > HomeWizard receives signal > HomeWizard reacts by requesting a specified url in Homebridge (plugin) > HomeKit sees the request as a button press and sends push notification

ygageot commented 7 years ago

If I understood, you have actually a HomeKit camera, a doorbell button not supported by HomeKit but connected to HW app and via your NAS to notifications systems. You want to "view" your HW doorbell like a HomeKit compatible doorbell via the plugin and have the possibility to connect camera and doorbell in Home app.

basvdploeg commented 7 years ago

That's right. HomeKit "connects" doorbell and camera automatically when they are placed in the same room, if I'm right. This is also confirmed in the README of the homebridge-doorbell plugin: https://github.com/Samfox2/homebridge-doorbell

rthewhite commented 7 years ago

I think I found a way to push changes to HomeKit which I described here: https://github.com/rthewhite/homebridge-homewizard/issues/5#issuecomment-208820047 When that's implemented it shouldn't be to difficult to implement the doorbell.

ygageot commented 7 years ago

@basvdploeg I worked a bit tonight on the global update problem and it works for me. Unhappily I have no doorbell button.

In a first step I can add in the plugin the support for this button. Can you execute the 2 http commands

basvdploeg commented 7 years ago

@ygageot The doorbell part in get-sensors (listed under "kakusensors"; id 3):

"scenes":[ { "id":0, "name":"Hue Lampen", "favorite":"no" } ], "kakusensors":[ { "id":0, "name":"Brievenbus", "status":"no", "type":"contact", "favorite":"no", "timestamp":"06:46", "cameraid":0 }, { "id":1, "name":"Rookmelder", "status":null, "type":"smoke", "favorite":"no", "timestamp":"00:00", "cameraid":null }, { "id":2, "name":"Bewegingsmelder", "status":null, "type":"motion", "favorite":"no", "timestamp":"00:00", "cameraid":null }, { "id":3, "name":"Deurbel", "status":"no", "type":"doorbell", "favorite":"no", "timestamp":"22:24", "cameraid":0 } ],

And get-status (also listed under "kakusensors"; id 3):

"kakusensors":[ { "id":0, "status":"no", "timestamp":"06:46" }, { "id":1, "status":null, "timestamp":"00:00" }, { "id":2, "status":null, "timestamp":"00:00" }, { "id":3, "status":"no", "timestamp":"22:24" } ]

ygageot commented 7 years ago

@basvdploeg I just pulled a new version with doorbell support and push mode necessary. I have no true doorbell button also I took a contact sensor and defined it as a doorbell in HW app. The main difference is that there is no 2 states open/close but an event. I know well the Chacon doorbell button because I implement it in my own system for a secondary house and I remember that when you press the button 2 identical event are fired. In the new version you will need to

With my tests, the Home app light the doorbell accessory and emit a notification

You have a motion-sensor also try the same.

When the new version will be on line, please test it with your doorbell and say me if you can join it with your HomeKit camera.

basvdploeg commented 7 years ago

@ygageot Awesome! When it gets released I'll try it right away! This seems to be the perfect solution.

rthewhite commented 7 years ago

Just released the new version: 0.0.53 👍 Thanks for all the work @ygageot!

ygageot commented 7 years ago

Try to insert pushServer": {"http": xxxx, period:1} in your config file.

The plugin in will refresh all the accessories every 1 minute, it is very confortable.

basvdploeg commented 7 years ago

Unfortunately I'm running into this error:

Jan 11 21:23:10 RaspberryPi systemd[1]: Starting Node.js HomeKit Server... Jan 11 21:23:10 RaspberryPi systemd[1]: Started Node.js HomeKit Server. Jan 11 21:23:10 RaspberryPi homebridge[1276]: WARNING The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi. Jan 11 21:23:10 RaspberryPi nodejs[1276]: WARNING The program 'nodejs' uses the Apple Bonjour compatibility layer of Avahi. Jan 11 21:23:10 RaspberryPi nodejs[1276]: WARNING Please fix your application to use the native API of Avahi! Jan 11 21:23:10 RaspberryPi nodejs[1276]: WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs Jan 11 21:23:10 RaspberryPi nodejs[1276]: WARNING The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour c Jan 11 21:23:10 RaspberryPi nodejs[1276]: WARNING Please fix your application to use the native API of Avahi! Jan 11 21:23:10 RaspberryPi nodejs[1276]: WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister Jan 11 21:23:10 RaspberryPi homebridge[1276]: WARNING Please fix your application to use the native API of Avahi! Jan 11 21:23:10 RaspberryPi homebridge[1276]: WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs Jan 11 21:23:10 RaspberryPi homebridge[1276]: WARNING The program 'nodejs' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjo Jan 11 21:23:10 RaspberryPi homebridge[1276]: WARNING Please fix your application to use the native API of Avahi! Jan 11 21:23:10 RaspberryPi homebridge[1276]: WARNING For more information see http://0pointer.de/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister Jan 11 21:23:11 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:11 PM] Loaded plugin: homebridge-camera-ffmpeg Jan 11 21:23:11 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:11 PM] Registering platform 'homebridge-camera-ffmpeg.Camera-ffmpeg' Jan 11 21:23:11 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:11 PM] --- Jan 11 21:23:11 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:11 PM] ==================== Jan 11 21:23:11 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:11 PM] ERROR LOADING PLUGIN homebridge-homewizard: Jan 11 21:23:11 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:11 PM] Error: Cannot find module '/usr/lib/node_modules/homebridge-homewizard/dist/plugin.js' Jan 11 21:23:11 RaspberryPi homebridge[1276]: at Function.Module._resolveFilename (module.js:455:15) Jan 11 21:23:11 RaspberryPi homebridge[1276]: at Function.Module._load (module.js:403:25) Jan 11 21:23:11 RaspberryPi homebridge[1276]: at Module.require (module.js:483:17) Jan 11 21:23:11 RaspberryPi homebridge[1276]: at require (internal/module.js:20:19) Jan 11 21:23:11 RaspberryPi homebridge[1276]: at Plugin.load (/usr/lib/node_modules/homebridge/lib/plugin.js:65:22) Jan 11 21:23:11 RaspberryPi homebridge[1276]: at Server. (/usr/lib/node_modules/homebridge/lib/server.js:129:14) Jan 11 21:23:11 RaspberryPi homebridge[1276]: at Array.forEach (native) Jan 11 21:23:11 RaspberryPi homebridge[1276]: at Server._loadPlugins (/usr/lib/node_modules/homebridge/lib/server.js:125:22) Jan 11 21:23:11 RaspberryPi homebridge[1276]: at new Server (/usr/lib/node_modules/homebridge/lib/server.js:48:24) Jan 11 21:23:11 RaspberryPi homebridge[1276]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:26:16) Jan 11 21:23:11 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:11 PM] ==================== Jan 11 21:23:12 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:12 PM] Loaded plugin: homebridge-nest Jan 11 21:23:12 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:12 PM] Registering platform 'homebridge-nest.Nest' Jan 11 21:23:12 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:12 PM] --- Jan 11 21:23:13 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:13 PM] Loaded plugin: homebridge-sense Jan 11 21:23:13 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:13 PM] Registering accessory 'homebridge-sense.Sense' Jan 11 21:23:13 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:13 PM] --- Jan 11 21:23:13 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:13 PM] Loaded config.json with 1 accessories and 3 platforms. Jan 11 21:23:13 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:13 PM] --- Jan 11 21:23:13 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:13 PM] Loading 3 platforms... Jan 11 21:23:13 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:13 PM] Initializing Nest platform... Jan 11 21:23:13 RaspberryPi homebridge[1276]: [1/11/2017, 9:23:13 PM] Fetching Nest devices. Jan 11 21:23:13 RaspberryPi homebridge[1276]: /usr/lib/node_modules/homebridge/lib/api.js:118 Jan 11 21:23:13 RaspberryPi homebridge[1276]: throw new Error("The requested platform '" + name + "' was not registered by any plugin."); Jan 11 21:23:13 RaspberryPi homebridge[1276]: ^ Jan 11 21:23:13 RaspberryPi homebridge[1276]: Error: The requested platform 'HomeWizard' was not registered by any plugin. Jan 11 21:23:13 RaspberryPi homebridge[1276]: at API.platform (/usr/lib/node_modules/homebridge/lib/api.js:118:13) Jan 11 21:23:13 RaspberryPi homebridge[1276]: at Server._loadPlatforms (/usr/lib/node_modules/homebridge/lib/server.js:281:45) Jan 11 21:23:13 RaspberryPi homebridge[1276]: at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:77:36) Jan 11 21:23:13 RaspberryPi homebridge[1276]: at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:40:10) Jan 11 21:23:13 RaspberryPi homebridge[1276]: at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22) Jan 11 21:23:13 RaspberryPi homebridge[1276]: at Module._compile (module.js:556:32) Jan 11 21:23:13 RaspberryPi homebridge[1276]: at Object.Module._extensions..js (module.js:565:10) Jan 11 21:23:13 RaspberryPi homebridge[1276]: at Module.load (module.js:473:32) Jan 11 21:23:13 RaspberryPi homebridge[1276]: at tryModuleLoad (module.js:432:12) Jan 11 21:23:13 RaspberryPi homebridge[1276]: at Function.Module._load (module.js:424:3) Jan 11 21:23:13 RaspberryPi homebridge[1276]: at Module.runMain (module.js:590:10) Jan 11 21:23:13 RaspberryPi homebridge[1276]: at run (bootstrap_node.js:394:7) Jan 11 21:23:13 RaspberryPi homebridge[1276]: at startup (bootstrap_node.js:149:9) Jan 11 21:23:13 RaspberryPi homebridge[1276]: at bootstrap_node.js:509:3 Jan 11 21:23:13 RaspberryPi systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE Jan 11 21:23:13 RaspberryPi systemd[1]: Unit homebridge.service entered failed state. Jan 11 21:23:23 RaspberryPi systemd[1]: homebridge.service holdoff time over, scheduling restart. Jan 11 21:23:23 RaspberryPi systemd[1]: Stopping Node.js HomeKit Server...

AlainBijl commented 7 years ago

Just updated the plugin (sudo npm -g update homebridge-homewizard) and get the same error as Bas.

rthewhite commented 7 years ago

Ah my mistake hold on, releasing a new version...

rthewhite commented 7 years ago

Try version 0.0.54, sorry for the mistake.

basvdploeg commented 7 years ago

I'm trying to update to 0.0.54 using sudo npm update homebridge-homewizard -g but there is no update available.

rthewhite commented 7 years ago

Try running sudo npm install homebridge-homewizard@0.0.54 -g

basvdploeg commented 7 years ago

Installing worked fine this time.

I tried to request the http link using my browser and it shows me an Done message, so the server seems to listen fine. Unfortunately there is no push notification to be seen. @ygageot Is there something I can test to force the push notification?

ygageot commented 7 years ago

in my configuration on MacOS Sierra, I have node v7.4.0 , homebridge@0.4.16 and homebridge-homewizard@0.0.54 obtained from GitHub. No problem

ygageot commented 7 years ago

@basvdploeg Well you tried with your browser, Done is the good answer , the http server is listening.

If you look at the plugin log you will find something like [2017-1-11 22:08:56] Http request from : ::ffff:192.168.1.48 GET / [2017-1-11 22:08:56] Retrieved currentPosition WindowCovering for: Volet cuisine is:100 [2017-1-11 22:08:56] Retrieved positionState WindowCovering for: Volet cuisine is:2 ... You will read first the address of you browser host and a long list of Retrieved attributes withe current HW values

ygageot commented 7 years ago

In Home app, I use on the accessory "Autorize notifications"

basvdploeg commented 7 years ago

Okay, I'm getting closer. When I use the contact sensor it does work and sends the push notification. Unfortunately that's not the case with the doorbell.

The Home app shows the doorbell as a "not supported" accessory. I'm guessing it has to do with this: https://github.com/Samfox2/homebridge-doorbell/issues/1

Strangely enough I did put the doorbell in the same HomeKit room as the HomeKit camera, but it doesn't send notifications. Probably the fault of HomeKit then...

Also interesting: https://github.com/Samfox2/homebridge-doorbell/issues/3 https://github.com/nfarina/homebridge/issues/506

ygageot commented 7 years ago

@basvdploeg During the development I had no problem with this new accessory. Yesterday evening, my version was pulled and merged on GITHUB. After I updated my directory and made a "grunt build". Just after I discovered as you did that it was not supported in HomeKit app... I will have a look

ygageot commented 7 years ago

@basvdploeg I made some checking and I don't see a version problem with homebridge/HAP/nodejs/Home app.

I tried with Eve and iHome app, the Doorbell is unknown...

As it was working for me this week until yesterday evening, I propose to wait some days. I will survey but we stay in contact

ygageot commented 7 years ago

There is "in the air" updates in Home app. I just discovered the automatic creation of "Groups" when I have several lights in the same room...

ygageot commented 7 years ago

@rthewhite I have a message : Coverage decreased (-0.1%) to 37.534% when pulling... I don't know how to do best Thanks for your support.

rthewhite commented 7 years ago

@ygageot dont worry about it. If you add code which is not being unit tested the coverage will drop slightly. The tests are mostly testing the core parts like the api etc and not individual accessories right now. I released your doorbell changes in 0.0.56 should be available now.

ygageot commented 7 years ago

@basvdploeg Can you try the last version where we considered the doorbell button like a HomeKit Switch and not a HomeKit Doorbell. Thanks

ygageot commented 7 years ago

@basvdploeg On my local version I returned to the old version using Doorbell service and I added an identify action. I tried several apps on my iPhone. Neither support the accessory as is alone. But the accessory works :

If I replace the Doorbell service by StatelessProgrammableSwitch service which is about the same, the behavior is the same.

I read that in the next version of IOS, the Apple Home app will support the ProgrammableSwitches.

For all these reasons I plan to go back to the version with Doorbell service.

ygageot commented 7 years ago

The version with a HW doorbell button considered as a Doorbell HomeKit service is on line. I added a method identify if you want to fire the event without pushing the physical button. You have an HomeKit compatible IP camera. Can you try to link it with a HW doorbell in the same room and test the Video Doorbell group ?

brownad commented 7 years ago

Hi

I'm going to start to redo what I had for the doorbird plugin (doorbell polling doorbird api) and see how to move over to the video doorbell which just makes sense as the api is good.

Any guidance for the approach? I'm assuming the doorbell is pretty much removed now from HomeKit future?

ygageot commented 7 years ago

My expectations... I think that for the moment the HomeKit Doorbell service can be used as linked service with IP camera service inside a Video Doorbell accessory. The Doorbell service will not be suppressed. ProgrammableSwitch is planned to be added in UI of Home app for next iOS release (cf. last beta). I think it will be the same for the Doorbell service. The problem for actual UI of Home app is the fact that Doorbell service has no action in input but only event as output. We have to wait March !!

brownad commented 7 years ago

Sounds straight forward.

Is the video doorbell an existing accessory or only exists when you create accessory with camera and the current doorbell together? And for now live with the non supported device in same room as a camera?

Have you had problems with notifications still by any chance? I stopped getting them all together now

Sent from my iPhone

On 3 Feb 2017, at 19:44, Gageot Yves notifications@github.com wrote:

My expectations... I think that for the moment the HomeKit Doorbell service can be used as linked service with IP camera service inside a Video Doorbell accessory. The Doorbell service will not be suppressed. ProgrammableSwitch is planned to be added in UI of Home app for next iOS release (cf. last beta). I think it will be the same for the Doorbell service. The problem for actual UI of Home app is the fact that Doorbell service has no action in input but only event as output. We have to wait March !!

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

Patrick1610 commented 7 years ago

@ygageot @basvdploeg I have a question. I want to make a KAKU Contact Sensor send instant Messages to the home app (through homewizard) so I can configurere automatic responses when it is openend. What do I have to Install or add to the config.json file? Thanks in Advance!

ygageot commented 7 years ago

@Patrick1610 Look at the README file, config, PushServer entry

Resume : Choose an TCPIP port, add an entry in config file. In HW app for your sensor add an IP virtual switch and emit a request

Homekit will know immediatly the change and you CAN configure Home app to execute what you want !

YLAG commented 7 years ago

Hi guys,

after adding 35 homewizard products :) thx guys

But.. doorbell is stil not working for me. Any help? I get "niet geschikt"

plompen commented 6 years ago

YLAG,

is het gelukt mijn engels is niet zo goed maar ik heb het zelfde probleem