add device registry

This commit is contained in:
Andrey
2021-01-15 09:10:42 +03:00
parent 254015be4c
commit c4f4510941
7 changed files with 61 additions and 36 deletions

View File

@@ -81,7 +81,7 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry, asyn
async def scan_ports():
async for port, pty, m in hub.scan_ports():
if pty == "1" and m in ['0', '1']:
light = MegaLight(mega_id=mid, port=port, dimmer=m == '1')
light = MegaLight(mega_id=mid, port=port, dimmer=m == '1', config_entry=config_entry)
devices.append(light)
async_add_devices(devices)