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 sensor min_value only allows positive values #109981

Closed
schliflo opened this issue Feb 8, 2024 · 4 comments · Fixed by #109995
Closed

Modbus sensor min_value only allows positive values #109981

schliflo opened this issue Feb 8, 2024 · 4 comments · Fixed by #109995
Assignees

Comments

@schliflo
Copy link

schliflo commented Feb 8, 2024

The problem

With the 2024.2.0 update, i can no longer configure a negative min_value for modbus sensor entitties.
Example config that was working with 2024.1.6

What version of Home Assistant Core has the issue?

2024.2.0

What was the last working version of Home Assistant Core?

2024.1.6

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

modbus

Link to integration documentation on our website

https://www.home-assistant.io/integrations/modbus/#configuring-sensor-entities

Diagnostics information

No response

Example YAML snippet

name: "modbus_ovum"
type: tcp
host: 10.10.20.21
port: 502
delay: 2
message_wait_milliseconds: 0
timeout: 5
sensors:
  - name: "Wärmepumpe: PVWatch Leistung (PvWa #12378)"
    unique_id: ovum_PvWa_sensor12378
    address: 12378
    scan_interval: 15
    data_type: int32
    scale: 0.01
    precision: 2
    swap: word
    unit_of_measurement: "kW"
    input_type: holding
    min_value: -32768
    max_value: 32767
    slave: 247
    device_class: power

Anything in the logs that might be useful for us?

No response

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)

@supermario79
Copy link

supermario79 commented Feb 8, 2024

Hi there!
I believe the issue is broader, not only for min_value.
I have similar issue with "scale" in my modbus.yaml:

  - name: "Consumption"
    scan_interval: 1
    unit_of_measurement: "kW"
    slave: 100
    address: 817 
    scale: -0.001
    precision: 2
    device_class: "power"

before 2024.2.0 it worked as expected, now I get this:
Invalid config for 'modbus' at modbus.yaml, line 26: value must be at least 0 for dictionary value 'modbus->0->sensors->1->scale', got -0.001

I want my consumption to be displayed as negative, I have solars producing the energy in positive values, so it displays on the charts together in a logical way.

I can always change the scale to positive, and then create a sensor with value template in configuration.yaml... Is there any other way I can negate the modbus sensor value?

@janiversen
Copy link
Member

"scale" is different, and a PR have just been merged on dev.

@schliflo
Copy link
Author

schliflo commented Feb 9, 2024

Thank you for the immediate fix @janiversen - can confirm everything is working as inteneded agin 👍🎉

@github-actions github-actions bot locked and limited conversation to collaborators Mar 10, 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.

3 participants