예제 #1
0
파일: __init__.py 프로젝트: nikron/bridge
 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)
예제 #2
0
파일: __init__.py 프로젝트: nikron/bridge
 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
예제 #3
0
파일: __init__.py 프로젝트: nikron/bridge
 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'))]