Giter Club home page Giter Club logo

Comments (8)

kbickar avatar kbickar commented on August 13, 2024

The data resets at midnight, maybe it works for you now?
You can dump it all to see with print(sense._trend_data["DAY"])

from sense.

cholmescanada avatar cholmescanada commented on August 13, 2024

Thanks for the reply! When I try that, I do get an output.

I am sure this is a problem with my understanding, however what I am looking to do is get usage data on a certain date. I see in the code it allows specifying a date, however I am unable to get anything to return.

`import datetime
from sense_energy import Senseable
sense = Senseable()
sense.authenticate('', '')

my_date = datetime.datetime(2023, 4, 2)
test = sense.get_trend_data('DAY',my_date)
print(test)`

and I get "None" as the output.

Thanks in advance!

from sense.

sagararthonsys avatar sagararthonsys commented on August 13, 2024

I am not able to get any data from sense.get_trend_data('DAY') even after running sense.update_trend_data()

from sense.

dauc avatar dauc commented on August 13, 2024

sense.get_trend_data doesn't actually return the trend data; it just retrieves it and stores it in sense._trend_data.

Based on the other get_ functions maybe it should return self._trend_data[scale] ? But it works to call and then read the result from self._trend_data[scale] directly.

from sense.

snairolf avatar snairolf commented on August 13, 2024

Agree, the naming is inconsistent. Based on the other functions get_trend_data() should just do the api call and not change the internal _trend_data.

Instead, update_trend_data could have a scales=[] input parameter, or similar.

from sense.

kbickar avatar kbickar commented on August 13, 2024

I guess get_trend_data() should really be an internal function or renamed to update_single_trend_data() or something. The function get_trend() should be used to retrieve trend data after it's been updated

from sense.

snairolf avatar snairolf commented on August 13, 2024

Renaming to update_single_trend_data() would make sense. It would still be good to keep get_trend_data() in line with all the other functions that just return the raw data from the API call.

Currently, it's quite mixed which functions return values AND modify internal data versus the ones that just return the raw data from the call (modifying internal data: get_trend_data(), get_discovered_device_names(), get_monitor_data()). IMHO, it would be good to have a better separation in terms of naming between the functions that do an API call vs the ones that don't.

from sense.

kbickar avatar kbickar commented on August 13, 2024

The reason for that is the get_discovered_device_names() and get_monitor_data() are API calls that would likely be called only once per session while the ones like get_trend() would return the data from the last time it was updated (which might happen once a minute or more). The get_trend() could be called quite frequently while there's not much reason to call the others more than once

Renaming that function and a doc update would work here

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.