I know there is an Open Meteo integration but it doesn’t provide the data I want (if anyone knows how to extend it to get the data I want that would be amazing!)
However it’s available through an api call - I want the 15 min rain prediction (which I can get as I live just within ICON D2 weather) which I can get from here (location I used isn’t my home!) (Link to API call)
The data it returns is complicated by it returning a table of three columns, but each data set is a column not a row…so the first array being the dates, the second array being the precipitation data, and the third being the rain data (no I don’t know the difference. I think precipitation includes snow).
This means that if you take the nth item in each of the three arrays, you get the data for that moment in time (a row across the data). Great, except I don’t know if HA can handle that format. I presume HA wants an array where each item is a (date, precip, rain) complete tuple for a moment in time, a row of sorts.
I have never tried to bring in bulk data like this, only sensors with single data values.
I want to draw a chart that shows rain expected in 15 min intervals, ie plot each row in the table
Oh cool, how do you do that? It looks like you do what I want, but key here is that the data is all forward looking, not historical, so every refresh has to load 100 x each attribute (or thereabouts). Usually obviously you save individual points into a sensor and it aggregates all historical values, bur not here. I can’t see how to load that kind of array in from docs.
Also, there must be a way to prevent HA keeping historical data for this sensor, as there is no benefit to historical data when its all forward looking - each refresh entirely can replace the data held.
The attribs start complaining post 16k characters. I doubt you will use that but in such a case you can create multiple sensors maybe.
EDIT:
If you think to need multiple sensors then look at the RESTFul integration instead, it performs 1 (one) call to the source so may avoid limits to be reached too soon
Thanks, I have that page open on my other screen already but if you look through the examples they are all single value, historical looking time series examples (eg the state of x entity now is value y, creating a backwards looking time series table of data as those data points are incrementally stored) - some may load bulk values to populate lots of single value attributes but none of them load bulk values into one attribute that I can see.
I’m looking for an example that loads a dataset of time-data and data points that are, in themselves, a point in time data set on their own (that gets updated, in full, every x minutes). The data I need to load is in the API link at the top and that will be done via a singular RESTful call that’ returns the data you can see if you follow the link.
I donot understand what you mean
Based on the API link you sent, the attributes path is :
$.minutely_15
and the attributes are :
time and precipitation
That would be in the new sensor then and then you can use Apexcharts
EDIT : using a data_generator via the link I sent
I didn’t realise you could store lists as complex objects within attributes, I thought they could only be simple singular objects (you can’t store arrays, but lists and dict objects are acceptable).
So for my sensor, there would be three attributes: datetime-list; rain-list; and precipitation-list. Each time I refresh, the data received (three datasets) would be split into 3 and stored as three list-formatted attributes.
Now I just need to work out how I put that data into an ApexChartt, such that the attribute datetime-list is x axis and rain-list is y axis, so creating a time series chart I want. I can see you had this conversation in this thread: How to draw curve/ graph card with own values, not sensor values? - #13 by vingerha using plotly, where you can define the data on the x and y axis independently not rely on stating an entity to plot). Can you do the same with Apex and state the x axis values as I can’t see it on the GitHub README?
Does that make sense?
(NB with regard to changing the retention period for this sensor, it doesn’t seem you can, but you can create a service call to purge a single entitiy via the Recorder service I think)
Ooooh sorry I didn’t read that Apex page in the right context. Got you.
So I just need a loop function that iterates down the lists from the entity attributes outputting an array of [time, value] tuples into the data generator.
Amazing, thank you!