audiconnect/audi_connect_ha

"External Power" reports value as "Unavailable"

Closed this issue · 1 comments

"External Power" sensor returns the val of "Unavailable". This leads the sensor to believe it is unavailable in Home Assistant.

2024-04-11 06:00:02.277 DEBUG (MainThread) [custom_components.audiconnect.audi_models] Found and appended state with timestamp: name=externalPower, tsoff=-1, loc=['charging', 'plugStatus', 'value', 'carCapturedTimestamp'], val=unavailable, ts=2024-04-10 22:48:14+00:00

This works but creates a duplicate entry. Need to figure out migration.

# audi_connect_account.py line 1530
    # Existing Logic
    @property
    def external_power(self):
        """Return external Power"""
        if self.external_power_supported:
            return self._vehicle.state.get("externalPower")

    # Updated
    @property
    def external_power(self):
        """Return True if external power is ready, otherwise False."""
        if self.external_power_supported:
            val = self._vehicle.state.get("externalPower")
            return val == "ready"
        return False

# dashboard.py line 566
        BinarySensor( # change to BinarySensor
            attr="external_power",
            name="External Power",
            icon="mdi:ev-station",
            device_class=BinarySensorDeviceClass.POWER, # add device_class
        ),