Пример #1
0
 def set_output(self, output_id, state, dimmer=None, timer=None):
     # TODO: Use `dimmer` and `timer`
     _ = dimmer, timer
     action = 1 if state else 0
     self._master_communicator.do_command(CoreAPI.basic_action(), {'type': 0, 'action': action,
                                                                   'device_nr': output_id,
                                                                   'extra_parameter': 0})
Пример #2
0
 def shutter_stop(self, shutter_id):
     self._master_communicator.do_command(CoreAPI.basic_action(), {
         'type': 10,
         'action': 0,
         'device_nr': shutter_id,
         'extra_parameter': 0
     })
Пример #3
0
 def do_basic_action(self,
                     action_type,
                     action,
                     device_nr,
                     extra_parameter=0):
     """
     Sends a basic action to the Core with the given action type and action number
     :param action_type: The action type to execute
     :type action_type: int
     :param action: The action number to execute
     :type action: int
     :param device_nr: Device number
     :type device_nr: int
     :param extra_parameter: Optional extra argument
     :type extra_parameter: int
     :raises: :class`CommunicationTimedOutException` if Core did not respond in time
     :returns: dict containing the output fields of the command
     """
     logger.info('BA: Execute {0} {1} {2} {3}'.format(
         action_type, action, device_nr, extra_parameter))
     return self.do_command(
         CoreAPI.basic_action(), {
             'type': action_type,
             'action': action,
             'device_nr': device_nr,
             'extra_parameter': extra_parameter
         })
Пример #4
0
 def toggle_output(self, output_id):
     self._master_communicator.do_command(CoreAPI.basic_action(), {
         'type': 0,
         'action': 16,
         'device_nr': output_id,
         'extra_parameter': 0
     })