I want to use the API of forecast.solar to create a nice graph and match the forcecast with my actual production. The API returns values for the whole day (and the day after). Is there an easy way to add these values to an item, so the values are in a rrd4j file?
Another possibility I see is to add them via another API call directly into influxdb (which I use to create Grafana graphs).
Anyone has some experience with this?
Short answer is no. OH will save states of Items with
now as the timestamp.
You have a little more freedom to set the timestamp if you insert values via the openHAB REST API. But the openHAB charting itself doesn’t, as far as I can tell, have the ability to chart into the future. It only offers from now to some point in the past.
Using InfluxDB and Grafana is probably your best bet. Anything else will require changes to OH itself which, while not impossible nor unwarranted, will take some time (assuming someone volunteers to make the changes in the first place).
Yes I do have experience with that, but using sql database. I do calculate energy for present hour, day, month, year and store it at end of that period. It is doable but you need to do that from rule or other low level element. You can call
ModifiablePersistenceService methods and store data ahead of “now”.
I am not exactly sure how rrd4j works, as it is somehow controlling amount of buckets, so there you might be swimming against the flow.
How is this exactly used? Do I need to import this? I’m still using ruleDSL.
I can’t tell you exactly cause I call it using java code (a
norule engine I made):
state = ...;
persistence = (ModifiablePersistenceService) PersistenceServiceRegistry.get("jdbc");
persistence.store(new StubItem(item, state), createDate("2022-06-30 23:59:59"), state);
Reason why I have a
StubItem is because jdbc persistence service calls
item.getState instead of using state passed as third argument to the
store(Item,Date,State) method. Note - for OH 3.3 second argument will most likely require
Comment; I wouldn’t bother even trying this with rrd4j. It works with pre-defined storage space, like a set of pigeonhole boxes, there just aren’t any boxes defined for the future.