I have zwave switches with multi-tap functionality and would like to reuse the base code. So, I setup the following base and then instantiate new calls based from that in the apps.yaml file and it works fine.
class MultiTap(hass.Hass):
def initialize(self):
"""
Schedules callback for multi_tap of applicable switch
Input: listen_entity, scene_id, scene_data
"""
listen_entity = self.args['listen_entity']
scene_id = self.args['scene_id']
scene_data = self.args['scene_data']
self.listen_event(self.multi_tap_func, "zwave.scene_activated",
entity_id=listen_entity,
scene_id=scene_id, scene_data=scene_data)
def multi_tap_func(self, event_name, data, kwargs):
"""
Service call function
Input: service, call_entity
"""
service = self.args['service']
call_entity = self.args['call_entity']
self.call_service(service, entity_id=call_entity)
# turn on kitchen island with 3 taps up on under cabinet lights switch
Office_Dim_3U:
module: z_multi_tap
class: MultiTap
listen_entity: zwave.1_kit_cab_wd100
scene_id: 1 # up
scene_data: 4 # 3 taps
service: light/turn_on
call_entity: light.1_kit_isl_wd100
# ???how do I pass brightness kwarg???
This works but the problem is I don’t how to pass any kwargs. For example, how to pass the below brightness kwarg in the apps.yaml file:
self.call_service("light/turn_on", entity_id='light.1_kit_isl_wd100', brightness_pct=50)