Skip to content
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

[WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn’t exist: undefined #2956

Closed
mstormi opened this issue Dec 30, 2024 · 6 comments · Fixed by #2965
Labels
enhancement New feature or request main ui Main UI

Comments

@mstormi
Copy link

mstormi commented Dec 30, 2024

This is a fairly frequently occuring warning, and often the origin/cause is not apparent

Trouble then is, it's hard to find out what is the item and which widget is it used in.

Please make that information part of the error message to help with debugging.

@mstormi mstormi added enhancement New feature or request main ui Main UI labels Dec 30, 2024
@rkoshak
Copy link

rkoshak commented Dec 30, 2024

Unfortunately, I don't think that information is available to the server. All the server knows is something froim MainUI requested the state of an Item named undefined through the SSE.

The code in question is at https://github.com/openhab/openhab-core/blob/1a91ef2b4427efda49c9f46d3658a751869ceced/bundles/org.openhab.core.io.rest.sse/src/main/java/org/openhab/core/io/rest/sse/internal/SseItemStatesEventBuilder.java#L84

All that has access to is the list of names of the Items MainUI has subscribed for events from. So to change that log and to make more information available there to add to the error log changes will need to be made to openhab-core first.

@stefan-hoehn
Copy link
Contributor

so, @rkoshak, do you think the root cause is an issue in the Main UI (IMHO it is)?

@rkoshak
Copy link

rkoshak commented Dec 31, 2024

The root cause is it's really hard to tell where this error is coming from as an end user. But if there can be a way to make the error more informative, it's going to involve changes to both MainUI and core to address it.

I'm not certain it can be addressed but I'm no expert.

MainUI could make tracking it down easier on its own perhaps if it somehow logged to the browser console when an Item comes up undefined as the result of an expression and maybe give the name or location of the widget with the expression. Even just logging the expression could be enough of a clue to help track it down.

florian-h05 added a commit to florian-h05/openhab-webui that referenced this issue Jan 1, 2025
Fixes openhab#2956.
This however imposes the limitation that one cannot name an Item `undefined`.

Signed-off-by: Florian Hotze <[email protected]>
@florian-h05
Copy link
Contributor

This issue can be fixed by making the UI not request the Item state if the Item name comes up as undefined, see #2965.
This is the only way of fixing this that came to my mind, but this fix unfortunately imposes the limitation that state tracking will not work for an Item named undefined.
IMHO this limitation is very minor, I don't think one is going to name an Item undefined. WDYT?

@mstormi
Copy link
Author

mstormi commented Jan 1, 2025

that limitation for sure is minor, but will this help with tracking down UI definition errors, i.e. which widget uses a wrong item name?
that was my intention here ...

@florian-h05
Copy link
Contributor

No, this won’t help with that, but there is no reliable way to track down the faulting expression, so this is the best solution IMHO.
Function.caller is no part of the standard anymore so we shouldn’t use it.

The user will see a - in that case, and in most cases it might not even be a real issue, e.g. for some custom widgets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request main ui Main UI
Projects
None yet
4 participants