Skip to content

Commit 20bcb84

Browse files
authored
Set suggested display precision in modbus integration (home-assistant#155467)
1 parent bbb1d57 commit 20bcb84

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

homeassistant/components/modbus/sensor.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ def __init__(
8888
self._attr_device_class = entry.get(CONF_DEVICE_CLASS)
8989
if self._precision > 0 or self._scale != int(self._scale):
9090
self._value_is_int = False
91+
if self._precision > 0 and self._data_type not in ["string", "custom"]:
92+
self._attr_suggested_display_precision = self._precision
9193

9294
async def async_setup_slaves(
9395
self, hass: HomeAssistant, slave_count: int, entry: dict[str, Any]

0 commit comments

Comments
 (0)