mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Fix modbus climate precision configuration variable (#52651)
* Updated precision to follow the tenths, halves, whole notation used by other home assistant climate modules. Added the precision @property so that home assistant can handle this rounding in the frontend, rather than in the _async_read_register() method. * Fixed a pylinter error for periods in user-facing log messages, and updated `precision` defaults in components/modbus/__init__.py to be consistent with an error case, using `PRECISION_WHOLE`. * revert changes to `precision:` configuration variable instead, the climate `precision()` function will infer whether or not to display in whole or tenths. halves will be unsupported, which should be fine. * re-added missing line that was removed * revert change to use self._input_type instead of CALL_TYPE_REGISTER_HOLDING
This commit is contained in:
parent
c5556a091e
commit
ac39607ae9
@ -16,6 +16,8 @@ from homeassistant.const import (
|
||||
CONF_OFFSET,
|
||||
CONF_STRUCTURE,
|
||||
CONF_TEMPERATURE_UNIT,
|
||||
PRECISION_TENTHS,
|
||||
PRECISION_WHOLE,
|
||||
TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT,
|
||||
)
|
||||
@ -134,6 +136,11 @@ class ModbusThermostat(BasePlatform, RestoreEntity, ClimateEntity):
|
||||
"""Return the unit of measurement."""
|
||||
return TEMP_FAHRENHEIT if self._unit == "F" else TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def precision(self) -> float:
|
||||
"""Return the precision of the system."""
|
||||
return PRECISION_TENTHS if self._precision >= 1 else PRECISION_WHOLE
|
||||
|
||||
@property
|
||||
def min_temp(self):
|
||||
"""Return the minimum temperature."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user