Control a water heater and ground source heat pump based on cheap hours of spot priced electricity

I have implemented this in the graph that shows me the spot prices and control values, see screenshot below, which shows the average price as a dotted line.

The YAML looks like this:

component: oh-time-series
  gridIndex: 0
  item: spot_price
    color: "#4E6AC4"
    opacity: 0.5
      - label:
          distance: -150
        name: Avg
        type: average
  name: Sähkön spottihinta
  step: middle
  type: line
  xAxisIndex: 0
  yAxisIndex: 0

1 Like

Will Markus’ cool “ground source heat pump” javascripts work directly in OpenHab 4.0, which now uses GraalJS/ECMAScript 2022? I wonder if it’s safe to upgrade OpenHab 3.0 to OpenHab 4.0 for that?

I haven’t had time to test that yet myself but I would also be super grateful for this information if somebody has tested this…

Hi folks

I’m on V4.0.3 and haven’t encounterd any problem yet, use multiple scripts for diffrent stuff, EVcharger,P Pool heating x2, Pool filtration x2, Nibe heatpump.


I am on OpenHAB 4.0.2 and it works and is stable. 5/5


I’ve revived my old EntsoE binding for testing if you’re interested:

1 Like

Anyone else having trouble getting day ahead spot prices for Finland today? I can not download them.

Edit: It would be nice to have this automated, so that the rule retries with e.g. 30 minute intervals until the spot price can be fetched. Any ideas how to implement?

Edit2: @gitMiguel s EntsoE Binding Thing gives “Offline” error when the Entso-E does not provide data. This could be used to recognize failure.

Edit 3: I still have not figured out how to get this to retry upon failure.

There are a couple of approaches here but even the automatic retry won’t guarantee that we have prices for tomorrow. Entso-E might be down for a longer period i.e. tomorrow starts before Entso-E / spot prices becomes available.

One way would be to create a new Item called “Last successful spot price fetch” or something similar.

Then the Fetch Spot Prices Rule could be running every 30 mins and the first thing the Rule Script would do is to check whether the “Last successful spot price fetch” contains a value that the spot prices have not been fetched yet. If they have not been fetched yet, then proceed with the fetching. If they have been fetched already, we would have an early exit.

Another approach, which I actually like better is that we would not have that extra Item, the Feych spot price Rule Script would check directly from the database if we already have prices for tomorrow. If yes, exit early. If not, proceed.

Finally, there could be a separate Rule which would be executed for example 15 mins before midnight. If we still don’t have spot prices at that time, clone the control values from yesterday.

I don’t have time to implement these at the moment (curling season is at full swing at the moment + I’m building a sauna at the moment) but these concepts are here so if anyone wants to implement these.


1 Like

3 posts were merged into an existing topic: Energy management and scheduling

Something wrong here,slicing does not work anymore

slices = 2;
min_heating = 0.4;

Seems this bug has crept back in?

I haven’t changed the published files in comment #13 in many months. In other words, the scripts behave exactly the same as these versions have been behaving earlier. In yet other words, either this behavior has been there forever (in theee versions) or your local setup has something that causes your unexpected behavior.

1 Like

I updated the script to the one this post is a comment to. Does anyone else still see this behavior:

For some reason the algorithm selects the expensive hour at 15:00 instead of the cheaper hour at 20:00.

If you have 3 slices, those are 00-08, 08-16 and 16-24. If you’re forcing that each slice must have at least some heating, isn’t this expected behavior?

Indeed. I thought I had 2 slices, but alas, it was 3.

I updated the nibe.js.txt published in #13 and it should now be working as expected. Would be kind enough to test it? (First back up the version you are currently using).


1 Like

Tested it. Seems to work as exptected with both 2 and 3 slices.

1 Like

Finland is changing to winter time today. Maybe the rest of Europe is partaking in this ritual, too? In addition to all other problems this outdated redundant practice causes, it also prevents this script from calculating heating hours correctly today and twice a year when the change between summer and winter time happens. See the post this post is a comment to how to get heating to work right during the transition.

Something strange happened to me too. I use nibe.js to control the electric floor heating (fixed 8 hours, 1 slice), and also waterheater.js (3h) to control the electric boiler. The boiler control (on: 29.10 03:00, off 29.10 06:00) seemed to work but the electric heater had stayed on (on: 28.10 23:00) and is still on (29.10 15:21). Certainly will be corrected at the end of the day.

Does anyone have experience from Ohmigo?
They seem to have some nice spotprice devices and also an analog temperature sensor (resistance)
that can be controlled over Wi-Fi.