diff --git a/custom_components/audiconnect/audi_connect_account.py b/custom_components/audiconnect/audi_connect_account.py index 904f6da6..82d83e34 100644 --- a/custom_components/audiconnect/audi_connect_account.py +++ b/custom_components/audiconnect/audi_connect_account.py @@ -655,6 +655,15 @@ async def update_vehicle_charger(self): self._vehicle.state["plugState"] = get_attr( result, "charger.status.plugStatusData.plugState.content" ) + self._vehicle.state["plugLockState"] = get_attr( + result, "charger.status.plugStatusData.plugLockState.content" + ) + self._vehicle.state["externalPower"] = get_attr( + result, "charger.status.plugStatusData.externalPower.content" + ) + self._vehicle.state["plugledColor"] = get_attr( + result, "charger.status.plugStatusData.plugledColor.content" + ) except TimeoutError: raise @@ -1379,6 +1388,42 @@ def plug_state_supported(self): if check: return True + @property + def plug_lock_state(self): + """Return plug lock state""" + if self.plug_lock_state_supported: + return self._vehicle.state.get("plugLockState") + + @property + def plug_lock_state_supported(self): + check = self._vehicle.state.get("plugLockState") + if check: + return True + + @property + def external_power(self): + """Return external Power""" + if self.external_power_supported: + return self._vehicle.state.get("externalPower") + + @property + def external_power_supported(self): + check = self._vehicle.state.get("externalPower") + if check: + return True + + @property + def plug_led_color(self): + """Return plug LED Color""" + if self.plug_led_color_supported: + return self._vehicle.state.get("plugledColor") + + @property + def plug_led_color_supported(self): + check = self._vehicle.state.get("plugledColor") + if check: + return True + @property def climatisation_state(self): if self.climatisation_state_supported: diff --git a/custom_components/audiconnect/audi_models.py b/custom_components/audiconnect/audi_models.py index 8304a379..ea6863e8 100644 --- a/custom_components/audiconnect/audi_models.py +++ b/custom_components/audiconnect/audi_models.py @@ -73,7 +73,10 @@ def __init__(self, data): self._tryAppendStateWithTs(data, "chargeMode", -1, ["charging", "chargingStatus", "value", "chargeMode"]) self._tryAppendStateWithTs(data, "chargingState", -1, ["charging", "chargingStatus", "value", "chargingState"]) self._tryAppendStateWithTs(data, "plugState", -1, ["charging", "plugStatus", "value", "plugConnectionState"]) - self._tryAppendStateWithTs(data, "remainingChargingTime", -1, ["charging", "plugStatus", "value", "remainingChargingTimeToComplete_min"]) + self._tryAppendStateWithTs(data, "remainingChargingTime", -1, ["charging", "chargingStatus", "value", "remainingChargingTimeToComplete_min"]) + self._tryAppendStateWithTs(data, "plugLockState", -1, ["charging", "plugStatus", "value", "plugLockState"]) + self._tryAppendStateWithTs(data, "externalPower", -1, ["charging", "plugStatus", "value", "externalPower"]) + self._tryAppendStateWithTs(data, "plugledColor", -1, ["charging", "plugStatus", "value", "ledColor"]) self._tryAppendStateWithTs(data, "climatisationState", -1, ["climatisation", "auxiliaryHeatingStatus", "value", "climatisationState"]) diff --git a/custom_components/audiconnect/dashboard.py b/custom_components/audiconnect/dashboard.py index 789f4502..cfbf2c4d 100644 --- a/custom_components/audiconnect/dashboard.py +++ b/custom_components/audiconnect/dashboard.py @@ -500,6 +500,9 @@ def create_instruments(): unit=None, ), Sensor(attr="plug_state", name="Plug state", icon="mdi:power-plug", unit=None), + Sensor(attr="plug_lock_state", name="Plug Lock state", icon="mdi:power-plug", unit=None), + Sensor(attr="external_power", name="External Power", icon="mdi:ev-station", unit=None), + Sensor(attr="plug_led_color", name="Plug LED Color", icon="mdi:power-plug", unit=None), Sensor( attr="doors_trunk_status", name="Doors/trunk state",