openhab-webui
openhab-webui copied to clipboard
Model tree stops showing childs of non-semantic group item if StateDescription metadata is added
The problem
I have a couple of items bound to the ZWave switches. They sit in the proper semantic location of my house. I created a non-semantic group to capture all lights in my house. The group has aggregation Group:Number:SUM
to show the count of lights that are ON (however, the issue is valid for other aggregations like AVG for temperatures etc.).
The main UI model tree is shown correctly (if I tick "show non-semantic").
However, if I add metadata, for example, StateDescription or Default List Item widget, then all child items disappear in the tree view. If I remove metadata, they are visible again. When children items are not visible, the relationship is still there, the group is updated accordingly, and only the tree view is affected.
This issue happens only for situation if the child Items are semantic ones, but the parent group is non-semantic. I tested out and that aggregation doesn't have any influence, so simply a plain Group item with any child items are sufficient to get this issue.
Expected behavior
Non-semantic group should show child items no matter what metadata is configured on non-semantic group Item.
Steps to reproduce
- Create items and corresponding group using textual form. Items should be semantic
Group gTempSum
Number TempItem1 (gTempSum) ["Point"]
Number TempItem2 (gTempSum) ["Point"]
- Go to the Model view and tick "Show non-semantic"
- Click on the
gTempSum
group item and add metadata, e.g.Default List Item Widget
and save it. - Notice that the Group item in the Model view stopped showing child items
- Remove the metadata from Group Item. Model view starts showing child items again.
Your environment
OH3.0.1 + Raspbian RPi4B
runtimeInfo:
version: 3.0.1
buildString: Release Build
locale: pl_PL
systemInfo:
configFolder: /etc/openhab
userdataFolder: /var/lib/openhab
logFolder: /var/log/openhab
javaVersion: 11.0.10
javaVendor: Azul Systems, Inc.
javaVendorVersion: Zulu11.45+27-CA
osName: Linux
osVersion: 5.10.11-v7l+
osArchitecture: arm
availableProcessors: 4
freeMemory: 82669320
totalMemory: 194904064
bindings:
- amazonechocontrol
- astro
- exec
- hpprinter
- http
- mqtt
- network
- ntp
- openweathermap
- robonect
- samsungtv
- spotify
- systeminfo
- zwave
clientInfo:
device:
ios: false
android: false
androidChrome: false
desktop: true
iphone: false
ipod: false
ipad: false
edge: false
ie: false
firefox: false
macos: true
windows: false
cordova: false
phonegap: false
electron: false
nwjs: false
webView: false
webview: false
standalone: false
os: macos
pixelRatio: 2
prefersColorScheme: dark
isSecureContext: true
locationbarVisible: true
menubarVisible: true
navigator:
cookieEnabled: true
deviceMemory: 8
hardwareConcurrency: 8
language: pl
languages:
- pl
- en-US
- en
onLine: true
platform: MacIntel
screen:
width: 1440
height: 900
colorDepth: 30
support:
touch: false
pointerEvents: true
observer: true
passiveListener: true
gestures: false
intersectionObserver: true
themeOptions:
dark: dark
filled: true
pageTransitionAnimation: default
bars: light
homeNavbar: default
homeBackground: default
expandableCardAnimation: default
userAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_1) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36
timestamp: 2021-02-23T15:34:18.019Z
Browser console
There are no errors in console. However I switched on Verbose output and captured as below for the steps: Add metadata and save it
app.js:37 Stop tracking states
app.js:32 SSE connection closed: http://openhab:8080/rest/events?topics=openhab/items/*/added,openhab/items/*/updated,openhab/items/*/removed, 0 open
app.js:32 []0: EventSourceonerror: ƒ ()onmessage: ƒ (e)arguments: (...)caller: (...)length: 1name: ""prototype: {constructor: ƒ}__proto__: ƒ ()[[FunctionLocation]]: app.js:32[[Scopes]]: Scopes[3]onopen: ƒ (e)readyState: 1url: "http://openhab:8080/rest/events?topics=openhab/items/*/added,openhab/items/*/updated,openhab/items/*/removed"withCredentials: false__proto__: EventSourcelength: 1__proto__: Array(0)
app.js:37 Proxy: need gTempSum
app.js:37 updateTrackingList: No connection id, not calling the API
app.js:37 Start tracking states
app.js:32 new SSE connection: http://openhab:8080/rest/events/states, 1 open
app.js:32 [EventSource]0: EventSourceonerror: ƒ ()onmessage: ƒ (e)onopen: ƒ (e)readyState: 1url: "http://openhab:8080/rest/events?topics=openhab/items/*/added,openhab/items/*/updated,openhab/items/*/removed"withCredentials: false__proto__: EventSourcelength: 1__proto__: Array(0)
app.js:37 Proxy: need gTempSum
app.js:37 updateTrackingList: No connection id, not calling the API
app.js:37 Setting initial tracking list: ["gTempSum"]
app.js:37 Start tracking states
app.js:37 Closing existing state tracker connection
app.js:32 SSE connection closed: http://openhab:8080/rest/events/states, 0 open
app.js:32 []0: EventSourceonerror: ƒ ()onmessage: ƒ (e)onopen: ƒ (e)readyState: 1url: "http://openhab:8080/rest/events?topics=openhab/items/*/added,openhab/items/*/updated,openhab/items/*/removed"withCredentials: false__proto__: EventSourcelength: 1__proto__: Array(0)
app.js:32 new SSE connection: http://openhab:8080/rest/events/states, 1 open
app.js:32 [EventSource]0: EventSourceonerror: ƒ ()onmessage: ƒ (e)onopen: ƒ (e)readyState: 1url: "http://openhab:8080/rest/events?topics=openhab/items/*/added,openhab/items/*/updated,openhab/items/*/removed"withCredentials: false__proto__: EventSourcelength: 1__proto__: Array(0)
app.js:37 Stop tracking states
app.js:32 SSE connection closed: http://openhab:8080/rest/events/states, 0 open
app.js:32 []0: EventSourceonerror: ƒ ()onmessage: ƒ (e)onopen: ƒ (e)readyState: 1url: "http://openhab:8080/rest/events?topics=openhab/items/*/added,openhab/items/*/updated,openhab/items/*/removed"withCredentials: false__proto__: EventSourcelength: 1__proto__: Array(0)
app.js:37 Proxy: need gTempSum
app.js:37 updateTrackingList: No connection id, not calling the API
app.js:32 new SSE connection: http://openhab:8080/rest/events?topics=openhab/items/*/added,openhab/items/*/updated,openhab/items/*/removed, 1 open
app.js:32 [EventSource]0: EventSourceonerror: ƒ ()onmessage: ƒ (e)onopen: ƒ (e)readyState: 1url: "http://openhab:8080/rest/events?topics=openhab/items/*/added,openhab/items/*/updated,openhab/items/*/removed"withCredentials: false__proto__: EventSourcelength: 1__proto__: Array(0)concat: ƒ concat()constructor: ƒ Array()copyWithin: ƒ copyWithin()entries: ƒ entries()every: ƒ every()fill: ƒ fill()filter: ƒ filter()find: ƒ find()findIndex: ƒ findIndex()flat: ƒ flat()flatMap: ƒ flatMap()forEach: ƒ forEach()includes: ƒ includes()indexOf: ƒ indexOf()join: ƒ join()keys: ƒ keys()lastIndexOf: ƒ lastIndexOf()length: 0map: ƒ map()pop: ƒ pop()push: ƒ push()reduce: ƒ reduce()reduceRight: ƒ reduceRight()reverse: ƒ reverse()shift: ƒ shift()slice: ƒ slice()some: ƒ some()sort: ƒ sort()splice: ƒ splice()toLocaleString: ƒ toLocaleString()toString: ƒ toString()unshift: ƒ unshift()values: ƒ values()Symbol(Symbol.iterator): ƒ values()Symbol(Symbol.unscopables): {copyWithin: true, entries: true, fill: true, find: true, findIndex: true, …}__proto__: Object
Browser network traffic
There are no fails in the network traffic. But I captured the request for getting list of items focused on the affected items.
Here is the response of that request when metadata is added to the group (child items not shown)
And here when metadata is removed from group (and child items are shown)
Additional information
I found out that this piece of code does this https://github.com/openhab/openhab-webui/blob/9013e74f6fe512c040a7a5281a3cdd3c49553bd1/bundles/org.openhab.ui/web/src/pages/settings/model/model.vue#L293-L301
In line 295 items without Metadata and Semantics are filtered out for non-semantic rootGroups
collection. Is that right ? I mean, missing semantics is just fine, but why metadata eliminates it ? Basically what I wanted to achieve is to define StateDescription metadata in order to correctly format group value - but this breaks the model view. The question is if it's a feature or bug.
Looks like the incriminating code is here: https://github.com/openhab/openhab-webui/blob/0501209c57787252d3dfab3867a7cc971b46ad0d/bundles/org.openhab.ui/web/src/pages/settings/model/model.vue#L374-L382 I'm not sure why this distinction is there.
I have the same problem with thermostat groups. Typically a thermostat need with google a group with metatdata. Adding the special required metadata eliminated the dispaly of the thermosta group.
Unsure if I have the same problem or if my problem has a different source (or if it explains the two different code findings above):
I have a group with metadata (group of type "Equipment->HVAC") and nested items. With "show non-semantic" activated, a given child item disappears as soon as I add a state description to the child item.
I believe issue could be even more generic. Its about popups and back buttons which result in termination of SSE connection for some reason. It is not recovered which makes UI blind to further changes of states. On server side this is found later as orphan SSE connections.
I just had a brief test on openHAB demo server.
-
First page loaded
-
Few steps back and forth
-
SSE connection is gone
Same issue here. Non-semantic group not visible in Model if State Description used. Very annoying bug.
Yup, me to. Had it on 3.2.0 stable, upgraded to todays 3.3.0 snapshot and has the same problem. Very annoying.
I am running into the same issue.
It becomes very annoying when building UI rules. The item picker in blocky or item based rule triggers/conditions use the model view to pick an item. There is no way to type the item name (except changing the yaml code, which is not always obvious). I had to remove the state descriptions from the items to define the rules, and add the state descriptions back afterwards.
@ghys probably identified the root cause, but I don't understand the code well enough to attempt a fix.
Looks like the incriminating code is here:
https://github.com/openhab/openhab-webui/blob/0501209c57787252d3dfab3867a7cc971b46ad0d/bundles/org.openhab.ui/web/src/pages/settings/model/model.vue#L374-L382
I'm not sure why this distinction is there.
I had to remove the state descriptions from the items to define the rules, and add the state descriptions back afterwards.
I think a simpler work around is to choose any random Item from the model. Then edit that field and the second time a flat view of all your Items, including the non-tagged Items) will be shown. I'm not sure why but the model view is only shown on that first time. Subsequent times a different Items list widget is shown.
I think a simpler work around is to choose any random Item from the model. Then edit that field and the second time a flat view of all your Items, including the non-tagged Items) will be shown.
@rkoshak Thank you for the nice work around. You always find these helpful little things. I still hope someone will be able to resolve the bug though.