-
Notifications
You must be signed in to change notification settings - Fork 36
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
Usage / Help / Noob question about vue.get_chart_usage() #74
Comments
You have the timestamp on the return, it's got both the array as the That's how the API returns it, just an object with the start time and the array. PyEmVue just breaks that down into the separate start time and array for you. {
"firstUsageInstant": "2024-03-25T17:00:00Z",
"usageList": [
10.424385189073352,
7.471311534423828,
7.318404381035698,
4.165096328756545,
4.105301690809462,
3.9123346340455862,
3.976239875859063,
0.9884760541195339,
1.0746342893473306,
1.4215298784891766,
1.36026680776808,
1.3698353627819486,
1.0674718824132283,
1.366136849475437,
1.0834297193654379,
1.3024822784042358,
7.448987753164503,
6.793357279518975,
2.5673693082427977,
2.6854740752156574,
1.363816265258789,
2.9800974993981253,
1.4480037266286214
]
} Doing some post processing on your code, I can get the following:
All I did was add the following after the call to print out the data with the timestamp. You could create an object for each with the timestamp and usage data in it, or use a dictionary, or just work off the index, whatever you prefer. for index in range(len(usage_over_time)):
timestamp = start_time + datetime.timedelta(hours=index)
usage = usage_over_time[index]
print(timestamp, usage) |
I don't like this either, but the emporia api passes back only the time/data stamp of the first entry, then you have to assume that each entry is 1 interval earlier in time. Makes my skin crawl. I'm pretty sure the timestamp is passed back in the data from the function (python is weird, I'm with you there). Think there may be an example of getting the timestamp from the response somewhere in the home assistant project that uses this module. Neither here nor there... have you tried home assistant recently? It has come a long, long way from where it was years ago. The emporiavue-ha and home assistant energy project together really give a nice solution. Read as -- alot of the work you may be doing, may already be done for you for free, and very nice. It's actually been worth a couple weeks of aggravation sorting out home assistant and how it works. (I started along a path similar to kind of things you are doing, but by hitting emporia api directly, using a no cors proxy server running local and javascript). Home assistant project is here.. To see what data is coming back, so you can see what the input is this project is dealing with. Cheers. Some examples of ha built in stuff.. (selected march 1st to 25th)... you can make similar stuff for power, but you need to built that stuff on your own.. Attached one of mine I use to keep an eye on things as well. |
I don't know python.... I can add print() statements but that's about it. I've done PHP for 20 years... but python for a few hours.
I have ( soft of )
working, but it returns:
[0.7672705789926317, 1.8751684053876665, 0.2608834574564298, 0.23772852579858567, 0.13907248973713981, 0.1145523709511757, 0.30305081161790426, 0.590115064485338, 0.5058421620337169, 0.5687163838778602, 0.6837475850900014, 0.6059227556525336, 0.4320985894287957, 0.2334514087846544, 0.2070333262708452, 0.2283613010480669, 0.21064682039154903, 0.22187652250289921, 0.20606931520779925, 0.42583842778523767, 0.17964073262161678, 0.12094377203623455, 0.07348710065007209, 0.05630943610800637, 0.1442509578291575]
I don't have an EASY way to know which times those values are associated with? I can guess... or have the script guess... but if an array of kwh AND timestamp of some sort was returned, that seems like it would be easier to work with. Any way to get that done with the current code?
The text was updated successfully, but these errors were encountered: