Closed claviger-pc closed 1 year ago
That's a very neat use case, thanks for sharing it!
How exactly did you get termux to make use of the library? Would a Rust example on how you can achieve the toggle functionality help you out?
In fact, it was not too hard. Basic process was:
There are some limitations, as I think that you have to call the binary from the command line and it may require root in some cases. But I can call it from without root from within termux and with root in tasker.
I do not know rust, and so I was hoping to avoid figuring out how to parse json, and respond accordingly based on the info function, if that is something that you could easily share a snippet for, I would greatly appreciate it. I already used the functionalities from the examples to create my own examples and have compiled them for use on windows and now android.
Please look at this newly added example and let me know if it answers your need. https://github.com/mihai-dinculescu/tapo/blob/main/examples/tapo_generic_device_toggle.rs
perfect! This works and is exactly what I was looking for. Thank you so much!
Would it be possible to create a toggle function by reading the json info and switching accordingly? Unfortunately I am not very familiar with Rust, and it would seem better to do this within rust rather than parsing json with some other language and setting a variable.
btw, I was able to build this with termux on Android and it is really great to be able to do things with tasker!