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:
SukramJ 2020-02-14 01:24:43 +01:00 committed by GitHub
parent ebeab7f44c
commit 2f3ab15268
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -16,6 +16,7 @@ from homeassistant.const import (
STATE_ALARM_DISARMED,
STATE_ALARM_TRIGGERED,
)
from homeassistant.core import callback
from homeassistant.helpers.typing import HomeAssistantType
from . import DOMAIN as HMIPC_DOMAIN
@ -95,10 +96,18 @@ class HomematicipAlarmControlPanel(AlarmControlPanel):
"""Register callbacks."""
self._home.on_update(self._async_device_changed)
@callback
def _async_device_changed(self, *args, **kwargs) -> None:
"""Handle device state changes."""
# Don't update disabled entities
if self.enabled:
_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
def name(self) -> str:

View File

@ -31,6 +31,9 @@ async def _async_manipulate_security_zones(
internal_zone = home.search_group_by_id(internal_zone_id)
internal_zone.active = internal_active
home.from_json(json)
home._get_functionalHomes(json)
home._load_functionalChannels()
home.fire_update_event(json)
await hass.async_block_till_done()