Using HA with Tibber and EcoFlow battery to shift energy use to hours with lower prices and lower CO2 intensity

(cross post from Reddit)

Hi all, I wanted to share my setup with you guys. Electricity prices are kinda crazy right now, and everybody should agree that using renewable energy more efficiently should be on the top of our collective todo list. Unfortunately I do not have the space (not even a balcony) to install solar panels, but I came up with a way to use more renewable energy anyway. A virtual solar panel, if you will.

The idea is simple: Use a battery to store energy when the sun shines, wind blows, and electricity is cheap. Use that stored energy when there is a dreaded dunkelflaute and/or the electricity prices are high.

I get my electricity from Tibber, which means I can get the current and future electricity prices of the day via their API: [Link removed since I am new here]

Tibber is also easily integrated into the energy dashboard of HA, though that is not important for this project.

As battery storage I use an EcoFlow River Pro, which is very comfortably integrated into HA with this plugin by GitHub user vwt12eh8: [Link removed since I am new here]

I then wrote two AppDaemon applications to tie these two together. The first one calls the Tibber API to get the current and future electricity prices. It then creates a plot which I can show in HA as a “webcam”, and it provides the price information to other apps via a global variable: GitHub - ast0815/appdaemon-tibber-plot: AppDaemon app to make tibber price plots

The second app takes the price info from Tibber and determines the best charge plan for the battery, using the A* (A-star) algorithm: GitHub - ast0815/appdaemon_battery_manager: Use current and future electricity prices to plan the charging and discharging of batteries

The battery manager app then also actually controls the battery via the entities provided by the EcoFlow plugin, as well as an additional smart plug that is needed to disconnect it from the grid when I want to use the stored energy.

Finally, I also added a function to the Tibber plot app to also display other arbitrary time series, so it can also display the projected charge plan:

image

^ Example price plot and charge plan from my setup. The A* algorithm determined that it is cheapest to charge the battery (rising grey lines) during low-price hours and use that charge (falling grey lines) during high-price hours. It does consider round-trip efficiency so sometimes it is just best to store the electricity and neither charge nor discharge (flat grey lines).

I do not actually pay hourly electricity prices yet, but I should get that sorted in the next couple of weeks. Until then, this is is actually costing me more, since the EcoFlow itself also uses up some power. It does however already shift my power use to times of low prices, which is well correlated with the fraction of renewables on the grid.

Even when I switch to the hourly electricity prices, I doubt this will ever actually pay off financially. Though that very much depends on how the electricity prices will develop, and whether there will be more or less cost saving possible due to this arbitrage. My main motivation is to make my baseline power loads less CO2 intensive though.

Let me know if you have any questions or suggestions!

5 Likes

This is quite amazing !

What kind of data do you get from Tibber ? Hourly rate how much time in advance for example ?
I don’t know if you’ve been with them long enough to know what kind of variation you can get in any day ? Are there any upper/lower limits ? Or a guarantee on the average price ?
I’ve tried to look up that information on their site but it’s all in non-english languages and hidden behind a ‘calculator’ that requires a postcode (which I don’t have as I live in an other country.)

I would love to have something like that. Since I control all of the biggest energy consumers I could really optimise things around.

Speaking of which, do you plan to/have the possibility to control other stuff using that information ? Do you have electric heating or hot water ? An EV maybe ?

Hi @Spottyq

I get the hourly prices one day in advance at 13:00 each day (at least currently, maybe that time will shift when we switch back from daylight saving). So in the morning I know the prices until midnight the same day, and then in the afternoon I also know the prices until midnight the next day.

Their pricing works like this: I pay a monthly base fee of a few bucks (around 6 or 7 EUR I think), and the hourly prices are exactly the prices that electricity costs on the day ahead trading market (plus all the necessary taxes etc.). Their business model is (according to them) not to earn money by selling more electricity, but only through the base fee.

There is no limit on the price or any guarantee for an average price point. That means if the prices go up, I immediately pay more, but if the go down, I also immediately pay less. In the last months I have seen prices go up above 1 EUR/kWh on some hours of some days, but as you can see in the example plot above, they also go down to 0.15 EUR or potentially even lower. Prices could even go negative, though I have never seen them do that after taxes and such. The pre-tax prices do go negative every now and then though.

I am trying to use the information to shift as much of my electricity usage to low-price times. Some things are easy to shift around, like when to switch on the dish washer or the washing machine. My hot water comes from a direct heater (i.e. no storage tank), so I also try to take showers when the prices are low, but you can imagine that sometimes you just need a shower right now. :grinning_face_with_smiling_eyes:

I am also thinking about turning the fridge into a “cold battery”, i.e. cooling down at low prices and let it slowly heat up at high prices, but that is a bit more complicated for various reasons. E.g. the power draw rises quite a bit when you set it to lower temperatures, and it also is not very fast at reacting to changes in the set temperature (even just starting the compressor again can take >20 minutes for my fridge). And then there is the challenge of interfacing the dumb fridge with my smart home in the first place. Would definitely require some ESPHome hackery.

Interesting. :slight_smile:

So in the worst case, you know the price half a day in advance. It is certainly possible to do some optimisations with that.

It’s good to see that it is relatively transparent, but I do feel like a bit of consumer protection in the form of guaranteed average price or maximum price.

Do you plan to actually change the setpoint of the fridge ? Or just to cut it’s power ? How much energy do you expect to be able to move around a few hours like this ?

Here, have some unasked information that might help you decide on whether or not to switch to an accumulator for hot water :
Our usage (condo, 2 adults, 200l accumulator with resistive heating) is around 6,4kWh/day (including loss through insulation). I’ve measured* the loss to be at a maximum of 1,8kWh/day. So for me, this means a usage of a bit more than 6,4kWh/day that I can move anytime I want during a 24/36h period. It does however cost around 1,8kWh/day (that you don’t have with direct heating).

If you have the possibility (uncondionned space or ability to vent outside), go for a heat-pump unit. They are way more efficient and in my calculation (before the energy crisis !) rentable in around 6 days.

*I measured this consumption once when we weren’t home for a few days. So, there was 0 (hot) water usage, but the accumulator still needed that much energy just to keep itself warm.

There was another power company that had a tariff where they were limiting the maximum price. But when I last checked, they were not accepting new customers because of the price hikes. No risk, no fun! :stuck_out_tongue_winking_eye: I added two entities to my HA now that calculate how much I pay for the electricity of this setup and how much I would have to pay if I had just plugged everything into the wall socket. Will be interesting to see how much I actually save. :smiley:

Unfortunately I do not own the flat I live in, so I cannot change anything about the water heating situation. If I did, I would probably try to make everything that can be a heat pump a heat pump. :laughing:

If possible I would change the set point of the fridge. Avoids bad surprises (like it just staying off if I made a mistake) and it means the light still goes on when I open door. :wink:

I am just starting to look into this and want to do a little “Simulation”.

To do this I would like to create two entities, one that calculates the cost of my electricity used at the current static price and one that works off the current Epex prices (I managed to read them via the awattar API since I don’t have Tibber yet).

I will see how far I get with this, but might need to ask for help along the way.

Update:

I created my two “Price” Templates and will see whether they perform as hoped.

- name: "Stadtwerke"
        unit_of_measurement: "EUR"
        device_class: "monetary"
        state_class: "total_increasing"
        state: >- 
         {{(states("sensor.poweropti_bezug_heute")|float(0) *0.3314)|round(2)}}


      - name: "Tibber_Simulation"
        unit_of_measurement: "EUR"
        device_class: "monetary"
        state_class: "total_increasing"
        state: >- 
         {{(states("sensor.poweropti_bezug_heute")|float(0) * states("sensor.epex_brutto")|float(0))|round(2)}}

I did something like this to try to work out how much I am saving. Turns out after conversion losses and the EcoFlow’s own power draw I am not actually saving anything, money wise. :sweat_smile:

The result is probably different though if you have e.g. a large DC load on it rather than a small AC load (avoiding an additional voltage conversion and reducing the relative effect of its own consumption).

Regarding your sensors, I am not familiar with the “total increasing” sensors. Does this actually integrate the current price if you do it like this? It looks like it is just taking the total consumed electricity and multiplying it with the current price, rather than counting up the current prices. I did mine using a template sensor that calculates the current cost per hour and then an integrating sensor to calculate the total:

template:
  - sensor:
    - name: "EcoFlow RIVER Living Room Running Cost"
      unit_of_measurement: "EUR/h"
      device_class: monetary
      state: >
        {% set price = states('sensor.electricity_price_am_fort_elisabeth_17') | float %}
        {% set power = states('sensor.lumi_lumi_plug_maeu01_electricalmeasurement') | float %}
        {{ (price * power / 1000) | round(4) }}
    - name: "EcoFlow RIVER Living Room Virtual Running Cost"
      unit_of_measurement: "EUR/h"
      device_class: monetary
      state: >
        {% set price = states('sensor.electricity_price_am_fort_elisabeth_17') | float %}
        {% set power = states('sensor.river_pro_living_room_total_output') | float %}
        {{ (price * power / 1000) | round(4) }}

sensor:
  - platform: integration
    source: sensor.ecoflow_river_living_room_running_cost
    name: EcoFlow RIVER Living Room Total Cost
    method: left
    unit_time: h
    round: 2
  - platform: integration
    source: sensor.ecoflow_river_living_room_virtual_running_cost
    name: EcoFlow RIVER Living Room Virtual Total Cost
    method: left
    unit_time: h
    round: 2

Oh, also at least in Germany you do not get the “raw” market place prices from Tibber. There is also taxes and grid costs on top of that. So nothing Tibber itself has any control over (as far as I can tell), but I have to pay for regardless. So even if the raw price would dip slightly into the negative, I would probably still have to pay for using it rather than getting paid to do so.

You are of course correct. I had to do some additional work on those sensors, implement an hourly reset and then reintegrate into a utility meter helper.
But it works now.

Speaking of “Raw prices” in Germany, I added the fees (13 cent and 19% VAT) so that I see the actual price. Will now monitor it for a time

I have a 10kWh PV Battery, a Tesla and soon will have a Heat Pump, so should have plenty of high usage electric devices I could automate to use “cheap” electricity.