How to Integrate Daily Download of Historical Water Use

I’m trying to integrate my water meter into home assistant for displaying usage and detecting leaks. My water company has given me access to a REST webservice which returns historical (but not current) usage information. For example, I can query the webservice today and receive yesterday’s usage (e.g., 24 hourly readings of total gallons used) but I cannot get the current usage (i.e., gallons per hour).

I have succeeded in using a command line sensor to run a bash script which downloads yesterday’s data and reform it into an array of date/time, usage pairs. I have also used a json_attributes parameter to extract one array element into an attribute (and I can probably make this work for the other 23 elements) but I want the data to be shown at the correct date/time, not the date/time of script execution. Any ideas?

The only thing I can think of is to insert the data directly into your database.
Probably not a good idea!

But that hasn’t stopped anyone from trying :slight_smile:
Let HA it insert one reading into the database, then inspect the database and insert your data accordingly. That could/should/might work …

Edit:
Or you send the data with a 24hr delay to HA. It will give you the correct pattern just on the wrong day.
Not a good solution if you want to find a leak! But even with your current solution you could be 24hrs too late!

Hi did you ever find out a way to do this? I am wanting to do something similar, with hourly data from my energy company that gets updated once per day