Considering a default pattern for string and number channels #3741
Comments
Any feedback ? |
Ok for me
|
makes sense |
I have done the changes for the Sonos binding but in fact almost all bindings should be fixed !. |
Finally I think the good approach was my PR #3262 that would define a default pattern whatever the channel (all bindings). I just have to adjust the test to be sure to add a default pattern only when expected. |
To be clear, here is my general proposal that will apply to all bindings and all UIs. Is it ok for you ? I ping @kaikreuzer as he was worried when I first tried to fix that. |
Hmmm, I'm a little undecided.... Pros:
Cons:
So I'm pretty confident this sounds like a good idea to do in the I'm not so sure though about the implications of doing it for all such items in the UI layer. For this, I don't have a complete enough picture on how people are using them currently, which use-cases will be broken and how common they are. |
As a reminder, it is possible to use "xxx []" as label in an item or sitemap file to not display the item value. |
I agree with @lolodomo that #3800 seems to be the wrong approach - it just adds "the obvious" and requires all binding authors to do so.
Don't you rather mean the
Maybe this would be the right moment to break the item file format and to introduce a separate "pattern" field (instead of encoding it within the label). We could then offer a item-file migration that would set the pattern to "", if no square brackets are in the label - this would make it take precedence over the value from |
If I correctly understand you, you are not adressing the original problem that is items created by Paper UI without pattern and linked to channel without default pattern. In this case, we would like a default display in particular for string and number channels. Regarding your proposal of change in DSL, we just have to keep a way to disable the display of the state, being possible now by using []. |
Why not? The
See @SJKA's concern (which I share) that this would mean that all existing item files will suddenly behave differently - where "My Label" so far did NOT show any state, users would now manually have to change it to "My Label []" in order to keep the status quo. |
If And I agree that "My Label" in item file should show the state using the pattern defined in the channel or the default pattern we will add if not defined in the channel. To disable the display of this value, the user could use "My Label []". |
By setting |
Ok @kaikreuzer, that should work. I am not sure that changing the DSL and implementing a kind of migration worth the effort. All users using DSL are more or less advanced users who know how to use the label. By updating |
But I agree that it would have been better to separate label and pattern for state since the beginning. |
Could the issue #2729 not be a problem for the change we imagined ? As it was explained we can have several StateDescriptionProvider and we don't know which one is returned. |
PR submitted for your review. |
All the string channels provided by the Sonos binding are defined without any pattern. As the result, the channel value is not displayed in UI if you use the auto-link mode of Paper UI and you forgot to define a label with pattern "%s" in your sitemap.
I propose to add a default pattern "%s" to these string channels.
@kgoderis @kaikreuzer : are you ok with that proposal ?
The text was updated successfully, but these errors were encountered: