Skip to content

Commit b4fd4e2

Browse files
committed
Added unknown sensor addresses in device "unknown"
1 parent 3d75358 commit b4fd4e2

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

custom_components/weishaupt_modbus/const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class FormatConstants:
4545
KENNLINIE = "Stg."
4646
TIME_MIN = UnitOfTime.MINUTES
4747
TIME_H = UnitOfTime.HOURS
48+
UNKNOWN = "?"
4849

4950

5051
FORMATS = FormatConstants()

custom_components/weishaupt_modbus/entities.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ def __init__(self, config_entry, modbus_item, modbus_api) -> None:
262262
| FORMATS.PERCENTAGE
263263
| FORMATS.TIME_H
264264
| FORMATS.TIME_MIN
265+
| FORMATS.UNKNOWN
265266
):
266267
self._attr_state_class = SensorStateClass.MEASUREMENT
267268

@@ -312,6 +313,8 @@ def translate_val(self, val):
312313
return self.calc_percentage(val)
313314
case FORMATS.STATUS:
314315
return self._modbus_item.getTextFromNumber(val)
316+
case FORMATS.UNKNOWN:
317+
return int(val)
315318
case _:
316319
return int(val) / self._divider
317320

custom_components/weishaupt_modbus/hpconst.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class DeviceConstants:
2222
HZ5 = "Heizkreis5"
2323
W2 = "2. Wärmeerzeuger"
2424
ST = "Statistik"
25+
UK = "Unknown"
2526

2627

2728
DEVICES = DeviceConstants()
@@ -453,5 +454,14 @@ class DeviceConstants:
453454
ModbusItem( 36702, "Elektr. Energie gestern", FORMATS.ENERGY, TYPES.SENSOR, DEVICES.ST, RANGE_ENERGY),
454455
ModbusItem( 36703, "Elektr. Energie Monat", FORMATS.ENERGY, TYPES.SENSOR, DEVICES.ST, RANGE_ENERGY),
455456
ModbusItem( 36704, "Elektr. Energie Jahr", FORMATS.ENERGY, TYPES.SENSOR, DEVICES.ST, RANGE_ENERGY),
457+
458+
ModbusItem( 31106, "Adr. 31106", FORMATS.UNKNOWN, TYPES.SENSOR, DEVICES.UK),
459+
ModbusItem( 33106, "Adr. 33106", FORMATS.UNKNOWN, TYPES.SENSOR, DEVICES.UK),
460+
ModbusItem( 33107, "Adr. 33107", FORMATS.UNKNOWN, TYPES.SENSOR, DEVICES.UK),
461+
ModbusItem( 33110, "Adr. 33110", FORMATS.UNKNOWN, TYPES.SENSOR, DEVICES.UK),
462+
ModbusItem( 33111, "Adr. 33111", FORMATS.UNKNOWN, TYPES.SENSOR, DEVICES.UK),
463+
ModbusItem( 36801, "Adr. 36801", FORMATS.UNKNOWN, TYPES.SENSOR, DEVICES.UK),
464+
465+
456466
] # noqa: E501
457467
# fmt: on

0 commit comments

Comments
 (0)