Closed airfield20 closed 4 years ago
Very likely this is a network issue. Poor wifi signal or routing issues come to mind. If you're using a dedicated wifi network for your IoT devices, the routing between the two networks is worth a look.
Hmm, I do have a dynamic QoS system on my router. Could that be causing these weird results? My wifi signal is definitely strong where my machine and the hs200 device are.
Maybe it doesnt have enough time to connect. When running this command pyhs100 --plug --host "192.168.1.60" sysinfo
is there a way to give it more time with each connection attempt?
Unfortunately there is currently no way to adjust the timeout neither programatically nor from the cli tool. See https://github.com/GadgetReactor/pyHS100/blob/master/pyHS100/protocol.py#L44 and search for timeout in that file -- the default of 5 seconds should be more than enough in a local network, though.
https://github.com/GadgetReactor/pyHS100/pull/172 may improve the situation, after the refactoring PR gets merged, I'll prepare a PR to make the timeout also configurable.
After some deliberation I'm not sure if we would convolute the constructor of SmartDevice even more, you can always adjust the timeout by changing the timeout value after creating an object (for testing), and if the timeout is really the issue, we may adjust the default and/or reconsider this.
So could you give the current git master a try to see if it works for you better now, thanks!
We are closing this repository for new changes in favor of a new, asyncio-enabled continuation project: https://github.com/python-kasa/python-kasa
If the issue is still present in the new project, please feel free to open an issue there, thanks!
When I run this command
pyhs100 --plug --host "192.168.1.60" sysinfo
, I get his error message:For some reason if I run this short python script 2 times, the device will work properly for about 30 seconds before it starts giving me that error message again. This is the script:
Any idea why this might be happening?