mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Fix google calendar event transparency filter (#80438)
This commit is contained in:
parent
f5666641ce
commit
a7f33535c7
@ -359,7 +359,8 @@ class GoogleCalendarEntity(CoordinatorEntity, CalendarEntity):
|
|||||||
def _apply_coordinator_update(self) -> None:
|
def _apply_coordinator_update(self) -> None:
|
||||||
"""Copy state from the coordinator to this entity."""
|
"""Copy state from the coordinator to this entity."""
|
||||||
events = self.coordinator.data
|
events = self.coordinator.data
|
||||||
self._event = _get_calendar_event(next(iter(events))) if events else None
|
api_event = next(filter(self._event_filter, iter(events)), None)
|
||||||
|
self._event = _get_calendar_event(api_event) if api_event else None
|
||||||
if self._event:
|
if self._event:
|
||||||
(self._event.summary, self._offset_value) = extract_offset(
|
(self._event.summary, self._offset_value) = extract_offset(
|
||||||
self._event.summary, self._offset
|
self._event.summary, self._offset
|
||||||
|
@ -24,6 +24,7 @@ from .conftest import (
|
|||||||
TEST_API_ENTITY,
|
TEST_API_ENTITY,
|
||||||
TEST_API_ENTITY_NAME,
|
TEST_API_ENTITY_NAME,
|
||||||
TEST_YAML_ENTITY,
|
TEST_YAML_ENTITY,
|
||||||
|
TEST_YAML_ENTITY_NAME,
|
||||||
)
|
)
|
||||||
|
|
||||||
from tests.common import async_fire_time_changed
|
from tests.common import async_fire_time_changed
|
||||||
@ -577,6 +578,11 @@ async def test_opaque_event(
|
|||||||
events = await response.json()
|
events = await response.json()
|
||||||
assert (len(events) > 0) == expect_visible_event
|
assert (len(events) > 0) == expect_visible_event
|
||||||
|
|
||||||
|
# Verify entity state for upcoming event
|
||||||
|
state = hass.states.get(TEST_YAML_ENTITY)
|
||||||
|
assert state.name == TEST_YAML_ENTITY_NAME
|
||||||
|
assert state.state == (STATE_ON if expect_visible_event else STATE_OFF)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("mock_test_setup", [None])
|
@pytest.mark.parametrize("mock_test_setup", [None])
|
||||||
async def test_scan_calendar_error(
|
async def test_scan_calendar_error(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user