Closed atus closed 4 years ago
Same error on my site
An uncaught exception occurred: TypeError: promise.then(...).catch(...).done is not a function
at PowerSwitchAccessory.BaseAccessory.handleReturnPromise (/home/pi/pimatic-app/node_modules/pimatic-hap/accessories/base.coffee:75:10)
at PowerSwitchAccessory.handleReturnPromise (/home/pi/pimatic-app/node_modules/pimatic-hap/accessories/base.coffee:1:1)
at null.<anonymous> (/home/pi/pimatic-app/node_modules/pimatic-hap/accessories/switch.coffee:39:12)
at emitThree (events.js:97:13)
at null.emit (events.js:175:7)
at null.Characteristic.getValue (/home/pi/pimatic-app/node_modules/pimatic-hap/node_modules/hap-nodejs/lib/Characteristic.js:142:10)
at Bridge.<anonymous> (/home/pi/pimatic-app/node_modules/pimatic-hap/node_modules/hap-nodejs/lib/Accessory.js:706:20)
at Array.forEach (native)
at Bridge.Accessory._handleGetCharacteristics (/home/pi/pimatic-app/node_modules/pimatic-hap/node_modules/hap-nodejs/lib/Accessory.js:670:8)
at emitMany (events.js:108:13)
at HAPServer.emit (events.js:182:7)
at HAPServer._handleCharacteristics (/home/pi/pimatic-app/node_modules/pimatic-hap/node_modules/hap-nodejs/lib/HAPServer.js:926:10)
at HAPServer.<anonymous> (/home/pi/pimatic-app/node_modules/pimatic-hap/node_modules/hap-nodejs/lib/HAPServer.js:209:39)
at emitNone (events.js:67:13)
at IncomingMessage.emit (events.js:166:7)
at endReadableNT (_stream_readable.js:923:12)
at nextTickCallbackWith2Args (node.js:458:9)
at process._tickCallback (node.js:372:17)
This is most probably a bug in pimatic or in a module, please report it!
@newschooler Can you tell which type of device is used?
@atus I suspect the pimatic-gpio plugin, because it was updated recently. Could you try to revert back to the version before, which would be 0.9.0? Especially is suspect https://github.com/pimatic/pimatic-gpio/commit/35b64720ea803b2a84a587ecc0f7b10d0356edd7
@newschooler Can you tell which type of device is used?
Sorry, it's the GpioSwitch as well. I will try to revert and report then.
edit: @michbeck100 I just moved back to pimatic-gpio 0.9.0 plugin and the error is gone.
confirming that downgrading to pimatic/pimatic-gpio 0.9.0 solves the issue
Version 0.11.2 should fix this issue. I had the same problem with pimatic-sysinfo, so it was easy to find the problem then.
Why do you use done() in this context? It should not be used with bluebird promises and it is not part of the standard for native promise. If I recap this correctly done() is used as part of Q, but Q promises should be wrapped by the plugin as much as possible, as the are considered harmful
@mwittig to be honest, I'm not a JS professional, I've just seen other plugins and pimatic itself using done() (see here) Would be great if you have an example how to use it right, and I will change it for the next release
Well, me neither. See
Needs further investigation which type of promise it is, as native and bluebird promise should have done()
defined. Also it should be investigate which strategy is the best to avoid such issues:
The use in the pimatic code itself is for historical reasons
Should be solved together with #78
I get the error below. As part of debugging this I did the following:
If I disable all devices I can set up a new home. As soon as I add a simple GpioSwitch I get the error below.
pimatic version 0.9.48 Node.js version 4.9.1 pimatic-hap version 0.11.1
I do not use tradfri where other people have reported errors previously.
Interestingly, when I add a single PowerSwitch I get this error but I can control the switch from Home app. The error appears if I open the app or click on the control.