[Basic UI] Element Type Default
for item of type Location
or "How to render a PointType
in a sitemap"
#6110
Comments
The default widget for a Location item is a text: |
Maybe the channel should have a pattern with %s. By the way, you show another problem because when you use a label with %s, the value is not correctly displayed. Maybe a problem with an unexpected character in the value that breaks the Basic UI code ? |
What do you mean exactly? I am afraid I did a mistake in the first post. My original sitemap contains
The result of a new test is not better. But I figured a pattern for the label which seems to work: demo.items:
|
So it could be solved bu adding the right pattern definition to all channels associated to a Location item ? |
In general, yes. But from my point of view we should reach an agreement on the "%s" pattern for And lets add some documentation about this specific pattern somewhere in the docs. |
You're right. There is a place where a default pattern is set if not defined. I did that for String and Number items if I correctly remember. We should add one for Location item. |
Here is where it is set: |
The PR that introduced these default patterns is #3822. |
Note that it could make sense to replace the "Default" element from a Text widget to a Mapview widget in case of a Location item ? |
I am not sure if we should define a global default pattern. I just want to make sure that we get a valid result for the pattern "%s". May both. Does every available UI support the I use the |
Ok, you're right, maybe not all UIs are already supporting mapview. So Default = Text looks reasonable. |
I found 7 OH2 bindings defining such channels. Only 3 of them are defining a pattern (air quality, sensebox and netatmo). Others are defining no pattern. |
I created PR #6123 to address the pattern. |
I think we could define the same default pattern for the bindings that have not set a pattern in their Location channels, the same way we already have for String and Number channels. |
Why not change the bindings to use the default system channel type for location instead? I guess I have spotted why we see a "0" for the pattern "%s". Have a look at these lines of code: We pass an array to the If we want to have a framework-wide default pattern for the Just as a side not: The |
In the code listed by @cweitkamp above we should fall back to the default pattern of the system channel in case the given pattern is
Nr 2 is my preference. Its the least surprising output to the user. wdyt? |
Sounds good. I prefer No. 2 as well.
I have to revoke this: as mentioned in #5901 (comment) there is no specific reason for the annotation in this case and we should either remove it or add it on interface level - |
I submitted a PR #6190. |
How does it work? Element Type
Default
for item of typeLocation
: "How to render aPointType
in a sitemap" for Basic UI. This is what I have set up.demo.items:
demo.sitemap:
What is working - the
Mapview
- but nothing else (state is 49.26,-123.19):The text was updated successfully, but these errors were encountered: