ztalbot2000 / homebridge-cmd4

CMD4 Plugin for Homebridge - Supports ~All Accessory Types & now all Characteristics too
Apache License 2.0
145 stars 14 forks source link

plug-in wont start #112

Closed jameswestcott closed 2 years ago

jameswestcott commented 2 years ago

Hi,

just updated plug-in with latest v5.0.1 from a previous v4 and the plug-in no longer runs. I get the following error message:

TypeError: Cannot read property 'filter' of undefined at Cmd4Accessory.setupAccessoryFakeGatoService (C:\Users\james\AppData\Roaming\npm\node_modules\homebridge-cmd4\Cmd4Accessory.js:1165:64) at Cmd4Accessory.createServicesForStandaloneAccessoryAndItsChildren (C:\Users\james\AppData\Roaming\npm\node_modules\homebridge-cmd4\Cmd4Accessory.js:556:17) at new Cmd4Accessory (C:\Users\james\AppData\Roaming\npm\node_modules\homebridge-cmd4\Cmd4Accessory.js:300:15) at C:\Users\james\AppData\Roaming\npm\node_modules\homebridge\src\server.ts:350:50 at Array.forEach () at Server.loadAccessories (C:\Users\james\AppData\Roaming\npm\node_modules\homebridge\src\server.ts:270:29) at Server.start (C:\Users\james\AppData\Roaming\npm\node_modules\homebridge\src\server.ts:162:12)

There are multiple entries in accessories in config.json like this one: "accessories": [ { "accessory": "Cmd4", "type": "TemperatureSensor", "name": "Bathroom1Temperature", "displayName": "Bathroom1Temperature", "manufacturer": "cmd4", "model": "TemperatureSensor", "serialNumber": "10001", "CurrentTemperature": 0, "statusActive": "TRUE", "StatusFault": "NO_FAULT", "StatusTampered": "NOT_TAMPERED", "StatusLowBattery": "BATTERY_LEVEL_NORMAL", "polling": [ { "Characteristic": "CurrentTemperature", "Interval": 60, "Timeout": 10000 } ], "fakegato": { "eve": "room", "temp": "CurrentTemperature", "humidity": "0", "ppm": "0", "storage": "fs" }, "stateChangeResponseTime": 3, "state_cmd": "node C:\Users\james\.homebridge\instance2\temperaturehumidity1.js" },

ztalbot2000 commented 2 years ago

Hi,

So nothing in Cmd4 v5 touched FakeGato. I'll poke around. Do you know if FakeGato has changed or what version you have installed?

Thanks, John Talbot

On Fri, Aug 13, 2021 at 3:08 PM jameswestcott @.***> wrote:

Assigned #112 https://github.com/ztalbot2000/homebridge-cmd4/issues/112 to @ztalbot2000 https://github.com/ztalbot2000.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/112#event-5157305427, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX2CZ6ZVGONOGTDNYE3T4VUS5ANCNFSM5CEEIGFA .

jameswestcott commented 2 years ago

I'm not sure if it's changed. Am now running 0.6.1. Not sure what version I had before. Will also take a look.

ztalbot2000 commented 2 years ago

Hi,

I found the bug. As I said I did not touch FakeGato. There is a check to see if the Fakegato characteristic is polled. In your case it fails. I will put out a fix in the next couple of hours.

I'm also going to put in some unit tests that will find this if it were to happen in the future. Frankly, I thought there were already. With 9513 test cases, you think there would be. I guess not for this.

Sorry about that, John

On Fri, Aug 13, 2021 at 8:49 PM jameswestcott @.***> wrote:

I'm not sure if it's changed. Am now running 0.6.1. Not sure what version I had before. Will also take a look.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ztalbot2000/homebridge-cmd4/issues/112#issuecomment-898783051, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX6QKHLCL3NBLHHOM7LT4W4QNANCNFSM5CEEIGFA .

ztalbot2000 commented 2 years ago

Resolved with v5.0.2. I've also added a number of test cases around some fakegato configurations so hopefully this will not happen again. It certainly would have caught this one.

Sorry for the inconvenience John