mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Add support for newer Magic Home sockets (#79074)
This commit is contained in:
parent
43c66b90df
commit
49f203c635
@ -58,7 +58,12 @@ PLATFORMS_BY_TYPE: Final = {
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
],
|
||||
DeviceType.Switch: [Platform.BUTTON, Platform.SELECT, Platform.SWITCH],
|
||||
DeviceType.Switch: [
|
||||
Platform.BUTTON,
|
||||
Platform.SELECT,
|
||||
Platform.SENSOR,
|
||||
Platform.SWITCH,
|
||||
],
|
||||
}
|
||||
DISCOVERY_INTERVAL: Final = timedelta(minutes=15)
|
||||
REQUEST_REFRESH_DELAY: Final = 1.5
|
||||
|
@ -175,6 +175,8 @@ def _mocked_switch() -> AIOWifiLedBulb:
|
||||
switch.pixels_per_segment = None
|
||||
switch.segments = None
|
||||
switch.music_pixels_per_segment = None
|
||||
switch.paired_remotes = 2
|
||||
switch.remote_config = RemoteConfig.OPEN
|
||||
switch.music_segments = None
|
||||
switch.operating_mode = None
|
||||
switch.operating_modes = None
|
||||
@ -183,6 +185,8 @@ def _mocked_switch() -> AIOWifiLedBulb:
|
||||
switch.ic_types = None
|
||||
switch.ic_type = None
|
||||
switch.requires_turn_on = True
|
||||
switch.async_config_remotes = AsyncMock()
|
||||
switch.async_unpair_remotes = AsyncMock()
|
||||
switch.async_set_time = AsyncMock()
|
||||
switch.async_reboot = AsyncMock()
|
||||
switch.async_setup = AsyncMock(side_effect=_save_setup_callback)
|
||||
|
@ -44,8 +44,8 @@ async def test_button_reboot(hass: HomeAssistant) -> None:
|
||||
switch.async_reboot.assert_called_once()
|
||||
|
||||
|
||||
async def test_button_unpair_remotes(hass: HomeAssistant) -> None:
|
||||
"""Test that remotes can be unpaired."""
|
||||
async def test_button_unpair_remotes_bulb(hass: HomeAssistant) -> None:
|
||||
"""Test that remotes can be unpaired from a bulb."""
|
||||
_mock_config_entry_for_bulb(hass)
|
||||
bulb = _mocked_bulb()
|
||||
bulb.discovery = FLUX_DISCOVERY
|
||||
@ -60,3 +60,21 @@ async def test_button_unpair_remotes(hass: HomeAssistant) -> None:
|
||||
BUTTON_DOMAIN, "press", {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
)
|
||||
bulb.async_unpair_remotes.assert_called_once()
|
||||
|
||||
|
||||
async def test_button_unpair_remotes_smart_switch(hass: HomeAssistant) -> None:
|
||||
"""Test that remotes can be unpaired from a smart switch."""
|
||||
_mock_config_entry_for_bulb(hass)
|
||||
switch = _mocked_switch()
|
||||
switch.discovery = FLUX_DISCOVERY
|
||||
with _patch_discovery(device=FLUX_DISCOVERY), _patch_wifibulb(device=switch):
|
||||
await async_setup_component(hass, flux_led.DOMAIN, {flux_led.DOMAIN: {}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
entity_id = "button.bulb_rgbcw_ddeeff_unpair_remotes"
|
||||
assert hass.states.get(entity_id)
|
||||
|
||||
await hass.services.async_call(
|
||||
BUTTON_DOMAIN, "press", {ATTR_ENTITY_ID: entity_id}, blocking=True
|
||||
)
|
||||
switch.async_unpair_remotes.assert_called_once()
|
||||
|
Loading…
x
Reference in New Issue
Block a user