Add some debug code
This commit is contained in:
parent
f5f0cbe434
commit
6fc3b30174
|
@ -3,6 +3,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from contextvars import ContextVar
|
||||
import logging
|
||||
from typing import Protocol
|
||||
|
||||
from homeassistant.const import STATE_OFF, STATE_ON
|
||||
|
@ -15,6 +16,8 @@ from .const import DOMAIN, REG_KEY
|
|||
|
||||
current_domain: ContextVar[str] = ContextVar("current_domain")
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def async_setup(hass: HomeAssistant) -> None:
|
||||
"""Set up the Group integration registry of integration platforms."""
|
||||
|
@ -58,6 +61,7 @@ class GroupIntegrationRegistry:
|
|||
|
||||
def on_off_states(self, on_states: set, off_state: str) -> None:
|
||||
"""Register on and off states for the current domain."""
|
||||
_LOGGER.info("Enter on_off_states for %s", current_domain.get())
|
||||
for on_state in on_states:
|
||||
if on_state not in self.on_off_mapping:
|
||||
self.on_off_mapping[on_state] = off_state
|
||||
|
|
|
@ -1409,6 +1409,41 @@ async def test_cover_added_after_group(hass: HomeAssistant) -> None:
|
|||
assert hass.states.get("group.shades").state == "closed"
|
||||
|
||||
|
||||
async def test_cover_lock_issue(hass: HomeAssistant) -> None:
|
||||
"""Test cover added after group."""
|
||||
|
||||
entity_ids = [
|
||||
"cover.upstairs",
|
||||
"cover.downstairs",
|
||||
]
|
||||
|
||||
assert await async_setup_component(hass, "cover", {})
|
||||
assert await async_setup_component(hass, "lock", {})
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
"group",
|
||||
{
|
||||
"group": {
|
||||
"shades": {"entities": entity_ids},
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
for entity_id in entity_ids:
|
||||
hass.states.async_set(entity_id, "open")
|
||||
await hass.async_block_till_done()
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get("group.shades").state == "open"
|
||||
|
||||
for entity_id in entity_ids:
|
||||
hass.states.async_set(entity_id, "closed")
|
||||
|
||||
await hass.async_block_till_done()
|
||||
assert hass.states.get("group.shades").state == "closed"
|
||||
|
||||
|
||||
async def test_group_that_references_a_group_of_lights(hass: HomeAssistant) -> None:
|
||||
"""Group that references a group of lights."""
|
||||
|
||||
|
|
Loading…
Reference in New Issue