magico13 / PyEmVue

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

Question about A/B testing vs. Emporia app #47

Open dglcinc opened 1 year ago

dglcinc commented 1 year ago

Love this project! I have a project with a home monitoring system (https://github.com/dglcinc/pivac), that includes power panel and various HVAC sources, which get collected and reformatted as JSON streams to a Signal-K server (https://github.com/SignalK/signalk-server) that saves off the metrics to InfluxDB for Grafana charting, and a third party IOS app (WilhelmSK) for visualization.

For power monitoring, I was using an ancient power panel monitor called TED5000, which had its own local webserver/database/charting and with a real-time XML feed. I grabbed the feed and reformatted as JSON for my project.

For my new EmVue, your module makes it a snap to create a JSON formatting plugin for my app (which will be saved automatically to InfluxDB for me by Signal-K. I got all the sample code working - the biggest trick was figuring out how to get the instant and scaling parameters set right. BUT - I'm still a little suspicious that I'm not getting the same data that I see if I run Emporia's app. It's in the same ballpark, but not spot on like I used to see with the TED5000 web page vs. their XML feed. For any given second, looking at kwh, I'll see about (for example) 4kwh from my PyEmVue call and 3.5kwh for the IOS app, for any given second.

Is there any way to see the API calls the Emporia app is making, or otherwise sync up my calls vs the app? Ultimately I'll stop using the app and use my monitoring solution to show both realtime and influx/grafana charting, but I want to make sure I'm synced up vs. "the real thing".

Any thoughts on how to be convinced I'm getting the same data in both the original app and my own version that's calling the APIs? Is there way I can see the API calls each version is making? I only care about second-to-second realtime, because I'll be using Influx and Grafana for the database and charting.

Thanks again for an awesome repository!

David

magico13 commented 1 year ago

The easiest thing I could recommend is to use the web version of the Emporia app and you can monitor the API calls used via your browser's built in network tools. https://web.emporiaenergy.com/#/

I will warn that Emporia has asked that people not request data each second to prevent excess load on their servers. There are ways to reflash the hardware with a custom firmware (usually ESPHome) to provide fully local access if you want high refresh rates.

dglcinc commented 1 year ago

Ah yes, browser app and network monitoring - good idea! I had seen the issue on API spamming, but I thought that was a higher frequency. Let me think about some other options to avoid being a bad guy or getting blacklisted. Is there a frequency they consider acceptable? Isn't the app polling this same frequency or is it doing some other trick?

ESPHome looks workable, great pointer, but some pretty hard core modding. Doable for me but holy cow that's a lot of wetware work for what I want. Would rather do in software and wait for Emporia to provide a supported local option (may be waiting a long time I would bet...)

dglcinc commented 1 year ago

On the API spamming, I thought the issue was, people calling for big data spans repeatedly over short time frames?

dglcinc commented 1 year ago

Never mind on the API spamming question, I (re-)read the entire thread. I get it. Let me think...