diff --git a/custom_components/victron/number.py b/custom_components/victron/number.py index ae20e60..a415174 100644 --- a/custom_components/victron/number.py +++ b/custom_components/victron/number.py @@ -71,7 +71,7 @@ async def async_setup_entry( key=register_name, name=register_name.replace("_", " "), slave=slave, - native_unit_of_measurement=registerInfo.unit, + native_unit_of_measurement=(registerInfo.unit if isinstance(registerInfo.unit, str) else None), mode=NumberMode.SLIDER if config_entry.options[CONF_USE_SLIDERS] else NumberMode.BOX, diff --git a/custom_components/victron/sensor.py b/custom_components/victron/sensor.py index 73c1944..45ad22a 100644 --- a/custom_components/victron/sensor.py +++ b/custom_components/victron/sensor.py @@ -74,7 +74,7 @@ async def async_setup_entry( description = VictronEntityDescription( key=register_name, name=register_name.replace("_", " "), - native_unit_of_measurement=registerInfo.unit, + native_unit_of_measurement=(registerInfo.unit if isinstance(registerInfo.unit, str) else None), state_class=registerInfo.determine_stateclass(), slave=slave, device_class=determine_victron_device_class(