Hey everyone, I wanted to share my experience with integrating my city’s water meter data into Home Assistant. It’s been a fascinating journey, and I hope this helps someone else who might be dealing with similar challenges!
So, here’s the deal: My city’s water utility provides daily meter readings through an API. Someone in the community figured out how to access this API and wrote a script in PHP, which I adapted to Python. Now, I can pull the meter values, but there’s a catch – the most recent reading is always two days behind. For example, on August 30, I can only query the data from August 28.
I’ve been trying to find a way to tell the Utility Meter integration in Home Assistant that the value I’m providing corresponds to a specific date. The goal is to have a sensor that updates every 24 hours and inserts the value into the database as if it were from two days prior. For now, I’ve taken a bit of a workaround approach by creating a REST sensor named ‘sensor.water_meter_two_days_ago.’ It’s not the most elegant solution, but it gets the job done.
Here’s a snippet of the JSON data I’m working with, which might help others understand the structure:
{
“intervalList”: [
{
“intStartDate”: “2021-08-23 00:00:00”,
“intConsumptionTotal”: 0.5,
“lastReadValue”: “00915.0”
},
{
“intStartDate”: “2021-08-24 00:00:00”,
“intConsumptionTotal”: 0.5,
“lastReadValue”: “00915.5”
}
],
“unitOfMeasure”: “m3”
}
I’m curious if anyone else has encountered similar delays with utility meter data and how they’ve handled it. Any tips or suggestions would be greatly appreciated!
节水从我做起!
Cheers,
[Your Name]