I trying to create a chart which shows the hourly cost of current coming from tibber. I do have all cost in seperate items per hour stored. Furthermore I have a seperate switch for every hour of the day where I can manually allow a set of devices to operate during that hour based on my hourly price calculation like the heating or the dishwasher. That works fine so far.
However, I would like to display the hourly price course for the day in a chart plus in the same chart the status of every switch for that hour simply with a bar if it is on. Furthermore, I want the chart to be updated everytime a switch changes manually.
Can someone point me in the right direction how do I dynamically create such a chart using javascripting and feed the data to it?
Charting and rules are completely separate and independent. Charts show what’s in persistence so to chart anything you need to configure persistence to store the data as you want to chart it.
In this case, you could use the in memory persistence and instead of or in addition to storing each data points in a separate Item you add an entry into the database by persisting a time series. As oh OH 4.2 you can persist future values (except with rrd4j and MapDB) and the in memory persistence was created for ephemeral days like this which doesn’t get written to the file system.
Once you have the data in persistence it’s just a matter of configuring the chart, which I’m not going to be off much help with.
The Tibber binding already supports persisting future prices for the current total coast channel, see Tibber - Bindings | openHAB.
You just need to have a persistence configuration with strategy forecast in place for the Item that is linked to that channel, and you should then be able to display a chart from it.