1 """Airgradient Update platform."""
3 from datetime
import timedelta
5 from propcache
import cached_property
11 from .
import AirGradientConfigEntry, AirGradientCoordinator
12 from .entity
import AirGradientEntity
19 config_entry: AirGradientConfigEntry,
20 async_add_entities: AddEntitiesCallback,
22 """Set up Airgradient update platform."""
24 coordinator = config_entry.runtime_data
30 """Representation of Airgradient Update."""
32 _attr_device_class = UpdateDeviceClass.FIRMWARE
34 def __init__(self, coordinator: AirGradientCoordinator) ->
None:
35 """Initialize the entity."""
41 """Return True because we need to poll the latest version."""
46 """Return the installed version of the entity."""
47 return self.coordinator.data.measures.firmware_version
50 """Update the entity."""
52 await self.coordinator.client.get_latest_firmware_version(
53 self.coordinator.serial_number
None __init__(self, AirGradientCoordinator coordinator)
None async_setup_entry(HomeAssistant hass, AirGradientConfigEntry config_entry, AddEntitiesCallback async_add_entities)