NorthernMan54 / node-red-contrib-homebridge-automation

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

node-red crash #74

Open vladtsit opened 3 years ago

vladtsit commented 3 years ago

Hi! Could you please look at following issue? 2020-12-12T08:39:23.355Z hapNodeJSClient Events [{"host":"192.168.2.4","port":51826,"aid":112,"iid":9,"value":39,"status":true}] 2020-12-12T08:39:29.307Z hapNodeJSClient Events [{"host":"192.168.2.4","port":51826,"aid":112,"iid":17,"value":38,"status":true}] 2020-12-12T08:39:29.425Z hapNodeJSClient Events [{"host":"192.168.2.4","port":51826,"aid":112,"iid":9,"value":38,"status":true}] 2020-12-12T08:39:37.057Z hapNodeJSClient Events [{"host":"192.168.2.4","port":51826,"aid":112,"iid":17,"value":79,"status":true}] 2020-12-12T08:39:45.344Z hapNodeJSClient Events [{"host":"192.168.2.4","port":51826,"aid":112,"iid":17,"value":16,"status":true}] 12 Dec 11:39:56 - [info] [mqtt-broker:873dcef1.3ca82] Connection failed to broker: mqtt://192.168.1.21:1883 2020-12-12T08:40:05.624Z hapNodeJSClient Events [{"host":"192.168.2.4","port":51826,"aid":112,"iid":17,"value":68,"status":true}] 2020-12-12T08:40:12.008Z hapNodeJSClient Events [{"host":"192.168.2.4","port":51826,"aid":112,"iid":12,"value":0,"status":true}] 2020-12-12T08:40:20.611Z hapNodeJSClient Events [{"host":"192.168.2.4","port":51826,"aid":112,"iid":12,"value":1,"status":true}] 2020-12-12T08:40:23.061Z hapNodeJSClient Events [{"host":"192.168.2.4","port":51826,"aid":112,"iid":14,"value":76.8,"status":true}] 12 Dec 11:40:32 - [info] [mqtt-broker:873dcef1.3ca82] Connection failed to broker: mqtt://192.168.1.21:1883 2020-12-12T08:40:33.387Z hapHttpClient Disconnected from server 192.168.2.4:51826 undefined 2020-12-12T08:40:33.388Z hapNodeJSClient HAPevent events Reregister { server: '192.168.2.4:51826', deviceID: undefined } 12 Dec 11:40:33 - [red] Uncaught Exception: 12 Dec 11:40:33 - TypeError: Cannot read property 'forEach' of undefined at HAPNodeJSClient._reconnectServer (c:\Users\vladtsit.node-red\node_modules\hap-node-client\HAPNodeJSClient.js:301:39) at EventEmitter.emit (events.js:314:20) at EventEmitter.emit (domain.js:483:12) at Socket. (c:\Users\vladtsit.node-red\node_modules\hap-node-client\lib\eventedHttpClient.js:90:24) at Socket.emit (events.js:326:22) at Socket.EventEmitter.emit (domain.js:483:12) at endReadableNT (_stream_readable.js:1223:12) at processTicksAndRejections (internal/process/task_queues.js:84:21)

vladtsit commented 3 years ago

Homebridge up and running and latest version

NorthernMan54 commented 3 years ago

Is this the latest version of homebridge-automation ? "version": "0.0.77"

cd .node-red
npm install node-red-contrib-homebridge-automation
vladtsit commented 3 years ago

no this is 0.0.72 installed from inside of node-red. Il'' upgrade and come back with feedback. Thanks

vladtsit commented 3 years ago

npm install node-red-contrib-homebridge-automation installs 0.0.72 should I specify 0.0.77?

NorthernMan54 commented 3 years ago
npm install node-red-contrib-homebridge-automation@latest

When I install I get

npm install node-red-contrib-homebridge-automation
npm WARN deprecated bonjour-hap@3.5.11: bonjour-hap is no longer maintained. Refer to the Notice section of the README.md. The library should not be used anymore

+ node-red-contrib-homebridge-automation@0.0.77
added 68 packages from 47 contributors and audited 715 packages in 11.255s

41 packages are looking for funding
  run `npm fund` for details

found 8 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
vladtsit commented 3 years ago

I directed npm to install 0.0.77 seems it installed and i'll look for further errors.

I have another issue, suddently all devices disappears from hb node. homebridge is running correctly and controls devices. nothing in the node-red log. What you recommend to do?

NorthernMan54 commented 3 years ago

You need to wait a minute or so and they should appear ( auto discovery needs to run )

Nothing in the logs ?

vladtsit commented 3 years ago

The only thing I see in logs is 2020-12-12T14:53:22.777Z hapNodeJSClient Starting Homebridge instance discovery

Still list of devices is empty. I waited long time. What may help you, yesterday, on 0.0.72 I was able to discover and control devices but after some time they disappeared. May be after homebridge restart.

After upgrading to 77 I newer seen devices discovered. May be problem is that I have Homebridge on separate host (VM under windows). Is it possible to specify Homebridge ip and port directly?

vladtsit commented 3 years ago

also I see in logs: 2020-12-12T14:53:42.779Z hapNodeJSClient Ready

NorthernMan54 commented 3 years ago

Your issue is networking between the two VM's

I'm not an expert in VM's or Windows so can't really say what to do, but homebridge-automation uses MDNS/Bonjour to discovery homebridge instances ( same as HomeKit ), then direct IP connections.

MDNS expects all devices to be on a single flat network so broadcast requests on port 5353 can be seen by all devices. You would need to configure this in your VM environment

vladtsit commented 3 years ago

I'll examine what I can do to change network environment. All hosts are in same 192.168.2.* network with no restrictions. Seems there are no restrictions. What is strange - sometime it is working. BTW is it possible to inform homebridge-automation which IP and address to use for homebridge connection?

NorthernMan54 commented 3 years ago

No, unfortunately not

vladtsit commented 3 years ago

still, this is kind of magic for me, suddenly it is working and devices are discoverable after few hours. :) Nothing changed. Will explore to find any pattern. Anyway thank you for your job!

vladtsit commented 3 years ago

Here some additonal logs when devices are not listed: 2020-12-12T21:37:39.834Z hapNodeJSClient Events [{"host":"192.168.2.4","port":51826,"deviceID":"CC:22:3D:E3:CE:55","aid":112,"iid":9,"value":44,"status":true}] 13 Dec 00:37:55 - [error] [hb-status:Humidifier] Device not found: homebridgeCC:22:3D:E3:CE:55SmartMiHumidifier000000BD