NorthernMan54 / node-red-contrib-homebridge-automation

Homebridge and Node-RED Integration
Apache License 2.0
107 stars 18 forks source link

No event published for Ring Doorbell Motion? #76

Closed rakgupta closed 3 years ago

rakgupta commented 3 years ago

Hello - I am not seeing any event notifications in Nodered when motion is detected on my Ring Doorbell. I do see the event in the Homebridge logs but nothing gets triggered in Nodered.

I created a simple automation in the Home app to flip a virtual switch when Motion is detected and I do see that event in Nodered but nothing for the original motion. Any idea what I could be wrong?

Homebridge Ring Plug-in v 9.14.1 Homebridge v 1.2.5 (RPi4) Node-RED v 1.2.7 node-red-contrib-homebridge-automation v 0.0.72

Screen Shot 2021-01-14 at 11 09 11 AM Screen Shot 2021-01-14 at 11 08 48 AM Screen Shot 2021-01-14 at 11 08 36 AM
rakgupta commented 3 years ago

OK - I'm obviously doing something wrong. The event that I was seeing being published is coming from the Hubitat device (green node) that was triggered by the Homekit automation. I am seeing NO events coming from the Homebridge node. I added a "dummy" accessory using the "Homebridge Dummy" plugin and that is also not publishing any events.

NorthernMan54 commented 3 years ago

Okay, if you enable DEBUG logging in node-red by starting node-red with

DEBUG=hapNode* node-red

It will log a lot of detail on the event messages and the subscription to updates. This is from a light in my setup, creating the node and then receiving an update ( turning it on then off ).

  hapNodeRed hbConf.register Ceiling One - Lightbulb +23s
  hapNodeRed Register hb-event -> Ceiling One - Lightbulb +0ms
16 Jan 08:23:52 - [info] Started modified flows
  hapNodeRed _register homebridgeBC:22:3D:E3:CF:32hampton-bayCeiling One00000043 +6ms
  hapNodeRed _register Ceiling One - Lightbulb BC:22:3D:E3:CF:32 { characteristics: [ { aid: 8, iid: 14, ev: true } ] } +3ms
  hapNodeRed hb-event registered: Ceiling One - Lightbulb -> BC:22:3D:E3:CF:32 +30ms
  hapNodeRed hbEvent.register Ceiling One - Lightbulb +0ms
  hapNodeRed _status request: Ceiling One - Lightbulb -> BC:22:3D:E3:CF:32:?id=8.14 -> +4ms
  hapNodeRed hbEvent received: Ceiling One - Lightbulb = [{"aid":8,"iid":14,"value":false}] { On: false } +17ms
16 Jan 08:24:07 - [info] Stopping modified flows
16 Jan 08:24:07 - [info] Stopped modified flows
16 Jan 08:24:07 - [info] Starting modified flows
  hapNodeRed hbConf.register Ceiling One - Lightbulb +15s
  hapNodeRed Register hb-event -> Ceiling One - Lightbulb +0ms
16 Jan 08:24:07 - [info] Started modified flows
  hapNodeRed _register homebridgeBC:22:3D:E3:CF:32hampton-bayCeiling One00000043 +4ms
  hapNodeRed _register Ceiling One - Lightbulb BC:22:3D:E3:CF:32 { characteristics: [ { aid: 8, iid: 14, ev: true } ] } +1ms
  hapNodeRed hb-event registered: Ceiling One - Lightbulb -> BC:22:3D:E3:CF:32 +11ms
  hapNodeRed hbEvent.register Ceiling One - Lightbulb +0ms
  hapNodeRed _status request: Ceiling One - Lightbulb -> BC:22:3D:E3:CF:32:?id=8.14 -> +2ms
  hapNodeRed hbEvent received: Ceiling One - Lightbulb = [{"aid":8,"iid":14,"value":false}] { On: false } +15ms
  hapNodeJSClient Events [{"host":"192.168.1.11","port":51826,"deviceID":"BC:22:3D:E3:CF:32","aid":8,"iid":14,"value":true,"status":true}] +9m
  hapNodeRed hbEvent Ceiling One {
  host: '192.168.1.11',
  port: 51826,
  deviceID: 'BC:22:3D:E3:CF:32',
  aid: 8,
  iid: 14,
  value: true,
  status: true
} +14s
  hapNodeJSClient Events [{"host":"192.168.1.11","port":51826,"deviceID":"BC:22:3D:E3:CF:32","aid":8,"iid":14,"value":false,"status":true}] +6s
  hapNodeRed hbEvent Ceiling One {
  host: '192.168.1.11',
  port: 51826,
  deviceID: 'BC:22:3D:E3:CF:32',
  aid: 8,
  iid: 14,
  value: false,
  status: true
} +6s
rakgupta commented 3 years ago

Okay, if you enable DEBUG logging in node-red by

