joe-ng / homebridge-dyson-link

MIT License
206 stars 40 forks source link

Homebridge don´t start after install of this plugin #2

Closed Krocko closed 7 years ago

Krocko commented 7 years ago

got the following error if i start hombridge with your plugin.

Jul 15 17:21:43 raspberrypi homebridge[25877]: /usr/local/lib/node_modules/homebridge-dyson-link/DysonLinkAccessory.js:18
Jul 15 17:21:43 raspberrypi homebridge[25877]: this.accessory.addService(Service.TemperatureSensor, this.displayName)
Jul 15 17:21:43 raspberrypi homebridge[25877]: ^
Jul 15 17:21:43 raspberrypi homebridge[25877]: ReferenceError: Service is not defined
Jul 15 17:21:43 raspberrypi homebridge[25877]: at DysonLinkAccessoryHelper.initSensor (/usr/local/lib/node_modules/homebridge-dyson-link/DysonLinkAccessory.js:18:35)
Jul 15 17:21:43 raspberrypi homebridge[25877]: at new DysonLinkAccessoryHelper (/usr/local/lib/node_modules/homebridge-dyson-link/DysonLinkAccessory.js:12:14)
Jul 15 17:21:43 raspberrypi homebridge[25877]: at config.accessories.forEach (/usr/local/lib/node_modules/homebridge-dyson-link/index.js:52:29)
Jul 15 17:21:43 raspberrypi homebridge[25877]: at Array.forEach (native)
Jul 15 17:21:43 raspberrypi homebridge[25877]: at API.<anonymous> (/usr/local/lib/node_modules/homebridge-dyson-link/index.js:41:36)
Jul 15 17:21:43 raspberrypi homebridge[25877]: at emitNone (events.js:91:20)
Jul 15 17:21:43 raspberrypi homebridge[25877]: at API.emit (events.js:188:7)
Jul 15 17:21:43 raspberrypi homebridge[25877]: at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:93:13)
Jul 15 17:21:43 raspberrypi homebridge[25877]: at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)
Jul 15 17:21:43 raspberrypi homebridge[25877]: at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
Jul 15 17:21:44 raspberrypi homebridge[25877]: at Module._compile (module.js:571:32)
Jul 15 17:21:44 raspberrypi homebridge[25877]: at Object.Module._extensions..js (module.js:580:10)
Jul 15 17:21:44 raspberrypi homebridge[25877]: at Module.load (module.js:488:32)
Jul 15 17:21:44 raspberrypi homebridge[25877]: at tryModuleLoad (module.js:447:12)
Jul 15 17:21:44 raspberrypi homebridge[25877]: at Function.Module._load (module.js:439:3)
Jul 15 17:21:44 raspberrypi homebridge[25877]: at Module.runMain (module.js:605:10)
Jul 15 17:21:44 raspberrypi homebridge[25877]: at run (bootstrap_node.js:427:7)
Jul 15 17:21:44 raspberrypi homebridge[25877]: at startup (bootstrap_node.js:151:9)
Jul 15 17:21:44 raspberrypi homebridge[25877]: at bootstrap_node.js:542:3

any help would be great.

joe-ng commented 7 years ago

Just wondering, which version of Node.JS and Homebridge are you using?

I am using Node 8.1 and Homebridge 0.4.2

Krocko commented 7 years ago

i am using node 8.1.3, npm 5.3.0, Homebridge 0.4.22

joe-ng commented 7 years ago

Ah, maybe that was because the reference Service was missing from the helper class. I just added that back and published the patch version to npm. feel free to try that when you have a chance

Krocko commented 7 years ago

Works perfect now! Thank you very very much! Is it possible for you to add a night mode switch?

Krocko commented 7 years ago

I don't get the right states in the HomeKit App

img_0073

img_0074

Krocko commented 7 years ago

Found the mistake. i removed the Dyson-fan plugin. this must have deleted needed parts from your plugin. reinstalled your plugin and all is working again.

Sorry for this hiccup.

Krocko commented 7 years ago

That was not the solution. After a while the values in the HomeKit App are wrong and i can't control the Fan with HomeKit anymore.

joe-ng commented 7 years ago

can you let me know which value was wrong in the Home app? (sorry, I could not understand the language on your screenshot) And did you use the Dyson link app/remote to change the value? Or did you use Home app for that?

There is currently a min delay if you use the Dyson Link app/remote to change the device while you keep the Home app on the screen.(if you reopen the home app, the value should be reloaded correctly)

Krocko commented 7 years ago

