-
-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set unit metadata & state description pattern when creating UoM Item #2126
Conversation
This ensures that the internal unit is fixed, so that in case the system unit changes (measurement system change) persistence data does not get corrupted. Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
This was actually discussed somewhere, but I cannot find this discussion now. |
Job #1218: Bundle Size — 15.8MiB (+0.23%).Warning Bundle contains 16 duplicate packages – View duplicate packages Warning Bundle introduced 13 new packages: @jsep-plugin/regex, @jsep-plugin/arrow, @jsep-plugin/object and 10 more – View changed packages Bundle metrics
Bundle size by type
View job #1218 report View florian-h05:item-fix-unit branch activity |
This has been discussed several times. I'm not sure if fixing the unit is a good idea, while I agree that fixing the dimension is. The difference is: if you create an item, you have an idea what you want to use it for. This fixes the dimension, but not necessarily the unit. IMO the unit should be editable, but there should be a warning that this might be a bad idea when persistence is involved. |
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
The unit metadata is still editable through metadata edit, where a big orange warning is shown that this can corrupt persisted data. This PR only sets the unit metadata to the system default when creating an Item, so that there is unit metadata. This is how it looks when creating an Item: And this is how it looks when you want to change unit metadata later: |
Does it make sense to merge this with #2108? Those are other places where Items are created and giving the users the option to set the unit before the Item is created right there in those respective forms (i.e. Model and add equipment to model) seems like more of the same as what's being implemented here. |
I'm sorry to say it, but this description is absolutely preposterous; it's 4 lines long which is probably 2 too many and seriously:
You couldn't be as cryptic and obscure if you tried. |
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
How about: "Used internally, for persistence and external systems. It is independent from the state visualization in the GUI which is defined through the state description". |
This comment was marked as duplicate.
This comment was marked as duplicate.
…ems from Thing" functionality Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Those fields were displayed on both pages, but not pre-filled. I have fixed this.
Thanks for the suggestion! |
@J-N-K @spacemanspiff2007 @rkoshak: |
Based on my understanding the unit can be set by the end user in all the places and ways an Item can be created in MainUI so I'm happy to merge it. |
@ghys Can you please review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep sorry I had this one on the backburner for some time.
Let's say I'm not happy with the added complexity but I'm happy with the solution and implementation.
A big thank you for the work involved!
Addresses openhab#2126 (review). Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Addresses #2126 (review). Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
Related to openhab/openhab-core#3481.
Closes #2108.
Ensures that the internal unit is set when an Item is created, so that in case the system unit changes (i.e. measurement system changes) persisted data does not get corrupted.
By default, the unit metadata is set to the system default unit, however the user can easily change that on Item creation.
The unit can also be changed later as it is just normal metadata, however this can corrupt persisted data.
Adds the ability to set state description pattern when creating a UoM Item.
Shows the group type for groups, e.g.
Group (Number:Temperature)
instead of just the Item type.This applies to both the Items and the model page.