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

Auto update zwave_js device config files once a day #71850

Closed
wants to merge 13 commits into from

Conversation

raman325
Copy link
Contributor

@raman325 raman325 commented May 14, 2022

Proposed change

Sets a 24 hour interval check for config file updates, and if updates are found, they will be installed and a message will be logged

I also removed the WS API commands I added for this functionality since they will no longer be needed

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link

Hey there @home-assistant/z-wave, mind taking a look at this pull request as it has been labeled with an integration (zwave_js) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

homeassistant/components/zwave_js/update.py Outdated Show resolved Hide resolved
homeassistant/components/zwave_js/update.py Outdated Show resolved Hide resolved
tests/components/zwave_js/test_update.py Outdated Show resolved Hide resolved
homeassistant/components/zwave_js/update.py Outdated Show resolved Hide resolved
tests/components/zwave_js/conftest.py Outdated Show resolved Hide resolved
@raman325 raman325 changed the title Add device configs update entity to zwave_js Auto update zwave_js device config files once a day May 16, 2022
assert client.driver.controller
entry.async_on_unload(
async_track_time_interval(
hass, async_check_for_config_updates, timedelta(days=1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we check once when setting up the integration too?

@kpine
Copy link
Contributor

kpine commented May 17, 2022

This should be configurable so users can opt-out.

@MartinHjelmare
Copy link
Member

Please give an example why that's needed.

@kpine
Copy link
Contributor

kpine commented May 17, 2022

I don't think it's acceptable for HA to modify an external application, that I've installed myself, without my consent. Therefore I should have the option to disable it. My preference is to manage software updates manually, especially since I run a standalone installation of zwavejs2mqtt, which already provides this capability (with a method more compatible with my maintenance procedures). To re-iterate, I'd rather perform the updates on my own terms, rather than being forced to do so. Given HA's user base, I doubt I'm alone with this preference. I also don't trust the process to not break my installation, as it has in my personal experience (that's all supposedly fixed, but prove it first!).

I'll ask the contrasting question, what reason is there for not allowing this functionality to be disabled? I'm also curious how this has been tested, given there haven't been any available updates in almost 4 months. Have you considered all the risks? As I mentioned, in my experience it's a fragile and invasive process that needs more road time to prove its reliability. Not allowing the process to be disabled means it's impossible to recover and avoid any unexpected failure scenarios.

Adding a configuration option would be relatively trivial and satisfies both of our concerns. Enable it by default if you want.

I can provide much more if the above isn't enough.

@MartinHjelmare
Copy link
Member

I don't think we should add an option. Either we think it's safe and do it or we don't think it's safe and don't do it.

@raman325
Copy link
Contributor Author

raman325 commented May 17, 2022

third option is we go back to using an update entity... Users that want it to be automated can make it so, users that don't have the option to update.

@kpine
Copy link
Contributor

kpine commented May 17, 2022

It looks like the current method to update within docker just downloads a gzip file and extracts it. So it shouldn't be as bad as I remember then. However, this still requires the zwave-js installation to be configured properly with the external config directory.

@raman325
Copy link
Contributor Author

raman325 commented May 17, 2022

I'm also curious how this has been tested, given there haven't been any available updates in almost 4 months. Have you considered all the risks? As I mentioned, in my experience it's a fragile and invasive process that needs more road time to prove its reliability. Not allowing the process to be disabled means it's impossible to recover and avoid any unexpected failure scenarios.

Are you asking what testing we've done? The answer is none, I expect that if the driver offers this as a feature, that it's stable and doesn't need to be tested.

@kpine
Copy link
Contributor

kpine commented May 17, 2022

Just offering an alternative viewpoint, as usual. Hopefully my pessimism is proven wrong.

I hope this change means that the config update story is going to get some attention from Z-Wave JS and HA. The experience now is not good.

@raman325
Copy link
Contributor Author

I'll mirror what I said on Discord - there's not much we can do to improve the experience, we just have to decide whether it's manual (update entity) or automatic (no entity), and if it's automatic, whether it's configurable or not. If we do make it configurable I would suggest we still use an update entity then because we can use its auto update feature

@kpine
Copy link
Contributor

kpine commented May 17, 2022

I've probably convinced myself that an auto-update is not the end of the world. I do worry about edge cases though.

Expanding on my comments about the experience not being good, I am speaking to both about Z-Wave JS and HA, not just HA. The driver docs give us minimal guidance about what to do after an update.

Although the updated config gets loaded after the update, bugfixes and changes to device configuration generally require either a driver restart or re-interview of the changed devices to take effect.

As a normal user, if I see a log message about a config update, am I supposed to do something? According to those docs (which HA users should not need to read):

  • Do I need to restart the driver? Probably.
  • Do I need to re-interview the devices? Probably.
  • How do I know which devices are affected? I can't, unless I browse node-zwave-js Git history.
  • The updates may not impact any of my devices (the common case), but I don't know.

Since I (as the user) don't known what happened, I'll either ignore the updates, or have to re-interview all of my devices. That's not likely. If these required actions aren't taken, then no benefits are gained with the updates. Also, the message being in the HA logs probably means it'll be missed anyways. I guess if the main goal is to support new devices, it helps.

To make the best use of config file updates, there needs to more focused notifications about which devices are affected (limited by the driver here), or the driver needs to automatically take action. Nothing HA can do about in the meantime.

My point in highlighting this isn't to push back on this change, but rather to see it be improved. I would hate to see either this (or the update entity) get added, and then nothing else happen later.

@MartinHjelmare
Copy link
Member

I agree that it's not a good user experience if the user is required to interact with the device or interview it again after an automatic config update and we don't inform the user explicitly about what to do.

By keeping config updates synced with a specific zwave-js release it's at least possible currently for the user to read the release notes and search for device names that they own.

@raman325
Copy link
Contributor Author

Ok so should we close this for now and revisit it if/when we can provide more information to the user?

@MartinHjelmare
Copy link
Member

I'm leaning to that end, yes.

@raman325 raman325 closed this May 18, 2022
@github-actions github-actions bot locked and limited conversation to collaborators May 19, 2022
@raman325 raman325 deleted the update branch February 20, 2023 23:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants