I was able to get this to return back the meter reading as a sensor entry. (replace “YOURMETER” with your meter UID and “YOUR_BEARER_TOKEN” with your unique information.
However, the data is 24 hours old, and Home Assistant’s built-in sensor platform doesn’t support backfilling historical data directly. The sensor state in Home Assistant is always the current state, and it doesn’t allow for manually setting timestamps of the past states.
My next thought is to try:
Database Insertion: directly inserting the historical data into the Home Assistant database (SQLite).
Custom Component: create a custom component that uses the history.set_state service to set past states.
Third-Party Tools: There are third-party tools and add-ons like InfluxDB that can store time-series data.
I’m already running mariaDB, but I’m just not sure how to create a custom sensor that can render in the energy dashboard with the historical data I can create/load. It sounds like this is something the community is looking for as well…
Hey @dhellerstedt, thanks for the information, this is great. Quick question though, how much are you having to pay to get this data from UtilityAPI? From what I can tell, all of their pricing is geared towards businesses. It looks like if I wanted to get daily usage for my meter, it’d cost $30 per month. At that point I’d rather just go into my utility company’s dashboard and export the data. Is there some way you’re getting around that? Or do they have a personal-use version? Thanks!
Your right, it is geared toward businesses. I would not recommend you pay for this. I suspect my utility company uses utilityapi as a data platform/aggregator. My guess is that each utility company negotiates the number of calls they get monthly which also allows for some predetermined access for the utility’s customers. In my case my Consumers Energy account allows me access to the data associated with my meters at no cost (I think P&E does too?). Why build my own RTL-SDR meter reader if I can just get it free from the utility? The problem is that the data access for my account level is only updated once a day (so it is at least 24 hours old) and its only “read” in hourly increments. But hey, it is better than nothing.
Note the energy panel works off of statistics, not regular history. So you don’t want to insert records into the history table but into the statistics table. A rest sensor is probably the wrong way to go for that.
With this integration that should work. You can create the needed import file (e.g. csv) and call the service to import the data directly afterwards. Let me know if you are successful.
Have you made any progress on this? I am looking at integrating this as well.
Also, I too have consumersenergy. It’s been awhile since I set up the Utiltiy API account so I don’t remember setting it up. I am not seeing any payment settings on my Utility API dashboard, but the utilityapi pricing pages are confusing. Are you successfully daily monitoring without being charged? I am slightly afraid to turn it on because I don’t want to rack up a balance, but again I don’t see anything in my account indicating any payment methods or charges.