[Solved] OH3 New UI not displaying item states

I’m hoping this is just something stupid I’ve missed, but I haven’t been able to find it yet.

I have started with OH3 and I’m trying to get a single ESP8266 device running Tasmota setup. Sounds simple enough, but I can’t for the life of me get the item states to appear in the UI on the item’s page or on the UI Pages.

I am using text files, but I also tried creating all things and items through the UI and got the same results.

System

  • x64 Intel Desktop
  • Docker image openhab/openhab:3.0.0-snapshot
  • Tried with build 2005 and 2006

Items

If I look in the Items page I can see the state just fine

but if I open the item I can’t see the state

Pages

I get the same lack of state in the Pages UI as I see in the Item’s page
image

Widget YAML
- component: oh-label-card
  config:
    title: Viv Online
    item: equipment_viv_lights_online

Rest

If I pull the item description from the REST API I get results that I would expect

Text file Item JSON
{
  "link": "http://OH3HOST/rest/items/equipment_viv_lights_online",
  "state": "ON",
  "editable": false,
  "type": "Switch",
  "name": "equipment_viv_lights_online",
  "label": "Viv MagicHome Online",
  "tags": [
    "Status"
  ],
  "groupNames": [
    "equipment_viv_lights"
  ]
}

Side note: I get additional stateDescription information from an identical item created via the UI. Why don’t I get that from the text defined item? Neither of them have stateDescription metadata, so where is that coming from? If it comes from the channel then shouldn’t both get it since they are linked to the same channel?

UI Created Item JSON
{
  "link": "http://OH3HOST/rest/items/test",
  "state": "ON",
  "stateDescription": {
    "pattern": "%s",
    "readOnly": true,
    "options": []
  },
  "editable": true,
  "type": "Switch",
  "name": "test",
  "label": "test",
  "category": "",
  "tags": [
    "Status"
  ],
  "groupNames": [
    "equipment_viv_lights"
  ]
}
1 Like

Please open the developer tools of your browser, go to Console and activate the Debug/Verbose log level, and copy what you have.

To enable the debug logs, in Chrome/Chromium and derivatives, open the last dropdown and check “Verbose”:
image

In Firefox and derivatives, click on the “Debug” button:
image

Thank you again Yannick! It would appear to be because I have restauth enabled. It is getting 401 responses from the SSE connection.

I am currently logged in to the new UI as an admin user.

app.js:27 Initializing state tracking store proxy
app.js:27 Start tracking states
app.js:22 new SSE connection: http://alfred:8083/rest/events/states, 1 open
app.js:22 [EventSource]
:8083/rest/events/states:1 GET http://alfred:8083/rest/events/states net::ERR_ABORTED 401 (Unauthorized)
app.js:22 SSE error
app.js:22 EventSource {url: "http://alfred:8083/rest/events/states", withCredentials: false, readyState: 2, onopen: ƒ, onmessage: ƒ, …}
app.js:22 =!= Event source connection broken...
app.js:27 Proxy: need viv_light_red
app.js:27 updateTrackingList: No connection id, not calling the API
app.js:27 Proxy: need test
app.js:27 updateTrackingList: No connection id, not calling the API
app.js:27 Proxy: need equipment_viv_lights_online
app.js:27 updateTrackingList: No connection id, not calling the API

Actually, the issue is the Implicit user role for unauthenticated requests option. I had disabled it as it seems like the more secure option, but it seems it breaks the new UI’s ability to connect to the REST API as well.

Should I open a GH issue or are you already looking into it?

Yes this option is experimental and could break things currently. It shouldn’t be used except in very special circumstances!
The (long-standing) issue is that there’s no option to pass headers when opening a EventSource:

But I know about the problem, there’s a polyfill library that could be used to add support - I have used it in HABot actually.

Well that was an interesting read. I understand the discussion but I have just about no experience with coding browser/web stuff, so I’m afraid I can’t be of much help implementing anything.

Let me know if you need someone to test any potention solutions though.

Also, don’t count me as someone needing that option. Currently my OH3 is only accessible locally, but when it becomes more production ready it will go behind NGINX like my production OH2. Once there it will have BasicAuth provided by NGINX, so it becomes moot for OH3 to prevent access for unauthorized users.

Will be come this fix in one of the next versions?

I have the same issue with my OH3.
The Implicit user role for unauthenticated requests option is activated but still the same Error.
How can I fix this? Or will there be a fix in the near future?

Any news with this? I have the same problem apparently and I don’t know how to solve it. My api security configuration is like this:

1 Like

Hello All,

I have similar issue with publishing my OH3 behind reverse Nginx proxy. Is there any plan for fix? Or any workaround? For me the states aren’t displayed no mather the Implicit User Role is checked or not.

Thx

Y