-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add Z-Wave controller hard reset device action (certification req) #18216
Conversation
Looks good to me. As for the last error, the factory reset changes the home ID of the controller. I think this is why the device isn't being found anymore. |
Yeah that's a good point. I don't think we want the device to be the same so I was more just wondering about the experience. There may be a way to back out of that when you close the dialog, I'm just not sure how at the moment. That does give me an idea though.... 🤔 That may be related to the experience with the config entry where it needs to disconnect and reconnect, but really I just need to enable debug logs so I can see what's going on |
I added logic which works when it's not wrapped in the conditional but doesn't work within the conditional (how the code looks now). I feel like there is something obvious I must be missing... |
...els/config/integrations/integration-panels/zwave_js/dialog-zwave_js-hard-reset-controller.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Bram Kragten <[email protected]>
}) | ||
) { | ||
await hardResetController(this.hass, this.entry_id!); | ||
this._done = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Navigate to the devices page of the config entry here:
navigate(`/config/devices/dashboard?config_entry=${this.entry_id}`)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this works, but the downside is that it takes the user to potentially a new location instead of going back to where they were, which is, in my opinion better. But I am realizing part of the problem is that the history state will include the pop ups. So if I want to do this, I think I need to store the previous page from the history and then navigate to that when done. Does that sound right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I guess you aren't allowed to do that... 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I implemented it with your suggestion for now, but if there's another way that we can truly go back to the previous page, I think that would be the better option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the best user experience would be to navigate to the device page of the newly created device, but I'm not sure how the timing is, is the new device available immediately? Maybe hardResetController
could return the new device id or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK so I got it working but:
- If the user closes the dialog, the redirect doesn't happen. I think this could be solved by changing
hardResetController
to only return when the new device is available but I will have to do some testing. - I'm guessing the method I am using to track the device is inefficient. Might be solved by the solution for 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK so made the updates above. Now the only problem is that when I navigate to the new device page, it says the device doesn't exist until I refresh the page. Not sure if there's something else I can wait for to guarantee the device is available before redirecting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code the page should update when new devices are added... And a refresh should not be needed...
I also see that happening in my tests...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok so we can remove the refresh and log a bug for this maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have a quick repo for me for this?
...els/config/integrations/integration-panels/zwave_js/dialog-zwave_js-hard-reset-controller.ts
Outdated
Show resolved
Hide resolved
Is it worth using the word |
...els/config/integrations/integration-panels/zwave_js/dialog-zwave_js-hard-reset-controller.ts
Show resolved
Hide resolved
…log-zwave_js-hard-reset-controller.ts
It's a bit awkward that the "back" button goes back to the hard reset dialog atm. |
Proposed change
This PR adds a new device action for the controller to hard reset it which is a Z-Wave certification requirement. We want it to be hard to do to avoid accidental resets which is why there are multiple confirmations. There is an issue that we may need to resolve beforehand where the config entry drops and reloads but need opinions on that. Also is it weird that the device info underneath the dialog goes to
Device / service not found
? CC @MartinHjelmare @marcelveldt @AlCalzone - please review the copy and provide feedback.Upstream core changes are already merged.
Device action:
First warning:
Second warning:
In progress:
Complete:
Final device info page when you close the dialog:
Type of change
Additional information
Checklist
If user exposed functionality or configuration variables are added/changed: