Fix wall connector states in Teslemetry (#144855)

* Fix wall connector

* Update snapshot
This commit is contained in:
Brett Adams 2025-05-14 16:08:24 +10:00 committed by GitHub
parent 9aa2664188
commit d2a692393f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View File

@ -9,6 +9,7 @@ from tesla_fleet_api.teslemetry import EnergySite, Vehicle
from homeassistant.exceptions import ServiceValidationError
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import StateType
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN
@ -228,7 +229,7 @@ class TeslemetryWallConnectorEntity(TeslemetryPollingEntity):
super().__init__(data.live_coordinator, key)
@property
def _value(self) -> int:
def _value(self) -> StateType:
"""Return a specific wall connector value from coordinator data."""
return (
self.coordinator.data.get("wall_connectors", {})

View File

@ -1785,8 +1785,7 @@ class TeslemetryWallConnectorSensorEntity(TeslemetryWallConnectorEntity, SensorE
def _async_update_attrs(self) -> None:
"""Update the attributes of the sensor."""
if self.exists:
self._attr_native_value = self.entity_description.value_fn(self._value)
self._attr_native_value = self.entity_description.value_fn(self._value)
class TeslemetryEnergyInfoSensorEntity(TeslemetryEnergyInfoEntity, SensorEntity):

View File

@ -4978,7 +4978,7 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
'state': 'disconnected',
})
# ---
# name: test_sensors[sensor.wall_connector_vehicle-statealt]
@ -4991,7 +4991,7 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
'state': 'disconnected',
})
# ---
# name: test_sensors[sensor.wall_connector_vehicle_2-entry]
@ -5038,7 +5038,7 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
'state': 'disconnected',
})
# ---
# name: test_sensors[sensor.wall_connector_vehicle_2-statealt]
@ -5051,7 +5051,7 @@
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'unknown',
'state': 'disconnected',
})
# ---
# name: test_sensors_streaming[sensor.test_battery_level-state]