magico13 / PyEmVue

Python Library for the Emporia Vue Energy Monitor
MIT License
185 stars 36 forks source link

Emporia API stale data #58

Open bripley6 opened 6 months ago

bripley6 commented 6 months ago

I have a very curious PyEmVue API behavior that started in November (or at least that's when I noticed). The API is is returning stale hour data and not returning any minute data. Every five minutes I read the power utilization from my PG&E Smart meter via Emporia Vue Utility Connect for the last five minutes as well as the hour cumulative power. The minute data will be 10 min old or older as will the power usage for the hour. But if I pull up the meter on my phone from the Emporia App, the data will refresh. Then if I pull the data from the API it will show current minute and hour data. So it seems like the App is triggering a refresh of the data available in the API, but reading the API itself does not trigger refreshing this data. Anyone else observing this or is there something specific going on with my setup?

Emporia also just replaced my Vue Connect in early November because the prior unit was getting disconnected from the PG&E meter after a week and I had to keep calling PG&E to get it reconnected.

bripley6 commented 6 months ago

Looking back through my logs, I see on Nov 30 the API started returning all zeros for last 5 minutes of per minute data. But then for hours at a time, it will return data for 1 out of the last 5 minutes consistently. Then for hours at a time it will return no minute data for last 5 minutes.

DabblerIOT commented 3 months ago

Couple questions...

Is emporia app returning valid data?

Api from emporia isn't great. Can you update to "master" branch via hacs? Working through how to deal with missing data in responses, and retries and down devices. Turns out more complicated than it seems.

DabblerIOT commented 3 months ago

18.4 is pretty much ok, but will retry down devices much more than necessary.

bripley6 commented 3 months ago

The data in the Emporia app is several minute stale, but upon opening the app, maybe 30 seconds later, it gets fresh data. The data looks valid. But all the old data is always there in the app right away. So it seems like Emporia batching the updates from the Vue, unless the App is open. Even with the app open, it looks like it batches the updates every 30 seconds. Yeah, I had to add a fair amount of error handling to deal with the various data missing. Not surprised this is complicated to handle. Thanks!

DabblerIOT commented 3 months ago

From doing data testing using a javascript test code and proxy.. using the 1MIN data, the api updates app about 50% of the time if requested on the minute... every 2 minutes almost always have new (changed) data. (Tested this because I was annoyed I wasn't getting new data / changed value once each minute in history)... Haven't tried with one second data filter yet (say once a minute to see if it has new data). I think it will. Will run some tests.

I don't think the app being online or not has anything to do with the injest of data from data from meter to emporia cloud. Not 100% sure, but I don't think so.

Cheers.