예제 #1
0
    def apply_action(self, cmd_name, *args):
        """Apply Action to Device."""
        from tahoma_api import Action

        action = Action(self.tahoma_device.url)
        action.add_command(cmd_name, *args)
        self.controller.apply_actions("HomeAssistant", [action])
예제 #2
0
def execute(label, command):
    data = {
        "commands": [
            {
                "name": command,
            }
        ]
    }

    for deviceURL, value in devices.items():
        if label == value.label:
            print(deviceURL, value.label, value.command_definitions)
            data['deviceURL'] = deviceURL
            api.apply_actions(label, [Action(data)])
            return jsonify(success=True, message='Device '+label+' found', commad=command)

    return jsonify(success=False,  message='No device found')
예제 #3
0
def apply_action(controller, cmd_name, dev_url, *args):
    """Apply Action to Device."""
    action = Action(dev_url)
    action.add_command(cmd_name, *args)
    controller.apply_actions('Test', [action])
예제 #4
0
    def apply_action(self, cmd_name, *args):
        """Apply Action to Device."""

        action = Action(self.tahoma_device.url)
        action.add_command(cmd_name, *args)
        self.controller.apply_actions("OpenPeerPower", [action])