Closed mihai-dinculescu closed 2 weeks ago
Is there a workaround for now, like choosing a version that works? If so how do I use it?
Hi, I noticed you have released 0.3.2. The timeout issue still continue to persist and I have continued to use 0.3.0. FYI.
@TTSKarlsson v0.3.0 is the latest good version that doesn't exhibit this issue. @avadiax, the fix for this proved more difficult than I thought, and I'm still exploring what's the best way to address the issue. Please bear with me 🙏
The fix is on the main branch. Could you please give it a try @TTSKarlsson, @avadiax, @gsaviane?
The fix is on the main branch. Could you please give it a try @TTSKarlsson, @avadiax, @gsaviane?
Hi Mihai, unfortunately I install via pip, and pip will not install from the main branch since it does not detect setup.py or pyproject.toml in it. :( Not sure if I miss anything.
I'm not sure how to run this.
My steps:
cd tapo-py
pip install poetry
poetry install
poetry shell
-> now inside the venvexport TAPO_USERNAME=_________
export TAPO_PASSWORD=_________
export IP_ADDRESS=the local ip for a tapo plug
py ./examples/tapo_p100.py
Result:
Traceback (most recent call last):
File "F:\rust\tapo\tapo-py\examples\tapo_p110.py", line 7, in <module>
from tapo import ApiClient
ModuleNotFoundError: No module named 'tapo'
@TTSKarlsson After step 5, you need one more, maturin develop
.
@avadiax these steps should work for you as well.
CONTRIBUTING.md should be updated to better capture this.
It does turn it on and then off, but then fails to catch an exception.
This exception doesn't happen on tapo_generic_device_toggle example btw
That's a separate issue concerning the changes introduced in 0.3.2 in response to firmware updates. Is your P11X device on the latest firmware?
fw_ver is '1.2.5 Build 240411 Rel.143808' , if that's the firmware.
I've got a few different plugs. I'm testing on a P100, and this response is the same using examples tapo_p100 and tapo_p110.
Is your P100 on the latest firmware?
If so, can you please paste the response of get_device_info_json
?
{
"avatar": "ceiling_lamp",
"device_id": "8022C03D80DD64FC390D5CA114CA6C31209FE8B8",
"device_on": false,
"fw_id": "00000000000000000000000000000000",
"fw_ver": "1.2.5 Build 240411 Rel.143808",
"has_set_location_info": true,
"hw_id": "4D44B233807D5BDA45BEC69DC18AAE09",
"hw_ver": "2.0",
"ip": "192.168.2.206",
"lang": "en_US",
"latitude": 0,
"longitude": 0,
"mac": "30-DE-4B-21-D6-4D",
"model": "P100",
"nickname": "Computer",
"oem_id": "6A0E161B05B8FB93E53988B66CE51E30",
"on_time": 0,
"region": "Europe/Amsterdam",
"rssi": -51,
"signal_level": 2,
"specs": "",
"ssid": "Emsie",
"time_diff": 60,
"type": "SMART.TAPOPLUG"
}
I don't know how to know if the firmware is the latest, it seems from the build name that it's from april this year
I should add that I've had these for years and I don't use any apps or anything, which means they do manage to update themselves whenever they want to.
The fix for P100 is on main. Can you please try again?
👍🏼 Yes now it works, and the test also returns the device info and device usage
What about the main issue described in this ticket? Did the hangs that you've experienced with v0.3.1 and v0.3.2 go away?
Yes, this issue is gone in the main branch with P100 that I tested.
If it passes for you, you should probably release it as it's going to be a better experience than having to install an older version. My main use now is still 0.3.0 until this releases.
I'll open a new ticket if the new release wouldn't work for some reason.
The change is out now as part of 0.4.0. I just needed a little bit of time to get another improvement in.
The change is out now as part of 0.4.0. I just needed a little bit of time to get another improvement in.
I can confirm 0.4.0 looks to be stable during the testing. Will report if issues pop up.
I take it that you replaced isahc with reqwest?
0.4.0 works here too.
Great, thanks everyone for trying it out, and apologies for the delay in fixing it.
Indeed, isahc was part of the issue. From what I gather, it has its own internal async runtime that doesn’t seem to play well with pyo3. Replacing it with another library that supports an external runtime allowed me to configure tokio in a way that works.
Two users (https://github.com/mihai-dinculescu/tapo/commit/c91ee35c6ca01c282bfafd0cb99fd5384093bb6a#commitcomment-144217052 & https://github.com/mihai-dinculescu/tapo/issues/228#issuecomment-2209587753) have reported that after the migration to pyo3 0.21, the code hangs when timeouts occur.
I have been able to reproduce the problem, and it seems that the hangs are caused by the isahc's
send_async
future that never completes. Using the non-asyncsend
function works as intended.However, I'd like to explore migrating away from
isahc
, as it no longer seems to be well maintained.