core icon indicating copy to clipboard operation
core copied to clipboard

Remove invalid watts sensor from NUT

Open tdfountain opened this issue 8 months ago • 5 comments

Proposed change

Remove the "watts" sensor since it is invalid. This appears like a breaking change, but is not actually a breaking change. NUT variables are based on RFC 9271 available at https://www.rfc-editor.org/info/rfc9271 with a complete list of num names at https://github.com/networkupstools/nut/blob/master/docs/nut-names.txt. These variables generally take the form of x.y. The variable name "watts" is not a valid variable name. The sensor is therefore invalid and cannot be used. This PR removes the sensor from sensor.py and the translation from strings.json. It is not listed in icons.json. There are no test cases that reference this invalid sensor.

Type of change

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

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:
  • Link to developer documentation pull request:
  • Link to frontend pull request:

Checklist

  • [X] The code change is tested and works locally.
  • [X] Local tests pass. Your PR cannot be merged unless tests pass
  • [X] There is no commented out code in this PR.
  • [X] I have followed the development checklist
  • [X] I have followed the perfect PR recommendations
  • [X] The code has been formatted using Ruff (ruff format 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.

To help with the load of incoming pull requests:

tdfountain avatar Mar 11 '25 02:03 tdfountain

Hey there @bdraco, @ollo69, @pestevez, mind taking a look at this pull request as it has been labeled with an integration (nut) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of nut can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign nut Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

home-assistant[bot] avatar Mar 11 '25 02:03 home-assistant[bot]

Looks like this was added in #55491

I agree based on above that it appears to be invalid. However it seems like the user who opened the PR was able to get it to work with their device so I'm not sure we should remove it.

bdraco avatar Mar 11 '25 04:03 bdraco

@wranglatang, I proposed at PR to remove the "watt" NUT variable as a separate sensor. Can you please shed light on whether you made this sensor work, and if so, how? Thanks for your help and contribution! We want to make sure not to remove functionality that users are dependent upon.

The NUT documentation does not list "watt" as a valid variable. The naming format is inconsistent with other NUT variables (which are generally x.y). Finally, I reviewed the NUT source code and I am unable find any instances of the "watt" variable from any device driver.

tdfountain avatar Mar 11 '25 05:03 tdfountain

Based on the information above, I can't see how this sensor could ever work. We haven't heard back from the original submitter though so I am going to give them a bit more time before merging

bdraco avatar Mar 21 '25 21:03 bdraco

Meanswhile, there is a merge conflict. Could you take a look @tdfountain?

Thanks! 👍

../Frenck

frenck avatar Mar 25 '25 08:03 frenck

Please see PR #141401. My apologies, I inadvertently closed the branch when committing the merge.

tdfountain avatar Mar 25 '25 18:03 tdfountain