The Fan was set to Speed "3", manuel Modus and Rotation on in the dyson App. In the HomeKit App all switches or showen as off. If i change the state in the Home App, the stat from the fan don't change. If i reopen the HomeKit App, the values are reloaded, but the states don't change.

joe-ng commented 7 years ago

From the homebridge log, did you see something like below when you tried to change the state from the Home app? [DysonPlatform] [Name of your device] - Set State:{ XX: XXX}

I am just trying to see if the plugin is working or if the connection to the Dyson device was broken

joe-ng commented 7 years ago

Night mode button is added to the latest version and published to npm, btw

Krocko commented 7 years ago

A short time all worked as it should in the Home App. After this short time, nothing happend to the fan, if i change the states in the Home App. Will check the log later this day, If i finished work.

Krocko commented 7 years ago

There are no entries in the log from the [DysonPlatform]. Also if i change the state in the home app. But if i open the Dyson app, i get the following:

Jul 17 18:20:02 raspberrypi homebridge[26357]: [2017-7-17 18:20:02] [DysonPlatform] {"msg":"CURRENT-STATE","time":"2017-07-17T16:20:01.000Z","mode-reason":"LAPP","state-reason":"MODE","dial":"OFF","rssi":"-55","product-state":{"fmod":"OFF","fnst":"OFF","fnsp":"0001","qtar":"0004","oson":"OFF","rhtm":"OFF","filf":"4233","ercd":"02C0","nmod":"OFF","wacd":"NONE"},"scheduler":{"srsc":"ec29","dstv":"0001","tzid":"0001"}}
Jul 17 18:20:02 raspberrypi homebridge[26357]: [2017-7-17 18:20:02] [DysonPlatform] Update fan data
Jul 17 18:20:02 raspberrypi homebridge[26357]: [2017-7-17 18:20:02] [DysonPlatform] {"msg":"ENVIRONMENTAL-CURRENT-SENSOR-DATA","time":"2017-07-17T16:20:01.001Z","data":{"tact":"OFF","hact":"OFF","pact":"0000","vact":"0004","sltm":"OFF"}}
Jul 17 18:20:02 raspberrypi homebridge[26357]: [2017-7-17 18:20:02] [DysonPlatform] Update sensor data
Jul 17 18:20:05 raspberrypi homebridge[26357]: [2017-7-17 18:20:05] [DysonPlatform] {"msg":"STATE-CHANGE","time":"2017-07-17T16:20:04.000Z","mode-reason":"LAPP","state-reason":"MODE","product-state":{"fmod":["OFF","AUTO"],"fnst":["OFF","OFF"],"fnsp":["0001","AUTO"],"qtar":["0004","0004"],"oson":["OFF","OFF"],"rhtm":["OFF","OFF"],"filf":["4233","4233"],"ercd":["02C0","02C0"],"nmod":["OFF","OFF"],"wacd":["NONE","NONE"]},"scheduler":{"srsc":"ec29","dstv":"0001","tzid":"0001"}}
Jul 17 18:20:05 raspberrypi homebridge[26357]: [2017-7-17 18:20:05] [DysonPlatform] {"msg":"STATE-CHANGE","time":"2017-07-17T16:20:04.001Z","mode-reason":"LAPP","state-reason":"MODE","product-state":{"fmod":["AUTO","AUTO"],"fnst":["OFF","FAN"],"fnsp":["AUTO","AUTO"],"qtar":["0004","0004"],"oson":["OFF","OFF"],"rhtm":["OFF","OFF"],"filf":["4233","4233"],"ercd":["02C0","02C0"],"nmod":["OFF","OFF"],"wacd":["NONE","NONE"]},"scheduler":{"srsc":"ec29","dstv":"0001","tzid":"0001"}}

If i stop homebridge delete the "cachedAccessories" file and restart homebridge, all is working again.

Krocko commented 7 years ago

I found out, it only happens If homebridge restarts. Then the switches in the home app don't work anymore and the states are wrong. I musst delete the "cachedAccessories" file, before homebridge is starting again.

joe-ng commented 7 years ago

Thanks for your effort and patience on this! I didn't have this issue on my side so I would need your help to get some cue on this. Your finding is helpful. Let me look into this after work. Will let you know how it goes.

Krocko commented 7 years ago

No Problem mate. Let me know, if you need more debug or infos.

Krocko commented 7 years ago

Hy. Have you found a solution?

joe-ng commented 7 years ago

Sorry, I was out of the country in last two weeks. Will check on this in this weekend

joe-ng commented 7 years ago

I seemed to have fixed that and have published that to the latest package. You may try that out when you have a chance

Krocko commented 7 years ago

Works now. Thank you very much.