dswd / OctoPrint-PSUControl-Tapo

Adds TPLink Smart Plug support to OctoPrint-PSUControl as a sub-plugin
GNU Affero General Public License v3.0
7 stars 1 forks source link

Not connecting to smart plug from octoprint installed on windows #8

Closed edmunds-sudniks closed 1 year ago

edmunds-sudniks commented 1 year ago

Hello,

I'm running Octoprint on windows and when i'm trying to add a tapo device, octoprint is not reacting, lightning icon just keeps on spinning. The log show following message -

2023-03-22 09:10:46,700 - octoprint.plugins.psucontrol - ERROR - Error while executing callback <bound method PSUControl_Tapo.get_psu_state of <octoprint_psucontrol_tapo.PSUControl_Tapo object at 0x0000017062E17160>>
Traceback (most recent call last):
  File "C:\TT_Octoprint\venv\lib\site-packages\octoprint_psucontrol\[__init__.py](http://__init__.py/)", line 292, in _check_psu_state
    r = callback()
  File "C:\TT_Octoprint\venv\lib\site-packages\octoprint_psucontrol_tapo\[__init__.py](http://__init__.py/)", line 90, in get_psu_state
    return self.device.get_status()
AttributeError: 'NoneType' object has no attribute 'get_status'

what could be the cause? Thanks in advance

edmunds-sudniks commented 1 year ago

Resolved this issue with replacing line 15 in tapo.py from this:

def __init__(self, address: str, username: str, password: str, keypair_file: str = '/tmp/tapo.key'):

to this:

def __init__(self, address: str, username: str, password: str, keypair_file: str = 'C:/tmp/tapo.key'):