Fix for Kasa plugs in on_off_kasa_plugs.py #1221
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there,
i think i have fixed a bug with Kasa plugs which did not work for me. When creating a "[IP] On/Off: Kasa WiFi Power Plug" output, configuring it always failed with a daemon connection timeout. No useful info in the logs, especially no loggging output from the output module. So I examined the module code and there's a simple fix.
The "aio_rpc_server" thread is passed four arguments in line 176/177, but the "aio_rpc_server()" function only uses/accepts three arguments.
This results in the rpc server to not start at all and leaving no log error whatsoever. The output setup will fail and a Kasa plugs cannot be controlled.
By adding a fourth argument "channel_count" the rpc server is started correctly and the output module for Kasa plugs is working fine.
It should be noted that new argument is never used but turning on/off the plugs works fine.
I am using and have tested this with two Kasa Plugs KP105.
Mycodo Version: 8.14.1
Python Version: 3.9.2
python-kasa 0.5.0