-
Notifications
You must be signed in to change notification settings - Fork 45
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
Update documentation #5
Comments
This would be great. I see "There are plenty of methods for you to call" but is there a list somewhere? |
Pretty much all the functions in this file: https://github.com/scottbonline/sense/blob/stable/sense_energy/senseable.py |
Cool, I'll submit a PR to update the docs. |
I haven't done that before for an open-source project. Should it be off |
If it is a PR I think branching off master should work. |
Can someone familiar with the code provide one-sentence descriptions for these methods? I have not used it, just trying to help the documentation so that more people can. I have descriptions for the rest from the source.
|
First it's important to know there are two implementations, the async version and the sync version. Apps that use async IO can use the async version, pretty much everyone else will want the sync version. Then there are two types of API calls made by the library. Those to get the realtime data, and those to get trend/device/usage/historic data. As for the functions:
I also just removed the function |
Thanks! I'm about to push a PR that has documentation on methods. While I know what sync and async mean, I don't know exactly what it means in this context. Feel free to add that info as it also seems like useful info. |
I was curious about this API as well. I got it working very quickly, thank you, grabbing my solar vs my usage to figure out if I had any free solar and I wrote an app (TesSense) that allows my Tesla to change the rate it charges at. Then I wanted to know more about the API and I just finished the app SenseAPI.py (https://github.com/israndy/SenseAPI) that lets you call each of the functions. But a few of them are not obvious and could use some documentation. The Example Async code must have some dependancies that I don't understand |
The async code (for the Kasa emulation) should only require asyncio to be imported. Aside from that the async and non-async versions behave pretty similarly. Which functions need documenting more? Side note: might not want to include login credentials in something you put publicly online |
Dammit! not again.
Oh, I see. Xcode makes every little change I make in the editor to the file on the drive. I thought if I saved the file I could upload the version w/o my password in it but I was pasting the password back in w/o saving it before I uploaded. Why even have a save function? Especially if it then prompts me that I have unsaved changes if I try to close the file.
Well, lesson learned (I hope).
… On Mar 11, 2022, at 1:40 PM, Keilin Bickar ***@***.***> wrote:
Side note: might not want to include login credentials in something you put publicly online
|
When I try to paste your example into my SenseAPI.py script and then put 'import asyncio’ before it, I get the error:
ModuleNotFoundError: No module named 'sense_link'
I am probably suffering from already having tried to run the other SenseLink on this same computer so there are some dependancies that I need to squash, or I don’t know how to link code so well. Any thoughts?
I also notice when I run
print( "Senseable:\n", dir( Senseable ) ) # shows all the Sense API functions
That I get a couple of calls I am not familiar with:
‘Devices' jumps out at me, I also haven’t figured out how to retrieve ‘get_realtime_stream' data.
Both ‘get_trend' and ‘trend_start' are probably related. There’s also ‘load_auth' and ‘set_auth', and ‘set_realtime'
I don’t know how to use ‘api_call', but I assume all the current API calls are available in your code and this is just in case a programmer wants to call one directly. And ‘set_ssl_context' is probably similar, but I don’t know.
I wrote SenseAPI.py as a way to document making calls to your API so if you can send a hint at what these calls require I’ll add them to my code for others to learn from.
… On Mar 11, 2022, at 1:40 PM, Keilin Bickar ***@***.***> wrote:
The async code (for the Kasa emulation) should only require asyncio to be imported. Aside from that the async and non-async versions behave pretty similarly. Which functions need documenting more?
|
I added a little more documentation for a few of the key functions. In terms of structure, there are two main parts the library:
For the web API (Senseable or AsyncSenseable objects) there is long term "Trend" data and instantaneous "Realtime" data. The realtime data can be read either as just one update (what the current devices are doing now), or as a stream of updates (similar to viewing in the app). For the smart plug interface (SenseLink object), its purpose is to run a server that replies with available smart plugs and sends out updates when requested by the monitor. It won't really do much by itself |
No description provided.
The text was updated successfully, but these errors were encountered: