mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Remove force from async_schedule_update_ha_state for HMIPC (#31796)
* remove force from async_schedule_update_ha_state if HMIPC * Fix lint
This commit is contained in:
parent
ebeab7f44c
commit
2f3ab15268
@ -16,6 +16,7 @@ from homeassistant.const import (
|
|||||||
STATE_ALARM_DISARMED,
|
STATE_ALARM_DISARMED,
|
||||||
STATE_ALARM_TRIGGERED,
|
STATE_ALARM_TRIGGERED,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
|
|
||||||
from . import DOMAIN as HMIPC_DOMAIN
|
from . import DOMAIN as HMIPC_DOMAIN
|
||||||
@ -95,10 +96,18 @@ class HomematicipAlarmControlPanel(AlarmControlPanel):
|
|||||||
"""Register callbacks."""
|
"""Register callbacks."""
|
||||||
self._home.on_update(self._async_device_changed)
|
self._home.on_update(self._async_device_changed)
|
||||||
|
|
||||||
|
@callback
|
||||||
def _async_device_changed(self, *args, **kwargs) -> None:
|
def _async_device_changed(self, *args, **kwargs) -> None:
|
||||||
"""Handle device state changes."""
|
"""Handle device state changes."""
|
||||||
|
# Don't update disabled entities
|
||||||
|
if self.enabled:
|
||||||
_LOGGER.debug("Event %s (%s)", self.name, CONST_ALARM_CONTROL_PANEL_NAME)
|
_LOGGER.debug("Event %s (%s)", self.name, CONST_ALARM_CONTROL_PANEL_NAME)
|
||||||
self.async_schedule_update_ha_state(True)
|
self.async_schedule_update_ha_state()
|
||||||
|
else:
|
||||||
|
_LOGGER.debug(
|
||||||
|
"Device Changed Event for %s (Alarm Control Panel) not fired. Entity is disabled.",
|
||||||
|
self.name,
|
||||||
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
|
@ -31,6 +31,9 @@ async def _async_manipulate_security_zones(
|
|||||||
internal_zone = home.search_group_by_id(internal_zone_id)
|
internal_zone = home.search_group_by_id(internal_zone_id)
|
||||||
internal_zone.active = internal_active
|
internal_zone.active = internal_active
|
||||||
|
|
||||||
|
home.from_json(json)
|
||||||
|
home._get_functionalHomes(json)
|
||||||
|
home._load_functionalChannels()
|
||||||
home.fire_update_event(json)
|
home.fire_update_event(json)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user