* rebase * Minor patch to fix duplicate DeviceInfo beign created - if data hasnt updated yet * rebase * Minor patch to fix duplicate DeviceInfo beign created - if data hasnt updated yet * fixing formatting * Update homeassistant/components/intellifire/__init__.py Co-authored-by: Erik Montnemery <erik@montnemery.com> * Update homeassistant/components/intellifire/__init__.py Co-authored-by: Erik Montnemery <erik@montnemery.com> * Removing cloud connectivity sensor - leaving local one in * Renaming class to something more useful * addressing pr * Update homeassistant/components/intellifire/__init__.py Co-authored-by: Erik Montnemery <erik@montnemery.com> * add ruff exception * Fix test annotations * remove access to private variable * Bumping to 4.1.9 instead of 4.1.5 * A renaming * rename * Updated testing * Update __init__.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * updateing styrings * Update tests/components/intellifire/conftest.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Testing refactor - WIP * everything is passing - cleanup still needed * cleaning up comments * update pr * unrename * Update homeassistant/components/intellifire/coordinator.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * fixing sentence * fixed fixture and removed error codes * reverted a bad change * fixing strings.json * revert renaming * fix * typing inother pr * adding extra tests - one has a really dumb name * using a real value * added a migration in * Update homeassistant/components/intellifire/config_flow.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * Update tests/components/intellifire/test_init.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * cleanup continues * addressing pr * switch back to debug * Update tests/components/intellifire/conftest.py Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com> * some changes * restore property mock cuase didnt work otherwise * cleanup has begun * removed extra text * addressing pr stuff * fixed reauth --------- Co-authored-by: Erik Montnemery <erik@montnemery.com> Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
59 lines
1.8 KiB
Python
59 lines
1.8 KiB
Python
"""The IntelliFire integration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import timedelta
|
|
|
|
from intellifire4py import UnifiedFireplace
|
|
from intellifire4py.control import IntelliFireController
|
|
from intellifire4py.model import IntelliFirePollData
|
|
from intellifire4py.read import IntelliFireDataProvider
|
|
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.helpers.device_registry import DeviceInfo
|
|
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
|
|
|
from .const import DOMAIN, LOGGER
|
|
|
|
|
|
class IntellifireDataUpdateCoordinator(DataUpdateCoordinator[IntelliFirePollData]):
|
|
"""Class to manage the polling of the fireplace API."""
|
|
|
|
def __init__(
|
|
self,
|
|
hass: HomeAssistant,
|
|
fireplace: UnifiedFireplace,
|
|
) -> None:
|
|
"""Initialize the Coordinator."""
|
|
super().__init__(
|
|
hass,
|
|
LOGGER,
|
|
name=DOMAIN,
|
|
update_interval=timedelta(seconds=15),
|
|
)
|
|
|
|
self.fireplace = fireplace
|
|
|
|
@property
|
|
def read_api(self) -> IntelliFireDataProvider:
|
|
"""Return the Status API pointer."""
|
|
return self.fireplace.read_api
|
|
|
|
@property
|
|
def control_api(self) -> IntelliFireController:
|
|
"""Return the control API."""
|
|
return self.fireplace.control_api
|
|
|
|
async def _async_update_data(self) -> IntelliFirePollData:
|
|
return self.fireplace.data
|
|
|
|
@property
|
|
def device_info(self) -> DeviceInfo:
|
|
"""Return the device info."""
|
|
return DeviceInfo(
|
|
manufacturer="Hearth and Home",
|
|
model="IFT-WFM",
|
|
name="IntelliFire",
|
|
identifiers={("IntelliFire", str(self.fireplace.serial))},
|
|
configuration_url=f"http://{self.fireplace.ip_address}/poll",
|
|
)
|