-
-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #1890. This adds the `unit` metadata from openhab/openhab-core#3481 to the pre-defined metadata namespaces for UoM Items (Item type `Number:`) and provides a metadata edit page for it. Once openhab/openhab-core#3611 is merged, the Item create page will be adjusted to set the `unit` metadata to the system default on Item creation. -- Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
- Loading branch information
1 parent
388bedf
commit 0b55558
Showing
4 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
bundles/org.openhab.ui/web/src/assets/definitions/metadata/namespaces.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
bundles/org.openhab.ui/web/src/components/item/metadata/item-metadata-unit.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<template> | ||
<div> | ||
<f7-block-header> | ||
<b style="color: var(--f7-theme-color) !important;">WARNING: Changing the internal unit can corrupt your persisted data!</b> | ||
</f7-block-header> | ||
<f7-list> | ||
<f7-list-input | ||
label="Unit" | ||
name="value" | ||
ref="value" | ||
type="text" | ||
placeholder="leave empty to use system default" | ||
:value="metadata.value" | ||
@blur="(evt) => metadata.value = evt.target.value" /> | ||
</f7-list> | ||
<f7-block-footer class="param-description"> | ||
<small>All processed values are internally normalized to the specified <code>unit</code>. The normalized value is used to propagate the value to external integrations (e.g. persistence, REST API, WebSocket) so these values will always have the specified unit and scale. | ||
<br> | ||
Changing the <code>unit</code> will change the values that these systems receive. | ||
<br> | ||
<br> | ||
Additionally the <code>unit</code> will be used in UIs if no unit is specified for the state description. The state description is used for display purpose only, it can contain any compatible unit and will not affect the internal <code>unit</code>. | ||
</small> | ||
</f7-block-footer> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
props: ['itemName', 'metadata', 'namespace'] | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters