simplifications
This commit is contained in:
@@ -195,7 +195,7 @@ class RoomController(Hass):
|
||||
def activate(self, **kwargs):
|
||||
self.call_service(f'{self.name}/activate', namespace='controller', **kwargs)
|
||||
|
||||
def _service_activate(self, namespace: str, domain: str, service: str, **kwargs: Dict[str, Any]):
|
||||
def _service_activate(self, namespace: str, domain: str, service: str, **kwargs):
|
||||
# self.log(f'Custom kwargs: {kwargs}', level='DEBUG')
|
||||
state = self.current_state()
|
||||
if isinstance(state.scene, str):
|
||||
@@ -210,9 +210,7 @@ class RoomController(Hass):
|
||||
"""Activate if any of the entities are on. Args and kwargs are passed directly to self.activate()"""
|
||||
self.call_service(f'{self.name}/activate_any_on', namespace='controller', **kwargs)
|
||||
|
||||
def _service_activate_any_on(
|
||||
self, namespace: str, domain: str, service: str, **kwargs: Dict[str, Any]
|
||||
):
|
||||
def _service_activate_any_on(self, namespace: str, domain: str, service: str, **kwargs):
|
||||
if self.any_on() and not self.manual_mode():
|
||||
self.activate(**kwargs)
|
||||
|
||||
@@ -220,25 +218,21 @@ class RoomController(Hass):
|
||||
"""Activate if all of the entities are off. Args and kwargs are passed directly to self.activate()"""
|
||||
self.call_service(f'{self.name}/activate_all_off', namespace='controller', **kwargs)
|
||||
|
||||
def _service_activate_all_off(
|
||||
self, namespace: str, domain: str, service: str, **kwargs: Dict[str, Any]
|
||||
):
|
||||
def _service_activate_all_off(self, namespace: str, domain: str, service: str, **kwargs):
|
||||
if self.all_off() and not self.manual_mode():
|
||||
self.activate(**kwargs)
|
||||
|
||||
def deactivate(self, **kwargs):
|
||||
self.call_service(f'{self.name}/deactivate', namespace='controller', **kwargs)
|
||||
|
||||
def _service_deactivate(
|
||||
self, namespace: str, domain: str, service: str, **kwargs: Dict[str, Any]
|
||||
):
|
||||
def _service_deactivate(self, namespace: str, domain: str, service: str, **kwargs):
|
||||
for e in self.app_entities:
|
||||
self.turn_off(e)
|
||||
|
||||
def toggle(self, **kwargs):
|
||||
self.call_service(f'{self.name}/toggle', namespace='controller', **kwargs)
|
||||
|
||||
def _service_toggle(self, namespace: str, domain: str, service: str, **kwargs: Dict[str, Any]):
|
||||
def _service_toggle(self, namespace: str, domain: str, service: str, **kwargs):
|
||||
if self.any_on():
|
||||
self.deactivate(**kwargs)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user