ebaauw / homebridge-hue

Homebridge plugin for Philips Hue
Apache License 2.0
899 stars 91 forks source link

After Update to 11.57 many lights are gone #652

Closed ikorbln closed 4 years ago

ikorbln commented 4 years ago

Hello, After update to version 11.57 all "none" Phillips Lights are gone in Homekit. I go back to version 11.50 and all is good.

ebaauw commented 4 years ago

Please attach the debug dump file and capture and attach a debug log file, see https://github.com/ebaauw/homebridge-hue#debug-log-file.

sschuste commented 4 years ago

I have the same behavior since version v0.11.55.

[3/11/2020, 10:55:10] [Hue] Philips hue: Philips BSB002 bridge v1937045000, api v1.36.0
[3/11/2020, 10:55:10] [ZP] Wohnzimmer Sonos: set Track from "01 We Will Rock You.mp3" to "We Will Rock You"
[3/11/2020, 10:55:10] [ZP] warning: npm registry: The "listener" argument must be of type function. Received an instance of Object
[3/11/2020, 10:55:10] [Hue] Philips hue: bridge request 1: get /
[3/11/2020, 10:55:10] [Hue] Philips hue: error: TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received an instance of Object
[3/11/2020, 10:55:10] [Hue] Philips hue: 
[3/11/2020, 10:55:10] [Hue] Philips hue: 1 accessories
[3/11/2020, 10:55:10] [Hue] masked debug info dumped to /var/homebridge/homebridge-hue.json.gz
[3/11/2020, 10:55:10] [Hue] Initializing platform accessory 'Philips hue'...
[3/11/2020, 10:55:10] [Hue] Philips hue: 2 services

Missing are two Paulmann Cephei Controllers which work seamlessly up to v0.11.52. My config.json entry for homebridge-hue is quite small:

 {
            "platform": "Hue",
            "host": "192.168.1.23",
            "lights": true,
            "hueMotionTemperatureHistory": true,
            "users": {
                "00178***********": "woCUc1*****fUGji674fKCpN78-************"
            }

The debug log doesn't shows any useful entries - at least not for me. But I'll attach it here anyway and another one that has a lot more info, but which completely overwhelms me.

I find it interesting that a similar message is generated by homebridge-zp. So I thought that the error would be generated by a shared lib. However, uninstalling homebridge-hue and homebridge-zp and reinstalling both plugins did not change anything.

I'm using the latest versions of all components on a Raspi 4 with Raspbian Buster. Switching back to v0.11.52 solves the problem.

homebridge.log.gz homebridge_large.log.gz homebridge-hue.json.gz

ebaauw commented 4 years ago

The ERR_INVALID_ARG_TYPE error looks suspiciously like #629.

Since v0.11.55, homebridge-hue communicates with the Hue bridge over https. My best guess, a plugin that loads in between homebridge-hue querying the NPM registry and homebridge-zp querying the NPM registry is breaking https. To confirm, could you add "forceHttp": true to the homebridge-hue section in config.json? That should eliminate the error for homebridge-hue, but not the error for homebridge-zp.

Detailed analysis below:

Mar 11 11:02:56 homePi homebridge[24949]: [3/11/2020, 11:02:56] [Hue] warning: not using recommended homebridge version v0.4.50
Mar 11 11:02:56 homePi homebridge[24949]: [3/11/2020, 11:02:56] [ZP] warning: not using recommended homebridge v0.4.50

I haven't yet fully tested homebridge v0.4.52, but I doubt that this version would be causing any issues.

Mar 11 11:02:58 homePi homebridge[24949]: [3/11/2020, 11:02:58] [Hue] Philips hue: Philips BSB002 bridge v1937045000, api v1.36.0
Mar 11 11:02:58 homePi homebridge[24949]: [3/11/2020, 11:02:58] [Hue] Philips hue: bridge request 1: get /
Mar 11 11:02:58 homePi homebridge[24949]: [3/11/2020, 11:02:58] [Hue] Philips hue: bridge request 1: get /
Mar 11 11:02:58 homePi homebridge[24949]: [3/11/2020, 11:02:58] [Hue] Philips hue: error: TypeError [ERR_INVALID_ARG_TYPE]: The "listener" argument must be of type function. Received an instance of Object
Mar 11 11:02:58 homePi homebridge[24949]: [3/11/2020, 11:02:58] [Hue] Philips hue: 
Mar 11 11:02:58 homePi homebridge[24949]: [3/11/2020, 11:02:58] [Hue] Philips hue: 1 accessories

homebridge-hue cannot get the full bridge state from the Hue bridge, and therefore exposes no other accessories than the bridge.

Since v0.11.55, homebridge-hue communicates with the Hue bridge over https. The homebridge-zp error is raised when it tries to retrieve the latest version from the NPM registry, also over https.

Mar 11 12:31:39 homePi homebridge[4395]: 2020-03-11T11:31:39.581Z HttpClient4 constructor({"https":true,"host":"registry.npmjs.org","json":true})
Mar 11 12:31:39 homePi homebridge[4395]: 2020-03-11T11:31:39.584Z HttpClient4 
request(get, /homebridge-zp/latest, undefined, {"Accept":"application/json"})
Mar 11 12:31:39 homePi homebridge[4395]: [3/11/2020, 12:31:39] [ZP] warning: npm registry: The "listener" argument must be of type function. Received an instance of Object

Interestingly, the retrieval of the latest homebridge-hue version over https from the NPM registry does succeed:

Mar 11 12:31:37 homePi homebridge[4395]: 2020-03-11T11:31:37.871Z HttpClient1 constructor({"https":true,"host":"registry.npmjs.org","json":true})
Mar 11 12:31:37 homePi homebridge[4395]: 2020-03-11T11:31:37.879Z HttpClient1 request(get, /homebridge-hue/latest, undefined, {"Accept":"application/json"})
Mar 11 12:31:39 homePi homebridge[4395]: 2020-03-11T11:31:39.533Z HttpClient1 request(get, /homebridge-hue/latest, undefined, {"Accept":"application/json"}) => {"headers":{"date":"Wed, 11 Mar 2020 11:31:39 GMT","content-type":"application/json","transfer-encoding":"chunked","connection":"close","set-cookie":["__cfduid=db3f17b3aefb52d1f522ef27bb4de0c671583926298; expires=Fri, 10-Apr-20 11:31:38 GMT; path=/; domain=.npmjs.org; HttpOnly; SameSite=Lax"],"cf-ray":"5724f3486b47c2ef-FRA","cf-cache-status":"DYNAMIC","expect-ct":"max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"","server":"cloudflare"},"statusCode":200,"statusMessage":"OK","body":{"name":"homebridge-hue","description":"Homebridge plugin for Philips Hue and deCONZ","author":{"name":"Erik Baauw"},"license":"Apache-2.0","version":"0.11.57","keywords":["homebridge-plugin","homekit","philips","hue","philipshue","philips-hue","deconz","raspbee","conbee"],"main":"index.js","bin":{"dc_eventlog":"cli/dc_eventlog.js","ph":"cli/ph.js"},"engines":{"BSB001":"1.16.0","BSB002":"1.36.0","deCONZ":"2.5.74","homebridge":"^0.4.50","node":"^12.16.1"},"dependencies":{"chalk":"~3.0.0","debug":"~4.1.1","fakegato-history":"~0.5.6","homebridge-lib":"~4.5.3","moment":"~2.24.0","semver":"~7.1.3","ws":"~7.2.1","xml2js":"~0.4.23"},"scripts":{"prepare":"standard","test":"standard && echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/ebaauw/homebridge-hue.git"},"bugs":{"url":"https://github.com/ebaauw/homebridge-hue/issues"},"homepage":"https://github.com/ebaauw/homebridge-hue#readme","gitHead":"fa0fa115e4d5e49b3b8e6519f748d69cbc242842","_id":"homebridge-hue@0.11.57","_nodeVersion":"12.16.1","_npmVersion":"6.14.1","dist":{"integrity":"sha512-IN7dybZKyCudgEUbl5xbU2PW/HOuq4WA6cbMn35MQtw7UTG7mPGGOOd2wO1QO0IB4NUH7yrbKLrmnCTguUZXvg==","shasum":"de36b4df2680d1fd1e3598eb331dfb70dc1f914a","tarball":"https://registry.npmjs.org/homebridge-hue/-/homebridge-hue-0.11.57.tgz","fileCount":17,"unpackedSize":305679,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeW+nSCRA9TVsSAnZWagAARnMP/10J62khXAwJSURV8VzG\nXsiYoKXrQr7RlEiU9bP6d9FOOO5GU5bgUdI9WIFtyACalhNul0AD+HmSd7Wa\nmNqMToksPENnzQ3hFRRYy1O84Gv/F6j4V0w0aKaEH8iZvay3ydiE6cACYx2y\nhdkfX9KCJjUxOJqF/JAvAHqXerQEdpnwcvuNejA3/aaPBliViuNtQ40c8k9O\nSXcVQdxVFBoJMeXMOPOLe0kKxJ/S+RDEhEj7MQ2uSZ11XcxO7Ug3auZm0aOL\nyMCoG23CQ0WmJ1vgSDMTESOOWcR9ymcwsMRSt4y+f98JqexR5JaBDUOElfX6\n2kz4TwLVLcnCcASK9z+aepfufKC1d0aUcGUfMdHJxAScQPScRsuererytD8+\nWmOaAzkDvJHlhksJNQud9YKlYA3nrCUJXH9KVEHHO8MqAt52L/P68vFxdiXQ\n0IN2l2RCpW9BWzJDfNvt256ieeF5En0ULsalrrsLeBHlhBJOaMDTDYNQZde/\n7EZLU1c/Yj6vJL9Vznp/1F4zI+anMYo6s94WHt92nDdw1WkZrAOFJQ/IdH8c\n+FsMZE9stITCFNdz+qV6R7ZWeNtdxt20jJ7e/H+UMnjHmTvkkCKFm9RedMAw\nZw70MTJnuXpolDNMOvJG1LAiYx5vXRJaulD+k2jN/qCIr1MRQQ5RLti9I8/o\ntFA4\r\n=lE4q\r\n-----END PGP SIGNATURE-----\r\n"},"maintainers":[{"name":"ebaauw","email":"erik.baauw@xs4all.nl"}],"_npmUser":{"name":"ebaauw","email":"erik.baauw@xs4all.nl"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/homebridge-hue_0.11.57_1583081937483_0.19119306524176394"},"_hasShrinkwrap":false}}
sschuste commented 4 years ago

The joke is: I also suspected another plugin, but I thought the idea was too far-fetched. In fact, the error occurred when I updated homebridge-config-ui-x to the latest version. After that, homebridge-hue did not work properly anymore.

After analyzing my logs, I found out that I had not restarted homebridge after installing homebridge-hue@0.11.55. So the new version was installed but not activated. A restart of Homebridge only happened after the installation of homebridge-config-ui-x. At that moment homebridge-hue@0.11.55 was also activated.

So I do not know exactly what the trigger is. Is it homebridge-config-ui-x? Probably not. I don't think it's homebridge@0.4.52 either. If it was, you would have noticed that from the amount of issues.

All I can do and will do is: I will install a homebridge instance on another Raspi and there I will use homebridge-hue as the only plugin. Then I'll see what happens (and I assume that this will work as usual). Then I will install several plugins and see what happens,

I'll keep you posted, but it'll take a few days. BTW: it works with "forceHttp": true

ebaauw commented 4 years ago

I'm running homebridge-config-ui-x myself - that's not causing any issues. The culprit from #629 was homebridge-fritz-platform, but it might also be the http-proxy-agent package, included by that plugin as a dependency. See https://github.com/ebaauw/homebridge-hue/issues/629#issuecomment-592461648.

You might try running sudo npm -g list to check if that dependency is used by one of your plugins.

I'll see if I can improve the error reporting in homebridge-hue so that it always prints a stack trace for JavaScript and NodeJS runtime errors, but not for regular exceptions like "cannot resolve hostname" or "connection refused".

ebaauw commented 4 years ago

v0.11.58 should log a stack trace with the error, which should help to identify the plugin.

ebaauw commented 4 years ago

Another case. Looks like the http-proxy-agent library is the common factor.