Whrilpool add periodic update (#97222)

This commit is contained in:
mkmer 2023-07-25 16:23:31 -04:00 committed by GitHub
parent 234715a8c6
commit c6f21b47a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View file

@ -70,6 +70,7 @@ ICON_D = "mdi:tumble-dryer"
ICON_W = "mdi:washing-machine"
_LOGGER = logging.getLogger(__name__)
SCAN_INTERVAL = timedelta(minutes=5)
def washer_state(washer: WasherDryer) -> str | None:
@ -228,7 +229,7 @@ class WasherDryerClass(SensorEntity):
class WasherDryerTimeClass(RestoreSensor):
"""A timestamp class for the whirlpool/maytag washer account."""
_attr_should_poll = False
_attr_should_poll = True
_attr_has_entity_name = True
def __init__(
@ -272,6 +273,10 @@ class WasherDryerTimeClass(RestoreSensor):
"""Return True if entity is available."""
return self._wd.get_online()
async def async_update(self) -> None:
"""Update status of Whirlpool."""
await self._wd.fetch_data()
@callback
def update_from_latest_data(self) -> None:
"""Calculate the time stamp for completion."""