Skip to content

developing branch: switch_curtain_command errors #23

Description

@CJDumbleton

Re developing branch: I made errors in the switchbot_curtain_command. Do you want me to fix it and do another pull request? It should be as follows:

@service
def switchbot_curtain_command(device=None, command=None, parameter=None):
    """yaml
name: SwitchBot Curtain Command
description: Control Switchbot curtain.
fields:
  device:
    name: Device
    description: the name of the device as in the SwitchBot app
    example: cover.switchbot_remote_bedroom_curtains
    default:
    required: true
    selector:
      entity:
        domain: cover

  command:
    name: Command
    description: the name of the command
    example: turnOff
    default: 
    required: true
    selector:
      select:
        options:
          - turnOn
          - turnOff
          - setPosition
        mode: list

  parameter:
    name: Parameters
    description: the setPosition command requires a position parameter
    example: 
    default: 
    required: false
    selector:
      number:
        min: 0
        max: 100
        step: 1
        mode: box
    """
    deviceId = extract_device_id(device)
    headers_dict = auth(**pyscript.app_config)
    if parameter != None:
      parameter_string = "0,ff," + str(parameter)
      command_execute(headers_dict, deviceId, command, parameter=parameter_string)
    else:
      command_execute(headers_dict, deviceId, command, parameter=parameter)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions