1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Homekit style cleanup (#14556)

* Style cleanup

* Sorted imports
* Harmonized service calls

* Test improvements

* Small update
This commit is contained in:
cdce8p
2018-05-21 04:25:53 +02:00
committed by Paulus Schoutsen
parent ee7e59fe68
commit 0589379de5
24 changed files with 209 additions and 214 deletions

View File

@@ -84,20 +84,21 @@ class HomeAccessory(Accessory):
async_track_state_change(
self.hass, self.entity_id, self.update_state_callback)
@ha_callback
def update_state_callback(self, entity_id=None, old_state=None,
new_state=None):
"""Callback from state change listener."""
_LOGGER.debug('New_state: %s', new_state)
if new_state is None:
return
self.update_state(new_state)
self.hass.async_add_job(self.update_state, new_state)
def update_state(self, new_state):
"""Method called on state change to update HomeKit value.
Overridden by accessory types.
"""
pass
raise NotImplementedError()
class HomeBridge(Bridge):