mirror of
https://github.com/home-assistant/core.git
synced 2026-08-30 18:14:50 -05:00
Don't create switch entity for switch device type in XThings Cloud (#172828)
This commit is contained in:
@@ -20,7 +20,7 @@ async def async_setup_entry(
|
||||
entities = [
|
||||
XthingsCloudSwitch(coordinator, device_id, device_data)
|
||||
for device_id, device_data in coordinator.data.items()
|
||||
if device_data["type"] in ("switch", "plug")
|
||||
if device_data["type"] == "plug"
|
||||
]
|
||||
async_add_entities(entities)
|
||||
|
||||
|
||||
@@ -40,36 +40,20 @@ async def test_switches(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("entity_id", "device_id", "device_type", "service", "method"),
|
||||
("entity_id", "device_id", "service", "method"),
|
||||
[
|
||||
(
|
||||
"switch.smart_plug_50",
|
||||
"dev_plug_001",
|
||||
"plug",
|
||||
SERVICE_TURN_ON,
|
||||
"async_plug_on",
|
||||
),
|
||||
(
|
||||
"switch.smart_plug_50",
|
||||
"dev_plug_001",
|
||||
"plug",
|
||||
SERVICE_TURN_OFF,
|
||||
"async_plug_off",
|
||||
),
|
||||
(
|
||||
"switch.smart_plug_100",
|
||||
"dev_plug_002",
|
||||
"switch",
|
||||
SERVICE_TURN_ON,
|
||||
"async_switch_on",
|
||||
),
|
||||
(
|
||||
"switch.smart_plug_100",
|
||||
"dev_plug_002",
|
||||
"switch",
|
||||
SERVICE_TURN_OFF,
|
||||
"async_switch_off",
|
||||
),
|
||||
],
|
||||
)
|
||||
async def test_turn_on_off(
|
||||
@@ -78,13 +62,10 @@ async def test_turn_on_off(
|
||||
mock_api_client: AsyncMock,
|
||||
entity_id: str,
|
||||
device_id: str,
|
||||
device_type: str,
|
||||
service: str,
|
||||
method: str,
|
||||
) -> None:
|
||||
"""Test turning on and off a device."""
|
||||
get_device_by_id(mock_api_client, device_id)["type"] = device_type
|
||||
|
||||
with patch("homeassistant.components.xthings_cloud.PLATFORMS", [Platform.SWITCH]):
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user