Will do this tomororow AM as there is a lot of activity going on with Nodered in the evenings. I did check a device with the "status" node and that does seem to work. But nothing coming from the "Event" node... below is the msg object from the status node.

{"name":"Bedroom Lamp","_rawMessage":{"characteristics":[{"aid":32,"iid":9,"value":true},{"aid":32,"iid":10,"value":50}]},"payload":{"On":true,"Brightness":50},"Homebridge":"homebridge","Manufacturer":"Hubitat","_device":"homebridgeCF:23:3F:E3:CE:53HubitatBedroom Lamp00000043","_confId":"ca3d8f3f.38ec98","_msgid":"918c279f.5e2f98"}

Another thing that I am seeing is that in the drop down list, there are devices that are repeated. I do have two instances of Homebridge but there is only one that I have configured with this instance of Nodered. Are devices somehow "aggregated"? The second HB instance is a "test" instance with only a few devices exposed to HB (the Bedroom Lamp is one of them). No idea what is going on with the Ring camera though - that's only exposed to one HB instance.

Screen Shot 2021-01-16 at 6 34 32 PM Screen Shot 2021-01-16 at 6 34 52 PM
NorthernMan54 commented 3 years ago

This module polls all your homebridge instances and consolidates them into a single list. If your homebridge instance is running in 'insecure mode' it will be discovered and added to the list. So this is expected.

The 'event' node listens for events from the homebridge accessory, while the 'status' node polls the homebridge accessory for status. Hence the difference in behaviour.

Camera's are a bit wacky in discovery and do that, not sure why.

rakgupta commented 3 years ago

Okay, if you enable DEBUG logging in node-red by starting node-red with

Sorry for the delay. I did this on the "test" instance of Homebridge/Node-RED. I don't see any output from the "event" node but do see the correct status from the "status" node

