Solve Modbus reload issue (#82253)

fixes undefined
pull/82308/head
jan iversen 2022-11-18 09:32:51 +01:00 committed by GitHub
parent 5119005a8d
commit 6bd70fdf15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -386,4 +386,3 @@ async def async_reset_platform(hass: HomeAssistant, integration_name: str) -> No
hubs = hass.data[DOMAIN]
for name in hubs:
await hubs[name].async_close()
del hass.data[DOMAIN]

View File

@ -132,6 +132,12 @@ async def async_modbus_setup(
await async_setup_reload_service(hass, DOMAIN, [DOMAIN])
if DOMAIN in hass.data and config[DOMAIN] == []:
hubs = hass.data[DOMAIN]
for name in hubs:
if not await hubs[name].async_setup():
return False
hass.data[DOMAIN] = hub_collect = {}
for conf_hub in config[DOMAIN]:
my_hub = ModbusHub(hass, conf_hub)