Closed EliasGabrielsson closed 10 years ago
I will look at this
Pull request 1019 for this issue
could you please retest (with tomorrows build) and confirm?
I have tested the new binding from build #598. So far I stumble upon two minor issues.
Usecase The dimmed light according to config above is set to 93%. I want to INCREASE further to 100% by clicking the "up" arrow in the webgui which will send a INCREASE command. Error The set value goes out of scope (0-100) and throws an exception. The big question is how the tellstickbinding follow the "Binding" framework or if its wrong implemented. Should the binding automatic adjust the value to 100% or should the eventbus resend a new 100% command? @teichsta Any comment?
An identical problem exist on the lower half. Eg. I have the lamp set to 4% and try to decrease it which will throw the same error.
20:21:20.850 INFO o.o.b.t.i.TellstickController[:36]- Send INCREASE to TellstickDevice [deviceId=9, name=LIVINGROOM-floor, status=16, deviceType=1, data=242] time=0 conf TellstickBindingConfig [id=9, valueSelector=DimmingLevel, usageSelector=null, itemName=GF_Living_Floorlamp, resend=1]
20:21:20.850 ERROR o.o.b.t.i.TellstickBinding[:121]- Failed to send msg to TellstickBindingConfig [id=9, valueSelector=DimmingLevel, usageSelector=null, itemName=GF_Living_Floorlamp, resend=1]
java.lang.IllegalArgumentException: Value must be between 0 and 100
at org.openhab.core.library.types.PercentType.validateValue(PercentType.java:48)
at org.openhab.core.library.types.PercentType.<init>(PercentType.java:33)
at org.openhab.binding.tellstick.internal.TellstickController.increaseDecrease(TellstickController.java:87)
at org.openhab.binding.tellstick.internal.TellstickController.handleSendEvent(TellstickController.java:58)
at org.openhab.binding.tellstick.internal.TellstickBinding.internalReceiveCommand(TellstickBinding.java:119)
at org.openhab.core.binding.AbstractBinding.receiveCommand(AbstractBinding.java:96)
at org.openhab.core.events.AbstractEventSubscriber.handleEvent(AbstractEventSubscriber.java:42)
at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
...
Usecase I want to configure the light level with the down and up buttons in the web GUI. I have a dimmed device which got an "ON" state change to the eventbus. openHAB dosent know which level the device is on for sure due the wide nature of dimmer type to tellstick. BUT probably the dimmed device have a high dim level rather then a low.
Today's implementation When pushing the down button the value goes to 0. When pushing the up button values goes to 9. (0 + 9). The values start on zero in other word.
My new proposal To me its more natural to start on max and modify it from there due many dimmers will be on max when state is ON. Down button will start on 100 - 9 = 91. Up button will start on 100.
@teichsta, what is the best practise and design principles for openHAB?
Actually there should be a limit to avoid going above 100 or below 0, but I can see that the code expect increments of 10 (it only checks current level is below 100 before adding 10). I will fix the limit so it handles any increment and goes to 100 instead of 106.
The second issue would be nice with a comment on, I actually only use the dimmer on a phone where i have a slider instead of these increments.
I fixed the problem with 0-100 for PrecentType, but not sure if I can do anything with the other issue. The only thing I can see is to go to 100% if current dim value is 0, is this how it should behave ? I also find it weird that there is no shortcut to go to max.
Usecase I have an dimmer class device configured in telldus Center which I by the Web GUI wants to increase and decrease lightlevel on.
The dimmer works perfect if it is configured like a normal on / off switch in openHAB. Percentbased tuning in telldusCenter work also as intended.
Error: It looks like the binding cant handle the "increase" and "decrease" commands from openHab. I havent looked in to the architecture of openHAB though so I dont know how its works internally.
But what about "increase" / "decrease from last know openHAB percentage value and translate it to fixed values which will be send to the tellstick API ?
Configuration:
Items: