mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Use real devices in climate device trigger tests (#102680)
This commit is contained in:
parent
223abb6dca
commit
13be486d61
@ -147,10 +147,21 @@ async def test_get_triggers_hidden_auxiliary(
|
|||||||
|
|
||||||
|
|
||||||
async def test_if_fires_on_state_change(
|
async def test_if_fires_on_state_change(
|
||||||
hass: HomeAssistant, entity_registry: er.EntityRegistry, calls
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
calls,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test for turn_on and turn_off triggers firing."""
|
"""Test for turn_on and turn_off triggers firing."""
|
||||||
entry = entity_registry.async_get_or_create(DOMAIN, "test", "5678")
|
config_entry = MockConfigEntry(domain="test", data={})
|
||||||
|
config_entry.add_to_hass(hass)
|
||||||
|
device_entry = device_registry.async_get_or_create(
|
||||||
|
config_entry_id=config_entry.entry_id,
|
||||||
|
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||||
|
)
|
||||||
|
entry = entity_registry.async_get_or_create(
|
||||||
|
DOMAIN, "test", "5678", device_id=device_entry.id
|
||||||
|
)
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
entry.entity_id,
|
entry.entity_id,
|
||||||
@ -171,7 +182,7 @@ async def test_if_fires_on_state_change(
|
|||||||
"trigger": {
|
"trigger": {
|
||||||
"platform": "device",
|
"platform": "device",
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "hvac_mode_changed",
|
"type": "hvac_mode_changed",
|
||||||
"to": HVACMode.AUTO,
|
"to": HVACMode.AUTO,
|
||||||
@ -185,7 +196,7 @@ async def test_if_fires_on_state_change(
|
|||||||
"trigger": {
|
"trigger": {
|
||||||
"platform": "device",
|
"platform": "device",
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "current_temperature_changed",
|
"type": "current_temperature_changed",
|
||||||
"above": 20,
|
"above": 20,
|
||||||
@ -199,7 +210,7 @@ async def test_if_fires_on_state_change(
|
|||||||
"trigger": {
|
"trigger": {
|
||||||
"platform": "device",
|
"platform": "device",
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.id,
|
"entity_id": entry.id,
|
||||||
"type": "current_humidity_changed",
|
"type": "current_humidity_changed",
|
||||||
"below": 10,
|
"below": 10,
|
||||||
@ -257,10 +268,21 @@ async def test_if_fires_on_state_change(
|
|||||||
|
|
||||||
|
|
||||||
async def test_if_fires_on_state_change_legacy(
|
async def test_if_fires_on_state_change_legacy(
|
||||||
hass: HomeAssistant, entity_registry: er.EntityRegistry, calls
|
hass: HomeAssistant,
|
||||||
|
device_registry: dr.DeviceRegistry,
|
||||||
|
entity_registry: er.EntityRegistry,
|
||||||
|
calls,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Test for turn_on and turn_off triggers firing."""
|
"""Test for turn_on and turn_off triggers firing."""
|
||||||
entry = entity_registry.async_get_or_create(DOMAIN, "test", "5678")
|
config_entry = MockConfigEntry(domain="test", data={})
|
||||||
|
config_entry.add_to_hass(hass)
|
||||||
|
device_entry = device_registry.async_get_or_create(
|
||||||
|
config_entry_id=config_entry.entry_id,
|
||||||
|
connections={(dr.CONNECTION_NETWORK_MAC, "12:34:56:AB:CD:EF")},
|
||||||
|
)
|
||||||
|
entry = entity_registry.async_get_or_create(
|
||||||
|
DOMAIN, "test", "5678", device_id=device_entry.id
|
||||||
|
)
|
||||||
|
|
||||||
hass.states.async_set(
|
hass.states.async_set(
|
||||||
entry.entity_id,
|
entry.entity_id,
|
||||||
@ -281,7 +303,7 @@ async def test_if_fires_on_state_change_legacy(
|
|||||||
"trigger": {
|
"trigger": {
|
||||||
"platform": "device",
|
"platform": "device",
|
||||||
"domain": DOMAIN,
|
"domain": DOMAIN,
|
||||||
"device_id": "",
|
"device_id": device_entry.id,
|
||||||
"entity_id": entry.entity_id,
|
"entity_id": entry.entity_id,
|
||||||
"type": "hvac_mode_changed",
|
"type": "hvac_mode_changed",
|
||||||
"to": HVACMode.AUTO,
|
"to": HVACMode.AUTO,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user