michbeck100/pimatic-hap

Crash when used with MAX Thermostats: "unsupported mode undefined"

Closed this issue · 1 comments

Setup: Pimatic with MAX and HAP, multiple iOS devices on HomeKit.

The Max setup works, but it can be that when any HomeKit app starts, that pimtatic-hap crashes, because something (dunno if it's the MAX Cube or the HomeKit-iPhone) sets an "unknown" mode:

09:17:01.558 [pimatic] A uncaught exception occured: Error: unsupported mode undefined
09:17:01.558 [pimatic]>    at /home/pi/pimatic-app/node_modules/pimatic-hap/accessories/thermostat.coffee:80:28
09:17:01.558 [pimatic]>    at MaxHeatingThermostat.<anonymous> (/home/pi/pimatic-app/node_modules/pimatic-hap/accessories/thermostat.coffee:101:13)
09:17:01.558 [pimatic]>    at emitOne (events.js:82:20)
09:17:01.558 [pimatic]>    at MaxHeatingThermostat.emit (events.js:169:7)
09:17:01.558 [pimatic]>    at MaxHeatingThermostat.HeatingThermostat._setMode (/home/pi/pimatic-app/node_modules/pimatic/lib/devices.coffee:576:8)
09:17:01.558 [pimatic]>    at MaxCube.<anonymous> (/home/pi/pimatic-app/node_modules/pimatic-max/maxthermostat.coffee:122:16)
09:17:01.558 [pimatic]>    at emitOne (events.js:82:20)
09:17:01.558 [pimatic]>    at MaxCube.emit (events.js:169:7)
09:17:01.558 [pimatic]>    at MaxCube.onData (/home/pi/pimatic-app/node_modules/pimatic-max/node_modules/max-control/index.js:79:8)
09:17:01.558 [pimatic]>    at emitOne (events.js:77:13)
09:17:01.558 [pimatic]>    at Socket.emit (events.js:169:7)
09:17:01.558 [pimatic]>    at Socket.emit (/home/pi/pimatic-app/node_modules/pimatic/startup.coffee:63:24)
09:17:01.558 [pimatic]>    at readableAddChunk (_stream_readable.js:153:18)
09:17:01.558 [pimatic]>    at Socket.Readable.push (_stream_readable.js:111:10)
09:17:01.558 [pimatic]>    at TCP.onread (net.js:537:20)
09:17:01.558 [pimatic]> This is most probably a bug in pimatic or in a module, please report it!
09:17:01.563 [pimatic] exiting...

Sometimes it occurs on the start of Primatic, sometimes it occurs when HomeKit is accessing it. Letting it "sit" for a while before restarting can fix it temporarily, until it's accessed again from a different HomeKit device.

There is a similar issue in pimatic-max, but it looks like it should be fixed here.

I can help debugging, but I'm an iOS dev, and have no idea about Node ;-)

Should be fixed with version 0.9.2