DheerajKhajuria / pimatic-mysensors

mysensors
http://forum.mysensors.org/topic/797/pimatic-mysensors-controller-plugin
GNU General Public License v2.0
23 stars 24 forks source link

Dimlevel above 100 causes exception #87

Closed rikki78 closed 6 years ago

rikki78 commented 7 years ago

Hello,

Yesterday and the day before I received the error below, making the plugin stop working.

I think there are two issues: First the level received from mysensors is wrong. In the sketch it is not possible to send values higher than 100 so perhaps a transmission or decoding failure?

The node 6 requests a value at 17:26:59.003 and 17:26:59.016. The plugin replies and a value is coming in at 17:26:59.030. The strange thing is that this value is coming from a different node (4) then was requested (6). And the value was actually 70 at that time.

The nodes are requesting there values every minute (as some kind of watchdog) and this process normally is handled ok. After Sending 6;5;1;1;3;0 the answer normally is MySensorDimmer { sender: 6, sensor: 5, type: 3, value: '70' }

The second thing is that when this occurs (a value higher then 100) this exception is raised making the mysensors plugin not working anymore. Can this be protected easily by cutting off values above 100?

Please note I've also posted this in https://github.com/pimatic/pimatic/issues/1034

17:26:59.003 [pimatic-mysensors] debug: <- request from 6 17:26:59.007 [pimatic-mysensors] debug: -> Sending 6;4;1;1;3;0 17:26:59.007 [pimatic-mysensors] debug:> 17:26:59.011 [pimatic-mysensors] debug: -> Sending 6;5;1;1;3;0 17:26:59.011 [pimatic-mysensors] debug:> 17:26:59.016 [pimatic-mysensors] debug: <- request from 6 17:26:59.019 [pimatic-mysensors] debug: -> Sending 6;4;1;1;3;0 17:26:59.019 [pimatic-mysensors] debug:> 17:26:59.022 [pimatic-mysensors] debug: -> Sending 6;5;1;1;3;0 17:26:59.022 [pimatic-mysensors] debug:> 17:26:59.030 [pimatic-mysensors] debug: <- MySensorDimmer { sender: 4, sensor: 5, type: 3, value: '706' } 17:26:59.096 [pimatic] error: A uncaught exception occured: AssertionError: level <= 100 17:26:59.096 [pimatic] error:> at MySensorsDimmer.DimmerActuator._setDimlevel (/home/pi/pimatic-app/node_modules/pimatic/lib/devices.coffee:360:7) 17:26:59.096 [pimatic] error:> at MySensorsDimmer._setDimlevel (/home/pi/pimatic-app/node_modules/pimatic/lib/devices.coffee:1:1) 17:26:59.096 [pimatic] error:> at Board. (/home/pi/pimatic-app/node_modules/pimatic-mysensors/MySensors.coffee:1509:12) 17:26:59.096 [pimatic] error:> at emitOne (events.js:82:20) 17:26:59.096 [pimatic] error:> at Board.emit (events.js:169:7) 17:26:59.096 [pimatic] error:> at Board._rfsendtoboard (/home/pi/pimatic-app/node_modules/pimatic-mysensors/MySensors.coffee:335:8) 17:26:59.096 [pimatic] error:> at Board._rfReceived (/home/pi/pimatic-app/node_modules/pimatic-mysensors/MySensors.coffee:214:12) 17:26:59.096 [pimatic] error:> at SerialPortDriver. (/home/pi/pimatic-app/node_modules/pimatic-mysensors/MySensors.coffee:182:10) 17:26:59.096 [pimatic] error:> at emitOne (events.js:77:13) 17:26:59.096 [pimatic] error:> at SerialPortDriver.emit (events.js:169:7) 17:26:59.096 [pimatic] error:> at SerialPort. (/home/pi/pimatic-app/node_modules/pimatic-mysensors/serialport.coffee:44:10) 17:26:59.096 [pimatic] error:> at emitOne (events.js:77:13) 17:26:59.096 [pimatic] error:> at SerialPort.emit (events.js:169:7) 17:26:59.096 [pimatic] error:> at /home/pi/pimatic-app/node_modules/pimatic-mysensors/node_modules/serialport/parsers.js:25:17 17:26:59.096 [pimatic] error:> at Array.forEach (native) 17:26:59.096 [pimatic] error:> at Object.parser (/home/pi/pimatic-app/node_modules/pimatic-mysensors/node_modules/serialport/parsers.js:24:13) 17:26:59.096 [pimatic] error:> at Object.SerialPort.opts.dataCallback (/home/pi/pimatic-app/node_modules/pimatic-mysensors/node_modules/serialport/serialport.js:181:12) 17:26:59.096 [pimatic] error:> at SerialPortFactory.SerialPort._emitData (/home/pi/pimatic-app/node_modules/pimatic-mysensors/node_modules/serialport/serialport.js:396:20) 17:26:59.096 [pimatic] error:> at afterRead (/home/pi/pimatic-app/node_modules/pimatic-mysensors/node_modules/serialport/serialport.js:372:20) 17:26:59.096 [pimatic] error:> at /home/pi/pimatic-app/node_modules/pimatic-mysensors/node_modules/serialport/serialport.js:388:9 17:26:59.096 [pimatic] error:> at FSReqWrap.wrapper [as oncomplete] (fs.js:576:17) 17:26:59.096 [pimatic] error:> This is most probably a bug in pimatic or in a module, please report it! 17:26:59.103 [pimatic] warn: Keeping pimatic alive, but could be in an undefined state, please restart pimatic as soon as possible!

sweebee commented 6 years ago

fixed in next release