I am using a RESTFul Sensor which returns the following JSON object. In the example above, the data for the 12th is shown from approx 10am onward on the 13th until approx 10am on the 14th at which it updates to show data from the 13th.
This pattern applies every day.
{
"status": "OK",
"usage": [
{
"week": "07 Apr 2024 - 13 Apr 2024",
"days": [
{
"date": "07/04/2024",
"litre": 0
},
{
"date": "08/04/2024",
"litre": 0
},
{
"date": "09/04/2024",
"litre": 0
},
{
"date": "10/04/2024",
"litre": 0
},
{
"date": "11/04/2024",
"litre": 0
},
{
"date": "12/04/2024",
"litre": 235
}
],
"target": "",
"average": "",
"tracking": ""
}
]
}
I want to build a simple bar chart that shows the date above and the litre use for that day. I have tried putting the date and litres into json_attributes but I then have trouble charting the data because it is stored in attributes.
The other issue I have is the because the data for each date can span across several days due to it not updating at midnight.
My thoughts were to recognise when the data fetched is more than 2 days before the current date then drop that data and not record it - as it is a carryover before 10am. Not even sure if this is possible.
Any ideas appreciated on how to get this working.