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

Modbus: Negative scale not allowed since introduction of HA standard number_validator #109957

Closed
aruijter opened this issue Feb 8, 2024 · 2 comments · Fixed by #109965
Closed
Assignees

Comments

@aruijter
Copy link

aruijter commented Feb 8, 2024

The problem

The update to 24.2.0 made the modus sensor stop working because of a negative scale in the configuration, which is no longer allowed. I use it for negating my sdm power output. Most probably this is caused by the move to the ha standard number validator

What version of Home Assistant Core has the issue?

core-24.2.0

What was the last working version of Home Assistant Core?

core-24.1.6

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Modbus

Link to integration documentation on our website

https://www.home-assistant.io/integrations/modbus/

Diagnostics information

No response

Example YAML snippet

modbus:
  - name: "modbus_sdm_sun"
    type: rtuovertcp
    host: 192.168.178.52
    port: 23
    sensors:
      - name: sun_sdm_power_l1
        scan_interval: 10
        address: 12
        slave: 1
        input_type: input
        precision: 0
        scale: -1
        data_type: float32
        device_class: power
        unit_of_measurement: W

Anything in the logs that might be useful for us?

2024-02-08 09:35:52.190 ERROR (MainThread) [homeassistant.config] Invalid config for 'modbus' at configuration.yaml, line 44: value must be at least 0 for dictionary value 'modbus->0->sensors->0->scale', got -1, please check the docs at https://www.home-assistant.io/integrations/modbus

Additional information

No response

@home-assistant
Copy link

home-assistant bot commented Feb 8, 2024

Hey there @janiversen, mind taking a look at this issue as it has been labeled with an integration (modbus) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of modbus can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign modbus Removes the current integration label and assignees on the issue, 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 issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


modbus documentation
modbus source
(message by IssueLinks)

@janiversen
Copy link
Member

I honestly never thought of "scale" as a way to negate a value, the intention of scale is as the name says to scale the value.

However your use case seems valid to me, and I will make a PR that allows a negative "scale".

@github-actions github-actions bot locked and limited conversation to collaborators Mar 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants