Add support for remove services / Reload script support (#6441)
* Add support for remove services / Reload script support * Reload support for scripts * Add more unittest for services * Add unittest for script reload * Address paulus comments
This commit is contained in:
1 parent
e7f442d66b
commit
c937a7bcb0
7 files changed
+197
-35
No files matched your search
@@ -14,7 +14,7 @@ from homeassistant import config as conf_util, core as ha
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID, CONF_ICON, CONF_NAME, STATE_CLOSED, STATE_HOME,
|
||||
STATE_NOT_HOME, STATE_OFF, STATE_ON, STATE_OPEN, STATE_LOCKED,
|
||||
STATE_UNLOCKED, STATE_UNKNOWN, ATTR_ASSUMED_STATE)
|
||||
STATE_UNLOCKED, STATE_UNKNOWN, ATTR_ASSUMED_STATE, SERVICE_RELOAD)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.entity import Entity, async_generate_entity_id
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
@@ -42,7 +42,6 @@ SET_VISIBILITY_SERVICE_SCHEMA = vol.Schema({
|
||||
vol.Required(ATTR_VISIBLE): cv.boolean
|
||||
})
|
||||
|
||||
SERVICE_RELOAD = 'reload'
|
||||
RELOAD_SERVICE_SCHEMA = vol.Schema({})
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@@ -395,17 +394,16 @@ class Group(Entity):
|
||||
self._state = STATE_UNKNOWN
|
||||
self._async_update_group_state()
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_remove(self):
|
||||
"""Remove group from HASS.
|
||||
|
||||
This method must be run in the event loop.
|
||||
This method must be run in the event loop and returns a coroutine.
|
||||
"""
|
||||
if self._async_unsub_state_changed:
|
||||
self._async_unsub_state_changed()
|
||||
self._async_unsub_state_changed = None
|
||||
|
||||
yield from super().async_remove()
|
||||
return super().async_remove()
|
||||
|
||||
@asyncio.coroutine
|
||||
def _async_state_changed_listener(self, entity_id, old_state, new_state):
|
||||
|
||||
Reference in new issue
Block a user