From 54bc9727418a37d3c4d791b607eafe0042938e20 Mon Sep 17 00:00:00 2001 From: Ingrimmsch93 Date: Mon, 4 Mar 2024 21:00:22 +0100 Subject: [PATCH 1/5] Update audi_models.py fixing remaining charging time --- custom_components/audiconnect/audi_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/audiconnect/audi_models.py b/custom_components/audiconnect/audi_models.py index 8304a379..6ccbb567 100644 --- a/custom_components/audiconnect/audi_models.py +++ b/custom_components/audiconnect/audi_models.py @@ -73,7 +73,7 @@ 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, "climatisationState", -1, ["climatisation", "auxiliaryHeatingStatus", "value", "climatisationState"]) From 38425da2ed20e20b425af8bc28ffceff919f8b48 Mon Sep 17 00:00:00 2001 From: Ingrimmsch93 Date: Mon, 4 Mar 2024 22:01:38 +0100 Subject: [PATCH 2/5] Update audi_models.py Added: plugLockState, externalPower, plugledColor --- custom_components/audiconnect/audi_models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/custom_components/audiconnect/audi_models.py b/custom_components/audiconnect/audi_models.py index 6ccbb567..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", "chargingStatus", "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"]) From 86c2608a0a73e304b6ebabd812579fd63b09aa9d Mon Sep 17 00:00:00 2001 From: Ingrimmsch93 Date: Mon, 4 Mar 2024 22:26:09 +0100 Subject: [PATCH 3/5] Update audi_connect_account.py Added plugLockState, externalPower, plugledColor --- .../audiconnect/audi_connect_account.py | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) 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: From a17ac9ba69a7b770c82cdd616a975a5929a994f4 Mon Sep 17 00:00:00 2001 From: Ingrimmsch93 Date: Mon, 4 Mar 2024 22:36:14 +0100 Subject: [PATCH 4/5] Update dashboard.py Added: plugLockState, externalPower, plugledColor --- custom_components/audiconnect/dashboard.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/custom_components/audiconnect/dashboard.py b/custom_components/audiconnect/dashboard.py index 789f4502..640e3211 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", From 8d68adf3900eeab22df1edb42ba2d98adaa6bf13 Mon Sep 17 00:00:00 2001 From: Ingrimmsch93 Date: Mon, 4 Mar 2024 23:10:27 +0100 Subject: [PATCH 5/5] Update dashboard.py fix: plug_led_color --- custom_components/audiconnect/dashboard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/audiconnect/dashboard.py b/custom_components/audiconnect/dashboard.py index 640e3211..cfbf2c4d 100644 --- a/custom_components/audiconnect/dashboard.py +++ b/custom_components/audiconnect/dashboard.py @@ -502,7 +502,7 @@ def create_instruments(): 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="plug_led_color", name="Plug LED Color", icon="mdi:power-plug", unit=None), Sensor( attr="doors_trunk_status", name="Doors/trunk state",