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

Some fields for Device node gets empty after saving #1621

Open
guedini opened this issue Oct 1, 2024 · 7 comments
Open

Some fields for Device node gets empty after saving #1621

guedini opened this issue Oct 1, 2024 · 7 comments
Labels
bug Something isn't working node:device

Comments

@guedini
Copy link

guedini commented Oct 1, 2024

Describe the bug

When I create a device node, I fill all fields and everything is okay. But when I open it again trigger is empty. It works sometimes but sometimes it only displays "Running." and it stops working, so I need to restart flow (sometimes HA) to get it running again.

Trigger is empty when reopening device node screen.
image

To Reproduce

Create a device node filling all fields.
Save it and deploy the changes.
Reopen the created device node and trigger is empty.

Expected behavior

Keep the value filled when created

Screenshots

image

Example Flow

No response

Environment Information

Version: 0.72.4

Home Assistant instances: 2
Server: 8729b6fb.3f2178
Home Assistant version: 2024.9.3
Companion version: 4.1.0
Server: 99d99ef8.b2543
Home Assistant version: 2024.9.3
Companion version: 4.1.0

Node-RED version: 4.0.3
Docker: yes
Add-on: 18.1.1

Node.js version: v18.20.4 arm64 linux
OS: Linux 6.6.31-haos-raspi arm64

Additional context

No response

@KevinHurts
Copy link

KevinHurts commented Oct 4, 2024

I'm having the same issue but the flow seems to be working fine

@BrendanRomanDev
Copy link

BrendanRomanDev commented Oct 11, 2024

Thanks for reporting this issue! Here to +1 the problem. Thanks to any devs working on this! Will be a huge QOL enhancement when this bug is fixed.

Same. This behavior appears to be random. The fix is either to jump into and out of the node drawer until you can edit it, or refresh the page until it works.

image

The flows are unaffected and they work... I just can't see their configuration or edit them until many attempts later.

Here's what that same one above was supposed to show me. Took me a bunch of tries to get this screenshot:
image

@zachowj
Copy link
Owner

zachowj commented Oct 11, 2024

Are there any browser errors when the trigger fails to load?

@tangrasmus
Copy link

Same problem . running newest node red 4.0.5 and newest nod red .... websocket 0.74.1 on seperate server

@KevinHurts
Copy link

KevinHurts commented Oct 24, 2024

I was hoping that updating to 0.74.2 would also fix this issue but unfortunately it doesn't. I also had the issue when navigating directly to port 1880 so the fix for #1480 is probably not related.

image

Is there some debugging info I could send that would help in fixing this issue? I'm not seeing any errors in my web inspector console and I'm getting all 200's in my network tab.

@BrendanRomanDev
Copy link

BrendanRomanDev commented Nov 11, 2024

@zachowj Apologies for missing your earlier response - Thanks a ton for attention on this.

Note, I'm curerntly on version0.73.0, Node-Red is on version 4.0.3. Note, I do see user KevinHurts above is on 0.74.2 and still experiencing this bug.

image`

Are there any browser errors when the trigger fails to load?

None! Screeenshot below. Network tab is also clean.

The error visible in console screenshot here is unrelated. It happens upon first opening Node-Red. There are no drawer-triggered errors in console.

image

EDIT: I've just upgraded to 0.74.2 and no dice - same issue FWIW.

@BrendanRomanDev
Copy link

BrendanRomanDev commented Nov 11, 2024

@zachowj

Did a little bit of digging and believe I found the issue.

Line 610 here fails due to deviceId being falsey.

image _________________________________________

Here is the invocation of the method above, where rather than throw an error, an empty array is returned for the triggers. This is likely why we aren't seeing any errors in console or otherwise. Something must be going wrong here, or upstream from here.

image

It's curious that on 107 req?.homeAssistant uses optional chaining (assuming req may be undefined), but one line earlier on 106 it's req.query without optional chaining 🤷. Not the cause, but that made me wonder why.

See here, when trigger does not load, it's because there's no deviceID in the query string.

image

Compare this to when it does load.

image

So, for some reason there's a list of query params missing upon drawer open - or rather, the proper query including the query params doesn't fire on drawer open. Something probably needs to be awaited upstream that isn't, or there's some catch with the latest version of NODE-RED that needs to be accounted for. Looks like a race condition between drawer-open, and the request firing? Not 100% sure, but hope this helps!


FWIW great work with this plugin! As I was combing through gists I was super impressed with your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node:device
Projects
None yet
Development

No branches or pull requests

5 participants