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

Update documentation #5

Open
scottbonline opened this issue Jan 11, 2018 · 13 comments
Open

Update documentation #5

scottbonline opened this issue Jan 11, 2018 · 13 comments

Comments

@scottbonline
Copy link
Owner

No description provided.

@futzlarson
Copy link

This would be great. I see "There are plenty of methods for you to call" but is there a list somewhere?

@kbickar
Copy link
Collaborator

kbickar commented Mar 31, 2020

Pretty much all the functions in this file: https://github.com/scottbonline/sense/blob/stable/sense_energy/senseable.py

@futzlarson
Copy link

Cool, I'll submit a PR to update the docs.

@futzlarson
Copy link

I haven't done that before for an open-source project. Should it be off master or a new branch?

@Blackcell
Copy link

Blackcell commented Mar 31, 2020

I haven't done that before for an open-source project. Should it be off master or a new branch?

If it is a PR I think branching off master should work.

@futzlarson
Copy link

futzlarson commented Apr 1, 2020

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.

get_trend_data
get_discovered_device_names
get_discovered_device_data
get_all_usage_data

@kbickar
Copy link
Collaborator

kbickar commented Apr 1, 2020

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:

get_trend_data fetches the trend data for a scale of time (e.g. day, month, year). It's mostly used when called by update_trend_data which will get the trend data for all of the scales

get_discovered_device_names returns a list of the names of devices discovered

get_discovered_device_data returns a list of the discovered devices including all the data available on the API (name, type, powered on, etc)

get_all_usage_data had a bug and didn't work, I just pushed a fix. It returns the last 30 usage events like devices being turned on for X minutes

I also just removed the function get_notification_preferences as it no longer worked

@futzlarson
Copy link

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.

@israndy
Copy link

israndy commented Mar 11, 2022

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

@kbickar
Copy link
Collaborator

kbickar commented Mar 11, 2022

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

@israndy
Copy link

israndy commented Mar 11, 2022 via email

@israndy
Copy link

israndy commented Mar 12, 2022 via email

@kbickar
Copy link
Collaborator

kbickar commented Mar 12, 2022

I added a little more documentation for a few of the key functions. In terms of structure, there are two main parts the library:

  • The Sense Web API interface
  • The Local smart plug interface

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

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

5 participants