Skip to content

Bug: powerKasa module fails on initialisation #149

@TB-1993

Description

@TB-1993

Problem/Opportunity

The powerKasa module currently doesn't initialise, since using the power module abstract class. This is due to the self.is_off and self.is_on attribute being properties with no setters in the abstract class.

Steps to reproduce

Set the users rackconfig to have a kasa type powerswitch in their slot setup, then run the powerSwitch_tests.py tests.

Expected Behavior

The powerKasa module should initialise an object and be able to control kasa type power switches.

Actual Behavior

The power control module throws an attribute error.

Traceback (most recent call last):
  File "/home/ubuntu/.pyenv/versions/3.11.11/lib/python3.11/runpy.py", line 198, in _run_module_as_main
    return _run_code(code, main_globals, None,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.pyenv/versions/3.11.11/lib/python3.11/runpy.py", line 88, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py", line 71, in <module>
    cli.main()
  File "/home/ubuntu/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 501, in main
    run()
  File "/home/ubuntu/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 351, in run_file
    runpy.run_path(target, run_name="__main__")
  File "/home/ubuntu/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 310, in run_path
    return _run_module_code(code, init_globals, run_name, pkg_name=pkg_name, script_name=fname)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 127, in _run_module_code
    _run_code(code, mod_globals, init_globals, mod_name, mod_spec, pkg_name, script_name)
  File "/home/ubuntu/.vscode-server/extensions/ms-python.debugpy-2025.0.1-linux-arm64/bundled/libs/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 118, in _run_code
    exec(code, run_globals)
  File "/home/ubuntu/TEST/test-automation/python_raft/tests/powerSwitch_tests.py", line 55, in <module>
    devices = deviceManager( slot.config.get("devices"), log, "./logs" )
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/TEST/test-automation/python_raft/tests/../framework/core/deviceManager.py", line 304, in __init__
    self.devices[name] = deviceClass( log, logPath, x )
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/TEST/test-automation/python_raft/tests/../framework/core/deviceManager.py", line 169, in __init__
    self.powerControl = powerControlClass( log, config )
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/TEST/test-automation/python_raft/tests/../framework/core/powerControl.py", line 92, in __init__
    self.powerSwitch = powerKasa( log, **config )
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ubuntu/TEST/test-automation/python_raft/tests/../framework/core/powerModules/kasaControl.py", line 86, in __init__
    self.is_on = False
    ^^^^^^^^^^
AttributeError: property 'is_on' of 'powerKasa' object has no setter

Notes (Optional)

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions