mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Dont cache available property in Teslemetry (#143380)
This commit is contained in:
parent
fa2ad54d90
commit
c52f73269e
@ -3,7 +3,6 @@
|
|||||||
from abc import abstractmethod
|
from abc import abstractmethod
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from propcache.api import cached_property
|
|
||||||
from tesla_fleet_api.const import Scope
|
from tesla_fleet_api.const import Scope
|
||||||
from tesla_fleet_api.teslemetry import EnergySite, Vehicle
|
from tesla_fleet_api.teslemetry import EnergySite, Vehicle
|
||||||
from teslemetry_stream import Signal
|
from teslemetry_stream import Signal
|
||||||
@ -285,7 +284,7 @@ class TeslemetryVehicleStreamEntity(TeslemetryRootEntity):
|
|||||||
"""Update the entity with the latest value from the stream."""
|
"""Update the entity with the latest value from the stream."""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
@cached_property
|
@property
|
||||||
def available(self) -> bool:
|
def available(self) -> bool:
|
||||||
"""Return True if entity is available."""
|
"""Return True if entity is available."""
|
||||||
return self.stream.connected
|
return self.stream.connected
|
||||||
|
@ -6,7 +6,6 @@ from collections.abc import Callable
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
from propcache.api import cached_property
|
|
||||||
from teslemetry_stream import TeslemetryStreamVehicle
|
from teslemetry_stream import TeslemetryStreamVehicle
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
@ -636,11 +635,6 @@ class TeslemetryStreamSensorEntity(TeslemetryVehicleStreamEntity, RestoreSensor)
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@cached_property
|
|
||||||
def available(self) -> bool:
|
|
||||||
"""Return True if entity is available."""
|
|
||||||
return self.stream.connected
|
|
||||||
|
|
||||||
def _async_value_from_stream(self, value: StateType) -> None:
|
def _async_value_from_stream(self, value: StateType) -> None:
|
||||||
"""Update the value of the entity."""
|
"""Update the value of the entity."""
|
||||||
self._attr_native_value = value
|
self._attr_native_value = value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user