1 parent 3a73fca commit a1b56c6Copy full SHA for a1b56c6
1 file changed
custom_components/victron_mqtt/number.py
@@ -89,6 +89,11 @@ def __init__(
89
self._attr_device_class = METRIC_TYPE_TO_DEVICE_CLASS.get(metric.metric_type)
90
if self._attr_device_class is not None:
91
self._attr_native_unit_of_measurement = metric.unit_of_measurement
92
+ elif metric.metric_type == MetricType.DYNAMIC:
93
+ # Dynamic units come from user-configured MQTT topics (e.g.
94
+ # SwitchableOutput Settings/Unit) and have no translation file
95
+ # entry, so we must set the unit programmatically.
96
+ self._attr_native_unit_of_measurement = metric.unit_of_measurement
97
self._attr_native_value = metric.value
98
if metric.min_value is not None:
99
self._attr_native_min_value = metric.min_value
0 commit comments