Fix alarm service handler state updates

This changes the service handler dispatch code to always
call update_ha_state(), and cleans up the alarm platforms that
were calling it themselves.
This commit is contained in:
Dan Smith 2016-02-06 20:30:39 +00:00
parent 2ba237eac8
commit 3616d7a7ea
2 changed files with 2 additions and 3 deletions

View File

@ -61,6 +61,8 @@ def setup(hass, config):
for alarm in target_alarms: for alarm in target_alarms:
getattr(alarm, method)(code) getattr(alarm, method)(code)
if alarm.should_poll:
alarm.update_ha_state(True)
descriptions = load_yaml_config_file( descriptions = load_yaml_config_file(
os.path.join(os.path.dirname(__file__), 'services.yaml')) os.path.join(os.path.dirname(__file__), 'services.yaml'))

View File

@ -90,7 +90,6 @@ class AlarmDotCom(alarm.AlarmControlPanel):
# Open another session to alarm.com to fire off the command # Open another session to alarm.com to fire off the command
_alarm = Alarmdotcom(self._username, self._password, timeout=10) _alarm = Alarmdotcom(self._username, self._password, timeout=10)
_alarm.disarm() _alarm.disarm()
self.update_ha_state()
def alarm_arm_home(self, code=None): def alarm_arm_home(self, code=None):
""" Send arm home command. """ """ Send arm home command. """
@ -100,7 +99,6 @@ class AlarmDotCom(alarm.AlarmControlPanel):
# Open another session to alarm.com to fire off the command # Open another session to alarm.com to fire off the command
_alarm = Alarmdotcom(self._username, self._password, timeout=10) _alarm = Alarmdotcom(self._username, self._password, timeout=10)
_alarm.arm_stay() _alarm.arm_stay()
self.update_ha_state()
def alarm_arm_away(self, code=None): def alarm_arm_away(self, code=None):
""" Send arm away command. """ """ Send arm away command. """
@ -110,7 +108,6 @@ class AlarmDotCom(alarm.AlarmControlPanel):
# Open another session to alarm.com to fire off the command # Open another session to alarm.com to fire off the command
_alarm = Alarmdotcom(self._username, self._password, timeout=10) _alarm = Alarmdotcom(self._username, self._password, timeout=10)
_alarm.arm_away() _alarm.arm_away()
self.update_ha_state()
def _validate_code(self, code, state): def _validate_code(self, code, state):
""" Validate given code. """ """ Validate given code. """