Skip to content

Commit

Permalink
- removed references to _hass in update coordinator
Browse files Browse the repository at this point in the history
- removed hass attribute in ge_entity
- version bump
  • Loading branch information
simbaja committed Nov 26, 2023
1 parent 264c431 commit 1d1ff7c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
1 change: 0 additions & 1 deletion custom_components/ge_home/entities/common/ge_entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class GeEntity:

def __init__(self, api: ApplianceApi):
self._api = api
self.hass = None

@property
def unique_id(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ge_home/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"documentation": "https://github.com/simbaja/ha_gehome",
"requirements": ["gehomesdk==0.5.23","magicattr==0.1.6","slixmpp==1.8.3"],
"codeowners": ["@simbaja"],
"version": "0.6.8"
"version": "0.6.9"
}
14 changes: 6 additions & 8 deletions custom_components/ge_home/update_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class GeHomeUpdateCoordinator(DataUpdateCoordinator):

def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None:
"""Set up the GeHomeUpdateCoordinator class."""
self._hass = hass
super().__init__(hass, _LOGGER, name=DOMAIN)

self._config_entry = config_entry
self._username = config_entry.data[CONF_USERNAME]
self._password = config_entry.data[CONF_PASSWORD]
Expand All @@ -64,8 +65,6 @@ def __init__(self, hass: HomeAssistant, config_entry: ConfigEntry) -> None:

self._reset_initialization()

super().__init__(hass, _LOGGER, name=DOMAIN)

def _reset_initialization(self):
self.client = None # type: Optional[GeWebsocketClient]

Expand Down Expand Up @@ -161,8 +160,7 @@ async def get_client(self) -> GeWebsocketClient:
finally:
self._reset_initialization()

loop = self._hass.loop
self.client = self.create_ge_client(event_loop=loop)
self.client = self.create_ge_client(event_loop=self.hass.loop)
return self.client

async def async_setup(self):
Expand Down Expand Up @@ -201,9 +199,9 @@ async def async_start_client(self):
async def async_begin_session(self):
"""Begins the ge_home session."""
_LOGGER.debug("Beginning session")
session = self._hass.helpers.aiohttp_client.async_get_clientsession()
session = self.hass.helpers.aiohttp_client.async_get_clientsession()
await self.client.async_get_credentials(session)
fut = asyncio.ensure_future(self.client.async_run_client(), loop=self._hass.loop)
fut = asyncio.ensure_future(self.client.async_run_client(), loop=self.hass.loop)
_LOGGER.debug("Client running")
return fut

Expand Down Expand Up @@ -263,7 +261,7 @@ def shutdown(self, event) -> None:
_LOGGER.info("ge_home shutting down")
if self.client:
self.client.clear_event_handlers()
self._hass.loop.create_task(self.client.disconnect())
self.hass.loop.create_task(self.client.disconnect())

async def on_device_update(self, data: Tuple[GeAppliance, Dict[ErdCodeType, Any]]):
"""Let HA know there's new state."""
Expand Down

0 comments on commit 1d1ff7c

Please sign in to comment.