Correct number of registers to read for sensors for modbus (#98534)

This commit is contained in:
jan iversen 2023-08-18 10:48:57 +02:00 committed by Franck Nijhof
parent 1c7e3005aa
commit 88352b6ca1
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3

View File

@ -68,7 +68,7 @@ class ModbusRegisterSensor(BaseStructPlatform, RestoreSensor, SensorEntity):
"""Initialize the modbus register sensor."""
super().__init__(hub, entry)
if slave_count:
self._count = self._count * slave_count
self._count = self._count * (slave_count + 1)
self._coordinator: DataUpdateCoordinator[list[int] | None] | None = None
self._attr_native_unit_of_measurement = entry.get(CONF_UNIT_OF_MEASUREMENT)
self._attr_state_class = entry.get(CONF_STATE_CLASS)