Exemplo n.º 1
0
 def _set_control_passthrough(self, attribute, service_method):
     """
     Sets a control function to simply call a method on an IO
     service named service_method.
     """
     func = lambda x : BridgeMessage.create_async(self.get_service(), service_method, self.get_real_id(), x)
     self.attributes.set_default_control(attribute, func)
Exemplo n.º 2
0
 def add_messages(self, **message_args):
     """
     Create a list of messages out of keyword arguments.
     """
     for name in message_args:
         method, args = message_args[name]
         msg = BridgeMessage.create_async(self.service, method, self.real_id, *args)
         self.bridge_messages[name] = msg
Exemplo n.º 3
0
 def __init__(self, config, con):
     super().__init__("event", config, con)
     self.read_list = [self.hub_connection]
     self.events_que = [BridgeEvent(datetime.time(20,30,0), BridgeMessage.create_async('lights', 'turn_on', '1.89')),
         BridgeEvent(datetime.time(20,30,0), BridgeMessage.create_async('lights', 'turn_on', '1.67')),
         BridgeEvent(datetime.time(20,30,0), BridgeMessage.create_async('lights', 'turn_on', '1.30')),
         BridgeEvent(datetime.time(20,30,0), BridgeMessage.create_async('lights', 'turn_on', '1.1')),
         BridgeEvent(datetime.time(2,0,0), BridgeMessage.create_async('lights', 'turn_off', '1.89')),
         BridgeEvent(datetime.time(2,0,0), BridgeMessage.create_async('lights', 'turn_off', '1.67')),
         BridgeEvent(datetime.time(2,0,0), BridgeMessage.create_async('lights', 'turn_off', '1.1')),
         BridgeEvent(datetime.time(2,0,0), BridgeMessage.create_async('lights', 'turn_off', '1.30'))]