Fix HomeWizard unclosed clientsession error when closing Home Assistant (#65296)

pull/65442/head
Duco Sebel 2022-01-31 12:49:18 +01:00 committed by Paulus Schoutsen
parent 9294319048
commit fd7f66fbdc
4 changed files with 7 additions and 4 deletions

View File

@ -8,6 +8,7 @@ import aiohwenergy
import async_timeout
from homeassistant.core import HomeAssistant
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from .const import DOMAIN, UPDATE_INTERVAL, DeviceResponseEntry
@ -28,7 +29,9 @@ class HWEnergyDeviceUpdateCoordinator(DataUpdateCoordinator[DeviceResponseEntry]
"""Initialize Update Coordinator."""
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=UPDATE_INTERVAL)
self.api = aiohwenergy.HomeWizardEnergy(host)
session = async_get_clientsession(hass)
self.api = aiohwenergy.HomeWizardEnergy(host, clientsession=session)
async def _async_update_data(self) -> DeviceResponseEntry:
"""Fetch all device and sensor data from api."""

View File

@ -5,7 +5,7 @@
"codeowners": ["@DCSBL"],
"dependencies": [],
"requirements": [
"aiohwenergy==0.7.0"
"aiohwenergy==0.8.0"
],
"zeroconf": ["_hwenergy._tcp.local."],
"config_flow": true,

View File

@ -194,7 +194,7 @@ aiohttp_cors==0.7.0
aiohue==3.0.11
# homeassistant.components.homewizard
aiohwenergy==0.7.0
aiohwenergy==0.8.0
# homeassistant.components.imap
aioimaplib==0.9.0

View File

@ -144,7 +144,7 @@ aiohttp_cors==0.7.0
aiohue==3.0.11
# homeassistant.components.homewizard
aiohwenergy==0.7.0
aiohwenergy==0.8.0
# homeassistant.components.apache_kafka
aiokafka==0.6.0