changes for use_dictionary_unpacking
This commit is contained in:
@@ -25,7 +25,7 @@ class Button:
|
||||
)
|
||||
self.logger.info(f'MQTT topic [topic]{topic}[/] controls [room]{self.adapi.name}[/]')
|
||||
|
||||
def handle_button(self, event_name: str, data: Dict[str, Any], kwargs: Dict[str, Any]):
|
||||
def handle_button(self, event_name: str, data: Dict[str, Any], **kwargs: Dict[str, Any]):
|
||||
try:
|
||||
payload = json.loads(data['payload'])
|
||||
action = payload['action']
|
||||
|
||||
@@ -64,14 +64,14 @@ class MotionSensor:
|
||||
def state_mismatch(self) -> bool:
|
||||
return self.sensor_state != self.ref_state
|
||||
|
||||
def callback_light_on(self, entity: str, attribute: str, old: str, new: str, kwargs: dict):
|
||||
def callback_light_on(self, entity: str, attribute: str, old: str, new: str, **kwargs: dict):
|
||||
"""Called when the light turns on"""
|
||||
if new['state'] == 'on':
|
||||
self.logger.debug(f'Detected {entity} turning on')
|
||||
duration = self.adapi.off_duration()
|
||||
self.listen_motion_off(duration)
|
||||
|
||||
def callback_light_off(self, entity: str, attribute: str, old: str, new: str, kwargs: dict):
|
||||
def callback_light_off(self, entity: str, attribute: str, old: str, new: str, **kwargs: dict):
|
||||
"""Called when the light turns off"""
|
||||
self.logger.debug(f'Detected {entity} turning off')
|
||||
self.listen_motion_on()
|
||||
|
||||
@@ -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: Dict[str, Any]):
|
||||
# self.log(f'Custom kwargs: {kwargs}', level='DEBUG')
|
||||
state = self.current_state()
|
||||
if isinstance(state.scene, str):
|
||||
@@ -211,7 +211,7 @@ class RoomController(Hass):
|
||||
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]
|
||||
self, namespace: str, domain: str, service: str, **kwargs: Dict[str, Any]
|
||||
):
|
||||
if self.any_on() and not self.manual_mode():
|
||||
self.activate(**kwargs)
|
||||
@@ -221,7 +221,7 @@ class RoomController(Hass):
|
||||
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]
|
||||
self, namespace: str, domain: str, service: str, **kwargs: Dict[str, Any]
|
||||
):
|
||||
if self.all_off() and not self.manual_mode():
|
||||
self.activate(**kwargs)
|
||||
@@ -230,7 +230,7 @@ class RoomController(Hass):
|
||||
self.call_service(f'{self.name}/deactivate', namespace='controller', **kwargs)
|
||||
|
||||
def _service_deactivate(
|
||||
self, namespace: str, domain: str, service: str, kwargs: Dict[str, Any]
|
||||
self, namespace: str, domain: str, service: str, **kwargs: Dict[str, Any]
|
||||
):
|
||||
for e in self.app_entities:
|
||||
self.turn_off(e)
|
||||
@@ -238,7 +238,7 @@ class RoomController(Hass):
|
||||
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: Dict[str, Any]):
|
||||
if self.any_on():
|
||||
self.deactivate(**kwargs)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user