Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Kasa plugs in on_off_kasa_plugs.py #1221

Closed
wants to merge 1 commit into from

Conversation

peschler
Copy link

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

The "aio_rpc_server" is passed four arguments in line 176/177, but the "aio_rpc_server()" function only uses 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.
@kizniche
Copy link
Owner

Excellent! Thanks for figuring this out. This issue is the result of refactoring the multi-channel kasa Mycodo module for use with the single-channel plugs, but I must have missed this. The entire argument can actually be removed since it's not used (there is only one channel).

kizniche added a commit that referenced this pull request Aug 17, 2022
@kizniche
Copy link
Owner

committed the removal (commit above).

@kizniche kizniche closed this Aug 17, 2022
@kizniche
Copy link
Owner

This pull request has been mentioned on Radical DIY Forum. There might be relevant details there:

https://forum.radicaldiy.com/t/mycodo-v8-14-0-release/1136/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants