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

MQTT Number Entity Native Unit Comparison Error #135619

Open
aneisch opened this issue Jan 14, 2025 · 3 comments
Open

MQTT Number Entity Native Unit Comparison Error #135619

aneisch opened this issue Jan 14, 2025 · 3 comments

Comments

@aneisch
Copy link
Contributor

aneisch commented Jan 14, 2025

The problem

I have a number entity being created by an external device via MQTT Discovery:

command_topic: tesla_ble/climate-set-temp
state_topic: tesla_ble/number/driver_temp_setting
device:
  identifiers:
    - tesla_ble
  manufacturer: tesla-local-control
  model: Tesla_BLE
  sw_version: 0.4.1a-dev
  name: Tesla_BLE
icon: mdi:thermometer
device_class: temperature
unit_of_measurement: °C
qos: '1'
unique_id: tesla_ble_climate-set-temp
min: '15'
mode: slider
max: '28'
name: Climate Temp

The external device is publishing a temperature state:
tesla_ble/number/driver_temp_setting 24.5

My instance is set to use US Customary units vs. this device providing values in Metric. It appears that the number validation is currently done: raw value vs. native min/max instead of native value vs. native min/max leading to the error below. In this case I would expect 24.5 to be a valid state that HA would then convert to native units for frontend display.

2025-01-14 10:57:39.590 ERROR (MainThread) [homeassistant.components.mqtt.number] Invalid value for number.tesla_ble_climate_temp: 24.5 (range 59.0 - 82.4)

What version of Home Assistant Core has the issue?

2025.1.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

MQTT Number

Link to integration documentation on our website

https://www.home-assistant.io/integrations/number.mqtt/

Diagnostics information

No response

Example YAML snippet

Anything in the logs that might be useful for us?

Additional information

No response

@home-assistant
Copy link

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

Code owner commands

Code owners of mqtt 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 mqtt 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)


mqtt documentation
mqtt source
(message by IssueLinks)

@jbouwh
Copy link
Contributor

jbouwh commented Jan 14, 2025

You are right. The comparison should be with native_min_value and native_max_value instead.

@jbouwh
Copy link
Contributor

jbouwh commented Jan 14, 2025

The linked PR should fix the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants