Support MyStrom switch 120 (#96535)

pull/96545/head
Joost Lekkerkerker 2023-07-14 15:04:48 +02:00 committed by GitHub
parent 357af58c81
commit 1b7632a673
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -53,7 +53,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
info.setdefault("type", 101)
device_type = info["type"]
if device_type in [101, 106, 107]:
if device_type in [101, 106, 107, 120]:
device = _get_mystrom_switch(host)
platforms = PLATFORMS_SWITCH
await _async_get_device_state(device, info["ip"])
@ -86,7 +86,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Unload a config entry."""
device_type = hass.data[DOMAIN][entry.entry_id].info["type"]
platforms = []
if device_type in [101, 106, 107]:
if device_type in [101, 106, 107, 120]:
platforms.extend(PLATFORMS_SWITCH)
elif device_type in [102, 105]:
platforms.extend(PLATFORMS_BULB)

View File

@ -68,7 +68,7 @@ async def test_init_switch_and_unload(
(110, "sensor", ConfigEntryState.SETUP_ERROR, True),
(113, "switch", ConfigEntryState.SETUP_ERROR, True),
(118, "button", ConfigEntryState.SETUP_ERROR, True),
(120, "switch", ConfigEntryState.SETUP_ERROR, True),
(120, "switch", ConfigEntryState.LOADED, False),
],
)
async def test_init_bulb(