I defined a group of rollershutters, set its state description to %.1f and set state-in-center to on. Now the group item’s state is shown as expected (e.g. 37.5, in Edit Item view), in Item list it’s shown as 37.500000000000, and between the arrow up/down-buttons its shown as 37.50000.
Is this a bug or intended? I would expect state description to influence rounding everywhere…
It’s intended on the Item’s list. The Item’s list shows the actual state of the Item without transformation or formatting.
I don’t know what you mean by “between the arrow up/down buttons”. Do you mean on the Item’s page still or do you mean on the individual Item’s page or on the Overview cards?
I created a page with all of my rollershutter groups as a list:
There I get e.g.
floor1: arrow_up ___ 45.7166588987205 ___ arrow_down
floor2: arrow_up ___ 48.00000 ___ arrow_down
floor3: arrow_up ___ 40.00000 ___ arrow_down
east: arrow_up ___ 26.6666666666666 (goes beyond phone screen)
While at Location → room1 I see:
rollershutter1: arrow_up ___ 80.0 ___ arrow_down
rollershutter2: arrow_up ___ 0 ___ arrow_down
All values are within the rollershutter “widget” (how is it called?) which consists of:
arrow_up stop_button arrow_down (where I replace stop_button by state with enabling state-in-center.
I hope this clarifies what I’m trying to do.
Why do I get anything: number with a lot of decimal places, number with 5 decimal places (each equal to zero), number with more than a dozen decimal places, zero without decimal places and number with one decimal place (zero)? I added state description: %.0f for all of the items.
Have you added a default list Item widget to these Items?
How did you configure the widgets on the page you created?
Note, when configuring a widget, the displayState is the formatted/transformed state of the Item but the state is the raw unmodified state of the Item.
By default the widgets generated on the Overview page cards will use the displayState by default. But for widgets you configure yourself, you have to choose to use the displayState.
I would expect that the displayState would be used with this configuration. Looking at the reference I don’t see anything that controls the way the state is shown so I don’t have any ideas why it’s different in one place from the other.
So, I have the FGR223_7_Blinds_Control of type Rollershutter, which is part of FGR223_7 of type Rollershutter, which is part of several groups, e.g. Storen_OG_Musik of type Group with Group Settings: Members Base Type: Rollershutter. Is this correct?
Does this Group Item have a State Description pattern?
This Item definitely doesn’t have a State Description pattern.
Without a state descrption pattern no formatting is going to be applied to the Item. Above you said you set the State Description but either don’t show that here or show that you have not set the pattern.
OK, I have introduced an error here during my tests: FGR223_7_Blinds_Control has to be of type Rollershutter, but not FGR223_7! Otherwise the blinds are not working if I send UP/DOWN to the group. FGR223_7 has to be of type Group, with Members Base Type: Rollershutter (and I also set Aggregation Function to AVG although there is only one element).
I also specified State Description = %.1f for Storen_OG_Musik and all three FGR223_X which are within this group, resulting in:
To be honest, for me this looks like a bug. Since it’s only relevant if you 1) set stateInCenter to true, and 2) use this for a group of rollershutter, it maybe never attracted attention? For single rollershutter its not a problem since state is always an integer.
A roller shutter carries a PercentType which never has a decimal place. I don’t think you can use AVG with a Group that has a Rollershutter base type. PercentType can’t have decimal places. I wonder is that’s causing problems.
Have you tried %d or even just %s for the State Description Pattern?
Well, the rollershutter items itself have integer values as states (0…100) and if you calculate the average, you get a double with decimal places. Actually what’s needed is just rounding to integers again, then the result is 0…100 again. But with State Description this doesn’t work. %d or %s don’t work either.
I assumed that groups of rollershutters, aggregated by AVG are exactly what is supposed to be used: my use case is to get some feedback about the positions of my rollershutters. What else could I use?
OK, in that case there is something wrong with your State Description Pattern or for some reason it’s not being used. %d means integer. If %d were applying there would be no decimal places shown. The State Description Pattern is not being used or is syntactically incorrect.
It really seems that within an oh-rollershutter-item StateDescription is ignored:
To isolate the behaviour I just created a testitem of type rollershutter with state description set to %.0f as well as a rule modtestitem which just does an send update of 3.3 to testitem. And oh-rollershutter-item shows the state as 3.3.
My last question for today:
What is this state description used for or rather how is it used and is it possible that oh-rollershutter-item bypasses it? Then I think this really is a bug and should be fixed, because as I stated earlier, for single rollershutter items it doesn’t matter (integer), but for groups of rollershutter items (average of integer = double) it would make sense to be considered.
Unlikely but it shouldn’t be possible to set a RollerShutter Item to 3.3 in the first place so A RollerShutter carries a state like Dimmer. Any value with a decimal should generate an error in the first place. Given that, %.0f as the State Description Pattern should be the same as %d and %s.
I think there is a bug here. Either the docs are wrong and RollerShutter Items no longer carry a PercentType but no one updated the display state for RollerShutter Items to account for that fact, or there is a bug in MainUI which does in fact ignore the State Description pattern for RollerShutters because it’s never had to before since the state used to be guaranteed to be an integer.