Skip to content

Bug: GetPowerLevel failing for TapoControl #190

@jfreeda

Description

@jfreeda

Problem/Opportunity

Need to comment the below code for getting proper power value from tapo device.
def _performCommand(self, command, json = False, append_args:list = []):
"""
Perform a command.

    Args:
        command (str): The command to execute.
        json (bool): Add the --json option to the command.
                     Retrieves the data in json string format.
                     Default is False.
        append_args (list): Extra arguments to add on the end of the command.
                            Defaults to an empty list.
    Returns:
        str: The command output.
    """
    command_list = ["kasa", "--host", self.ip]
    if json:
        command_list.append("--json")
    if self._username:
        command_list.append("--username")
        command_list.append(self._username)
    if self._password:
        command_list.append("--password")
        command_list.append(self._password)
    #         if self._device_type != "UNKNOWN" and self._encryption_type:
    #             command_list.append("--device-family")
    #             command_list.append(self._device_type)
    #             command_list.append("--encrypt-type")
    #             command_list.append(self._encryption_type)
    #         else:
    #             if self._outlet:
    #                 command_list.append("--type")
    #                 command_list.append("strip")
    #             else:
    #                 command_list.append("--type")
    #                 command_list.append("plug")
    command_list.append(command)
    for arg in append_args:
        command_list.append(arg)
    self._log.debug( "Command: {}".format(" ".join(command_list)))
    data = subprocess.run(command_list, stdout=subprocess.PIPE, text=True)
    self._log.debug(data.stdout)
    return data.stdout

Steps to reproduce

Call the getPowerlevel from UT raft.

Expected Behavior

Call the getPowerlevel from UT raft.

Actual Behavior

It should give proper power level

Notes (Optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions