wutu / pimatic-mqtt

MQTT plugin for Pimatic
https://pimatic.org/plugins/pimatic-mqtt/
GNU Affero General Public License v3.0
9 stars 13 forks source link

Dimmer percent set error #14

Closed capitalfuse closed 7 years ago

capitalfuse commented 8 years ago

Dear Sir, I appreciate for your effort on mqtt-plugin project. I noticed that an error occurs when published or subsclibed 100% value on percent mode.
Parts of error contents are followings; ---> error [pimatic]: A uncaught exception occured: AssertionError: level <= 100 at MqttDimmer.DimmerActuator._setDimlevel (/home/pi/pimatic-app/node_modules/pimatic/lib/devices.coffee:360:7) at MqttDimmer._setDimlevel (/home/pi/pimatic-app/node_modules/pimatic/lib/devices.coffee:1:1) at MqttClient. (/home/pi/pimatic-app/node_modules/pimatic-mqtt/devices/mqtt-dimmer.coffee:27:16) ............................ For solving this issue, I modified code like below. in devices/mqtt-dimmer.coffee; getPerCentlevel: (devlevel) -> perCentlevel = ((devlevel + 0.5 * 100) / @resolution).toFixed(0) changed to perCentlevel = ((devlevel * 100) / @resolution).toFixed(0)

0.5 has no means?

Regards, Takanobu Fuse

wutu commented 8 years ago

Hey, Thanks for your report. Looking at it as soon as possible.

wutu commented 7 years ago

Fix https://github.com/wutu/pimatic-mqtt/commit/a3d4f3e48b045c91de9b36adf0a1d2c263d97087

capitalfuse commented 7 years ago

Dear wutu, Thanks! I appreaiate for your much efforts on your busy schedule.

wutu commented 7 years ago

No problem. It would be faster, but I was on vacation.