Scrape 1 second power from web power meter?

My Web page sense power updates about once per second. Is there any way to scrape the changing numbers into data log file? Intercepting or monitoring the raw web page data? Continuous OCR of the image? Thanks!

Yes, you can scrape the Sense web app for higher resolution data with a few caveats. I did it a while back.

The caveats:

  • The Power Meter only gives up relative data for both time and power, plus scales for x and y relative data so you need to do your own transformations back to seconds and watts.
  • New development of the current web app has ended, and it is on life support, so there is some risk if you want to rely on it for critical data. I don’t think the risk is high, because Sense seems to want to keep it around for a couple of critical features not found in the new app infrastructure - Data Export and the informal API that powers the Home Assistant.

If you have any familiarity with python coding, the real-time calls in the API might be better for you, though you will need to maintain your own database.

I was hoping to just use the displayed power number as already received by my computer and displayed on my sense webpage. I would just like to “read” the changing power number (actually the solar power number) that is already updating on the web page at about once per second (if that is possible or practical).

Not sure if that power number has been conveyed to the webpage as a number, or if it is just an “image” of a number formed by the sense server? e.g. just repeatedly “read” the number below as it changes and log to a log file.

@joegeller,
That might work, though you would need to continuously scrape and sample. You should take a look at the code behind the display. As I remember it, there are some dynamically updated entries that are are hard to access.

The real-time API might be easier to use.

I will look more closely at the API and sample code. Thank you

1 Like

The Python API will send an update once per second with the realtime interface. Just make sure to use the stream method so you stay connected to the websocket rather than reconnecting each time

3 Likes