1 """Update coordinator for IronOS Integration."""
3 from __future__
import annotations
5 from datetime
import timedelta
7 from typing
import TYPE_CHECKING
9 from aiogithubapi
import GitHubAPI, GitHubException, GitHubReleaseModel
10 from pynecil
import CommunicationError, DeviceInfoResponse, LiveDataResponse, Pynecil
16 from .const
import DOMAIN
18 _LOGGER = logging.getLogger(__name__)
25 """IronOS live data coordinator."""
27 device_info: DeviceInfoResponse
28 config_entry: ConfigEntry
30 def __init__(self, hass: HomeAssistant, device: Pynecil) ->
None:
31 """Initialize IronOS coordinator."""
36 update_interval=SCAN_INTERVAL,
41 """Fetch data from Device."""
48 return await self.
devicedevice.get_live_data()
50 except CommunicationError
as e:
55 """IronOS coordinator for retrieving update information from github."""
57 def __init__(self, hass: HomeAssistant, github: GitHubAPI) ->
None:
58 """Initialize IronOS coordinator."""
64 update_interval=SCAN_INTERVAL_GITHUB,
69 """Fetch data from Github."""
72 release = await self.
githubgithub.repos.releases.latest(
"Ralim/IronOS")
74 except GitHubException
as e:
76 "Failed to retrieve latest release data from Github"
GitHubReleaseModel _async_update_data(self)
None __init__(self, HomeAssistant hass, GitHubAPI github)
LiveDataResponse _async_update_data(self)
None __init__(self, HomeAssistant hass, Pynecil device)
DeviceInfo get_device_info(str coordinates, str name)