Skip to content

Commit

Permalink
#10 Do not enable DataUpdateCoordinator for config flow as some param…
Browse files Browse the repository at this point in the history
… are not present
  • Loading branch information
Fockaert committed Feb 14, 2021
1 parent 78eaff3 commit 6792e45
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions custom_components/rika_firenet/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ async def _show_config_form(self, user_input): # pylint: disable=unused-argumen
async def _test_credentials(self, username, password):
"""Return true if credentials is valid."""
try:
coordinator = RikaFirenetCoordinator(
None, username, password, 21)
coordinator = RikaFirenetCoordinator(None, username, password, 21, True)
coordinator.setup()
return True
except Exception: # pylint: disable=broad-except
Expand Down
17 changes: 9 additions & 8 deletions custom_components/rika_firenet/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


class RikaFirenetCoordinator(DataUpdateCoordinator):
def __init__(self, hass, username, password, default_temperature):
def __init__(self, hass, username, password, default_temperature, config_flow=False):
self.hass = hass
self._username = username
self._password = password
Expand All @@ -26,13 +26,14 @@ def __init__(self, hass, username, password, default_temperature):
self._stoves = None
self.platforms = []

super().__init__(
hass,
_LOGGER,
name=DOMAIN,
update_method=self.async_update_data,
update_interval=SCAN_INTERVAL
)
if not config_flow:
super().__init__(
hass,
_LOGGER,
name=DOMAIN,
update_method=self.async_update_data,
update_interval=SCAN_INTERVAL
)

async def async_update_data(self):
try:
Expand Down

0 comments on commit 6792e45

Please sign in to comment.