` rakeshgupta@Frankenstein2 ~ % DEBUG=hapNode* node-red 19 Jan 08:39:56 - [info]

Welcome to Node-RED

19 Jan 08:39:56 - [info] Node-RED version: v1.2.6 19 Jan 08:39:56 - [info] Node.js version: v14.15.0 19 Jan 08:39:56 - [info] Darwin 19.6.0 x64 LE 19 Jan 08:39:56 - [info] Loading palette nodes 19 Jan 08:39:58 - [info] Dashboard version 2.26.1 started at /ui 19 Jan 08:39:58 - [info] Settings file : /Users/rakeshgupta/.node-red/settings.js 19 Jan 08:39:58 - [info] Context store : 'default' [module=memory] 19 Jan 08:39:58 - [info] User directory : /Users/rakeshgupta/.node-red 19 Jan 08:39:58 - [warn] Projects disabled : editorTheme.projects.enabled=false 19 Jan 08:39:58 - [info] Flows file : /Users/rakeshgupta/.node-red/flows_Frankenstein2.json 19 Jan 08:39:59 - [info] Server now running at http://127.0.0.1:1880/ 19 Jan 08:39:59 - [warn]


Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials file will not be recoverable, you will have to delete it and re-enter your credentials.

You should set your own key using the 'credentialSecret' option in your settings file. Node-RED will then re-encrypt your credentials file using your chosen key the next time you deploy a change.

19 Jan 08:39:59 - [info] Starting flows hapNodeJSClient Starting Homebridge instance discovery +0ms 19 Jan 08:39:59 - [info] [hubitat config:Hubitat - DV] Starting endpoint for /hubitat/webhook 19 Jan 08:39:59 - [error] [openweathermap:Home Lat_Long] No API key set hapNodeRed hbConf.register Virtual Test Switch - Lightbulb +0ms hapNodeRed Register hb-event -> Virtual Test Switch - Lightbulb +0ms hapNodeRed hbConf.register Virtual Test Switch - Lightbulb +1ms hapNodeRed Register hb-status -> Virtual Test Switch - Lightbulb +0ms 19 Jan 08:39:59 - [warn] [google calendar in:d5e50d7c.267d5] Missing google credentials 19 Jan 08:39:59 - [info] Started flows hapNodeJSClient HAP Device discovered Homebridge DE97 +294ms hapNodeJSClient Homebridge instance discovered Homebridge with 5 accessories +27ms hapNodeJSClient HAP Device discovered Homebridge DD74 +5ms hapNodeJSClient Homebridge instance discovered homebridge with 29 accessories +46ms 19 Jan 08:40:00 - [info] [hubitat device:Lamp Current State] Initialized. switch: off 19 Jan 08:40:00 - [info] [hubitat device:Lamp Current State] Initialized. switch: off 19 Jan 08:40:00 - [info] [hubitat device:8c3ff722.f4a34] Initialized 19 Jan 08:40:00 - [info] [hubitat device:2ac336d5.b09b9a] Initialized. lock: locked 19 Jan 08:40:00 - [info] [hubitat device:Door Way Mirror] Initialized. switch: off 19 Jan 08:40:00 - [info] [hubitat device:Porch Light Status] Initialized. switch: off 19 Jan 08:40:00 - [info] [hubitat device:Virtual Ring Status] Initialized. switch: off 19 Jan 08:40:00 - [info] [hubitat device:59b0558c.5548cc] Initialized hapNodeJSClient Ready +20s hapNodeRed Discovered 71 new evDevices +20s WARNING: Duplicate device name Bedroom Lamp - Lightbulb WARNING: Duplicate device name Front Door - Camera RTPStream Management WARNING: Duplicate device name Front Door - Camera RTPStream Management WARNING: Duplicate device name Front Door - Camera RTPStream Management WARNING: Duplicate device name Front Door - Camera RTPStream Management WARNING: Duplicate device name Front Door - Camera RTPStream Management WARNING: Duplicate device name Front Door - Camera RTPStream Management WARNING: Duplicate device name Front Door - Camera RTPStream Management WARNING: Duplicate device name Front Door - Camera RTPStream Management WARNING: Duplicate device name Front Door - Camera RTPStream Management WARNING: Duplicate device name Garage - Camera RTPStream Management WARNING: Duplicate device name Garage - Camera RTPStream Management WARNING: Duplicate device name Garage - Camera RTPStream Management WARNING: Duplicate device name Garage - Camera RTPStream Management WARNING: Duplicate device name Garage - Camera RTPStream Management WARNING: Duplicate device name Garage - Camera RTPStream Management WARNING: Duplicate device name Garage - Camera RTPStream Management WARNING: Duplicate device name Garage - Camera RTPStream Management WARNING: Duplicate device name Garage - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Front Door - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Front Door - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Front Door - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Front Door - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Front Door - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Front Door - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Front Door - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Front Door - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Front Door - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Garage - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Garage - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Garage - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Garage - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Garage - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Garage - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Garage - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Garage - Camera RTPStream Management ERROR: Parsing failed, duplicate uniqueID. Garage - Camera RTPStream Management hapNodeRed Discovered 56 new ctDevices +3ms hapNodeJSClient Homebridge auth failed, invalid PIN XXX-XX-XXX 192.168.1.XX:51829 {"characteristics":[{"aid":5,"iid":10,"ev":true}]} null {"status":-70401} +19ms hapNodeRed hbStatus Registered: Virtual Test Switch - Lightbulb +12ms hapNodeJSClient Homebridge auth failed, invalid PIN PIN XXX-XX-XXX 192.168.1.XX:51829 {"characteristics":[{"aid":5,"iid":10,"ev":true}]} null {"status":-70401} +30s hapNodeJSClient Homebridge auth failed, invalid PIN PIN XXX-XX-XXX 192.168.1.XX:51829 {"characteristics":[{"aid":5,"iid":10,"ev":true}]} null {"status":-70401} +30s hapNodeJSClient Homebridge auth failed, invalid PIN XXX-XX-XXX 192.168.1.XX:51829{"characteristics":[{"aid":5,"iid":10,"ev":true}]} null {"status":-70401} +30s hapNodeJSClient Homebridge auth failed, invalid PINPIN XXX-XX-XXX 192.168.1.XX:51829 {"characteristics":[{"aid":5,"iid":10,"ev":true}]} null {"status":-70401} +30s ` The Invalid PIN (masked) is for the 2nd instance of Homebridge (that is running on a different server with a different IP address). All the accessories related to the 2nd invalid PIN still show up in the drop down list (as does the "Virtual Test Switch" switch I added to Hubitat and exposed to the "test" instance of Homebridge. Turning the switch on/off from Apple Home did not show anything in the log.

When I tested the "status" node I got the following in the log: hapNodeRed _status request: Virtual Test Switch - Lightbulb -> 192.168.1.XX:51829 -> ?id=5.10 +11m hapNodeRed hbStatus received: "Virtual Test Switch - Lightbulb" = {"characteristics":[{"aid":5,"iid":10,"value":false}]} +6ms

Let me know if I'm doing this right?

rakgupta commented 3 years ago

RE: The Invalid PIN (masked) - the PIN is actually correct but the IP address is not. It had the IP address of the Mac on which Nodered and Homebridge (test instances) are running, but the PIN was for the "live" version of Homebridge at a different IP address.

rakgupta commented 3 years ago

One other thing - in Node-red, the "Event" node is showing disconnected? This has the correct PIN and the device that is exposed only to this instance of Homebridge (Virtual Test Switch) is showing up in Apple Home (I have 2 "homes" configured)

Screen Shot 2021-01-19 at 11 10 28 AM
rakgupta commented 3 years ago

Closing the issue. It was related to my particular configuration and having two instances of Homebridge running with different PINs on two separate computers. Shutting down one instance of Homebridge solved the problem