diff --git a/custom_components/smarthashtag/binary_sensor.py b/custom_components/smarthashtag/binary_sensor.py index 5ae4ce2..bde3fc1 100644 --- a/custom_components/smarthashtag/binary_sensor.py +++ b/custom_components/smarthashtag/binary_sensor.py @@ -138,6 +138,14 @@ class SmartHashtagBinarySensorEntityDescription(BinarySensorEntityDescription): icon="mdi:car-back", is_on_fn=lambda state, key: state.safety.trunk_open_status == 1, ), + SmartHashtagBinarySensorEntityDescription( + key="is_charger_connected", + translation_key="is_charger_connected", + name="is charger connected", + device_class=BinarySensorDeviceClass.BATTERY_CHARGING, + icon="mdi:power-plug-battery", + is_on_fn=lambda state, key: state.battery.is_charger_connected, + ), ) diff --git a/custom_components/smarthashtag/sensor.py b/custom_components/smarthashtag/sensor.py index 4063ba2..1f89858 100644 --- a/custom_components/smarthashtag/sensor.py +++ b/custom_components/smarthashtag/sensor.py @@ -86,12 +86,6 @@ device_class=SensorDeviceClass.ENUM, entity_registry_enabled_default=False, ), - SensorEntityDescription( - key="is_charger_connected", - translation_key="is_charger_connected", - name="is charger connected", - icon="mdi:power-plug-battery", - ), SensorEntityDescription( key="charging_voltage", translation_key="charging_voltage", @@ -1104,6 +1098,8 @@ def native_unit_of_measurement(self) -> str: ) if "charging_status" in self.entity_description.key: return None + if "charger_connection_status" in self.entity_description.key: + return None if isinstance(data, ValueWithUnit): return data.unit