Fix Egardia alarm status shown as unknown after restart (#11010)
This commit is contained in:
parent
39d33c97ff
commit
f21da7cfdc
1 changed files with 10 additions and 3 deletions
|
@ -116,12 +116,20 @@ class EgardiaAlarm(alarm.AlarmControlPanel):
|
||||||
"""Return the state of the device."""
|
"""Return the state of the device."""
|
||||||
return self._status
|
return self._status
|
||||||
|
|
||||||
|
@property
|
||||||
|
def should_poll(self):
|
||||||
|
"""Poll if no report server is enabled."""
|
||||||
|
if not self._rs_enabled:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def handle_system_status_event(self, event):
|
def handle_system_status_event(self, event):
|
||||||
"""Handle egardia_system_status_event."""
|
"""Handle egardia_system_status_event."""
|
||||||
if event.data.get('status') is not None:
|
if event.data.get('status') is not None:
|
||||||
statuscode = event.data.get('status')
|
statuscode = event.data.get('status')
|
||||||
status = self.lookupstatusfromcode(statuscode)
|
status = self.lookupstatusfromcode(statuscode)
|
||||||
self.parsestatus(status)
|
self.parsestatus(status)
|
||||||
|
self.schedule_update_ha_state()
|
||||||
|
|
||||||
def listen_to_system_status(self):
|
def listen_to_system_status(self):
|
||||||
"""Subscribe to egardia_system_status event."""
|
"""Subscribe to egardia_system_status event."""
|
||||||
|
@ -161,9 +169,8 @@ class EgardiaAlarm(alarm.AlarmControlPanel):
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update the alarm status."""
|
"""Update the alarm status."""
|
||||||
if not self._rs_enabled:
|
status = self._egardiasystem.getstate()
|
||||||
status = self._egardiasystem.getstate()
|
self.parsestatus(status)
|
||||||
self.parsestatus(status)
|
|
||||||
|
|
||||||
def alarm_disarm(self, code=None):
|
def alarm_disarm(self, code=None):
|
||||||
"""Send disarm command."""
|
"""Send disarm command."""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue