Skip to content

Commit 3bfaa73

Browse files
committed
fix backword competability issue: #407
1 parent b0fdfc8 commit 3bfaa73

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

custom_components/victron_mqtt/sensor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@
4141
MetricType.SPEED: SensorDeviceClass.SPEED,
4242
MetricType.LIQUID_VOLUME: SensorDeviceClass.VOLUME_STORAGE,
4343
MetricType.DURATION: SensorDeviceClass.DURATION,
44-
MetricType.IRRADIANCE: SensorDeviceClass.IRRADIANCE,
4544
MetricType.ENUM: SensorDeviceClass.ENUM,
45+
# IRRADIANCE added dynamically — older library versions (pre-2026.5.6) lack it,
46+
# and HA Docker images may ship with the older version pre-installed.
47+
**({MetricType.IRRADIANCE: SensorDeviceClass.IRRADIANCE} if hasattr(MetricType, "IRRADIANCE") else {}),
4648
}
4749

4850
METRIC_NATURE_TO_STATE_CLASS: dict[MetricNature, SensorStateClass] = {

0 commit comments

Comments
 (0)