Shubhamjain007 / openhab

Automatically exported from code.google.com/p/openhab
0 stars 0 forks source link

Incorrect default value showing up when State is Undefined #64

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
To reproduce the bug, restart openHAB and go to Main Menu -> Widget Overview. 
The slider widgets are set to "0", but it's used the default icon, instead of 
<icon>-0.png For example look at the Dimmer. Its icon is "slider", instead of 
"slider-0". The same is for the rollershutter.

Original issue reported on code.google.com by mishoboss on 20 Jan 2012 at 1:57

GoogleCodeExporter commented 8 years ago
The issue is that the status of the dimmer is simply undefined at startup. 
Therefore, the "slider" icon is the correct one as the status is unknown. It is 
rather a bug of your slider that it is put to the "0" position! But ok, there 
is no good option where else to put it, if the status is not known.

The simplest solution would probably be to add a initialization rule which sets 
the dimmer to some value at startup.

Original comment by kai.openhab on 20 Jan 2012 at 5:08

GoogleCodeExporter commented 8 years ago
I see. Sorry about this, I made my conclusions from the widget label and 
there's "0%".

Original comment by mishoboss on 20 Jan 2012 at 6:00

GoogleCodeExporter commented 8 years ago
You have got a point here - the label text is indeed not correct. It should 
rather say "? %" or "- %" or best, the value part should be completely left out 
from the label.

Thomas, as you have done this logic in ItemUIRegistryImpl.formatDefault(): May 
I ask you to have a look at this (for 0.9.1)?

Original comment by kai.openhab on 20 Jan 2012 at 11:19

GoogleCodeExporter commented 8 years ago
I would prefer to insert a "- %" as default value. If there is no label visible 
seems to be unexpected to me, isn't it?

Original comment by teichsta on 26 Jan 2012 at 3:39

GoogleCodeExporter commented 8 years ago
The suggestion is not to have no label, but to have no value part of the label 
(i.e. leaving out the part in [ ] ).
Technically this would be easier as we are using String formatters - and it is 
not straight forward to find the position where you would have to replace a 
part by a "-", especially after supporting complex type formatting!

Original comment by kai.openhab on 26 Jan 2012 at 3:43

GoogleCodeExporter commented 8 years ago
we are now showing "-" (dashes) in case of undefined values

Original comment by teichsta on 2 Feb 2012 at 2:32