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

Doesn't toggle #1

Open
monojk opened this issue Jun 9, 2021 · 0 comments
Open

Doesn't toggle #1

monojk opened this issue Jun 9, 2021 · 0 comments

Comments

@monojk
Copy link

monojk commented Jun 9, 2021

Great widget. Yet there is a small bug as it doesn't switch. In Api.kt fun "toggle" the "state" data type is boolean, but the Kasa Api requires 0 or 1.

With the current implementation:

request response {"error_code":0,"result":{"responseData":"{"system":{"set_relay_state":{"err_code":-3,"err_msg":"invalid argument"}}}"}}

It works when I change the code to:

JSONObject(mapOf("state" to deviceInfo.isOn.compareTo(true))))

I am using this suggestion: https://stackoverflow.com/questions/46401879/boolean-int-conversion-in-kotlin

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

No branches or pull requests

1 participant