mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Add support for managing 2.4G remotes in flux_led (#63646)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""Tests for select platform."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from flux_led.protocol import PowerRestoreState
|
||||
from flux_led.protocol import PowerRestoreState, RemoteConfig
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import flux_led
|
||||
@@ -13,8 +13,10 @@ from homeassistant.setup import async_setup_component
|
||||
|
||||
from . import (
|
||||
DEFAULT_ENTRY_TITLE,
|
||||
FLUX_DISCOVERY,
|
||||
IP_ADDRESS,
|
||||
MAC_ADDRESS,
|
||||
_mock_config_entry_for_bulb,
|
||||
_mocked_bulb,
|
||||
_mocked_switch,
|
||||
_patch_discovery,
|
||||
@@ -147,3 +149,45 @@ async def test_select_mutable_0x25_strip_config(hass: HomeAssistant) -> None:
|
||||
await hass.async_block_till_done()
|
||||
bulb.async_set_device_config.assert_called_once_with(operating_mode="CCT")
|
||||
assert len(mock_setup_entry.mock_calls) == 1
|
||||
|
||||
|
||||
async def test_select_24ghz_remote_config(hass: HomeAssistant) -> None:
|
||||
"""Test selecting 2.4ghz remote config."""
|
||||
_mock_config_entry_for_bulb(hass)
|
||||
bulb = _mocked_bulb()
|
||||
bulb.discovery = FLUX_DISCOVERY
|
||||
with _patch_discovery(device=FLUX_DISCOVERY), _patch_wifibulb(device=bulb):
|
||||
await async_setup_component(hass, flux_led.DOMAIN, {flux_led.DOMAIN: {}})
|
||||
await hass.async_block_till_done()
|
||||
|
||||
remote_config_entity_id = "select.bulb_rgbcw_ddeeff_remote_config"
|
||||
state = hass.states.get(remote_config_entity_id)
|
||||
assert state.state == "Open"
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
await hass.services.async_call(
|
||||
SELECT_DOMAIN,
|
||||
"select_option",
|
||||
{ATTR_ENTITY_ID: remote_config_entity_id, ATTR_OPTION: "INVALID"},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
bulb.remote_config = RemoteConfig.DISABLED
|
||||
await hass.services.async_call(
|
||||
SELECT_DOMAIN,
|
||||
"select_option",
|
||||
{ATTR_ENTITY_ID: remote_config_entity_id, ATTR_OPTION: "Disabled"},
|
||||
blocking=True,
|
||||
)
|
||||
bulb.async_config_remotes.assert_called_once_with(RemoteConfig.DISABLED)
|
||||
bulb.async_config_remotes.reset_mock()
|
||||
|
||||
bulb.remote_config = RemoteConfig.PAIRED_ONLY
|
||||
await hass.services.async_call(
|
||||
SELECT_DOMAIN,
|
||||
"select_option",
|
||||
{ATTR_ENTITY_ID: remote_config_entity_id, ATTR_OPTION: "Paired Only"},
|
||||
blocking=True,
|
||||
)
|
||||
bulb.async_config_remotes.assert_called_once_with(RemoteConfig.PAIRED_ONLY)
|
||||
bulb.async_config_remotes.reset_mock()
|
||||
|
||||
Reference in New Issue
Block a user