Giter Club home page Giter Club logo

Comments (13)

futzlarson avatar futzlarson commented on August 13, 2024

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

from sense.

kbickar avatar kbickar commented on August 13, 2024

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

from sense.

futzlarson avatar futzlarson commented on August 13, 2024

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

from sense.

futzlarson avatar futzlarson commented on August 13, 2024

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

from sense.

Blackcell avatar Blackcell commented on August 13, 2024

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.

from sense.

futzlarson avatar futzlarson commented on August 13, 2024

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

from sense.

kbickar avatar kbickar commented on August 13, 2024

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

from sense.

futzlarson avatar futzlarson commented on August 13, 2024

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.

from sense.

israndy avatar israndy commented on August 13, 2024

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

from sense.

kbickar avatar kbickar commented on August 13, 2024

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

from sense.

israndy avatar israndy commented on August 13, 2024

from sense.

israndy avatar israndy commented on August 13, 2024

from sense.

kbickar avatar kbickar commented on August 13, 2024

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

from sense.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.