question

Christian Butterweck avatar image
Christian Butterweck asked

Spotmarket-Switcher - a cloudless Dynamic ESS alternative + Switchable Sockets + Tibber + aWATTar

Hi, i was thinking about how to use my ESS System during winter and created a little script to charge the battery depending the spot market prices (Epex hourly).

Victron-ESS & Shelly Plug S & AVM-Fritz-DECT200-210 Spotmarket-Switcher

https://github.com/christian1980nrw/Spotmarket-Switcher

1696548598453.pngShell script that manages Victron Venus OS ESS-Systems & Shelly Plug S & AVM Fritz!DECT200 / 210 switchable sockets so that it charges / switches, when spot-market prices at Tibber or Awattar are low.
If you like you can also activate additional load (like water heater) by using AVM FRITZ!DECT 200 or 210 switchable sockets. If you have spot-market energy prices, you are able to charge your battery if the price is lower than your own feed-in tariff or you can use cheap prices of wind energy at night.

This allows you to use your battery even in winter without sun.

You need a hourly based dynamic tariff for this but of course you are able to test this script before
you change your provider and think about a smart meter.
The prices (EPEX Spot DE-LU/AT hourly prices) are from a german energy provider. Since v0.8 a second free API from Entso-E with all european countrys is supported.

You can compare the prices here:
https://transparency.entsoe.eu/transmission-domain/r2/dayAheadPrices/show

1672269577356.png

Edit: v0.1 with some fixes is released now, please update.

Edit2: v0.2 Added some more charging hours, please update.

Edit3: v0.3 Added some improvements

Edit4: v0.4 Additional load by switch socket can be activated independent of charging now

Edit5: v0.5 code cleanups & bugfixes done

Edit6: v0.6 possibility to enter decimal points, added third charging logic, extended possible switchable sockets to six

Edit7: v0.7 Ability to abort nightly charging if enough sun is expected

Edit8: v0.8 Whole Europe is supported now

Edit9: v0.9 Code cleanups, please update

Edit10: v1.0 Solar API improvements, please update

Edit11: v1.1 Fixed Bug with single-digit calendar days, please update

Edit12: v1.2 Code cleanup / optimized Script runtime by using awk

v1.3 Added a Venus OS Installer script (should survive Firmware upgrades)

v1.5 Bugfix of Venus OS Installer (run script)

Edit 13:

v1.7 Added switching logfile / fixed bug #2

v1.8 Consideration of charger efficiency / Support of Shelly Plug S Wifi switchable socket

v1.9 Fix of Awattar API issue/bug #3
v2.0 new Entso-E API endpoint, please update.
The old REST API endpoint is planned to be discontinued by Entso-E on 14.02.2023.
v2.1 Tibber API integration & Entso-E API bugfix
Release notes see https://github.com/christian1980nrw/Spotmarket-Switcher/blob/main/release_notes.md Thanks to moeller@debian.org for joining the project. I appreciate it.
Please update as soon as possible.
v2.2 Consider battery life cycle costs, Added economic charge-check based on average prices
Fixed Tibber abort price calculation

If you live in Germany and would like to switch to a dynamic electricity tariff, you can support me and take out the tariff via the following link. We both get a 50 euro bonus for hardware. https://invite.tibber.com/ojgfbx2e In the tibber app, click at "i was invited" and enter the code ojgfbx2e in the app. Please note that you need a smart meter or a tracker like Pulse https://tibber.com/de/store/produkt/pulse-ir for a hourly tariff. Enter the first 4 digits of your meter number on that website to check Pulse compatibility.

Thanks and regards, Christian

modifications
1672269577356.png (57.6 KiB)
1696548598453.png (13.0 KiB)
5 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

jeroen avatar image jeroen ♦ commented ·

nice, for what it is worth, I solved your bc problem, https://github.com/victronenergy/meta-victronenergy/commit/add02fecbd4a74f39b12bcf345d6523bfd7c0ef0 but it will take a while to be available. Be aware that Venus uses opkg, not deb packages... and has a readonly rootfs by default.

2 Likes 2 ·
Show more comments
22 Answers
Christian Butterweck avatar image
Christian Butterweck answered ·

New Release: v0.2
Added some more charging hours so that bigger batterys will become full or can be charged with lower amps if your inverter is noisy at night.

charge_at_lowest_price
charge_at_second_lowest_price
charge_at_third_lowest_price
charge_at_fourth_lowest_price
charge_at_fifth_lowest_price

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image
Christian Butterweck answered ·

New Release: v0.3

...added a sixth charging-hour, added a use_start_stop_logic switch, always stopping charging at script runtime

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image
Christian Butterweck answered ·

New Release: v0.4

Additional load by AVM DECT 200/210 switch socket can be activated independent of charging now.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image
Christian Butterweck answered ·

New Release: v0.5

I think its finished now. I am done. Happy testing and saving.

Please give me your feedback.

Regards Christian

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

peregrines avatar image
peregrines answered ·

Thank You very much for your great work. I have been searching for something like this :)

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

patricknl avatar image
patricknl answered ·

Amazing that you are working on this! Hopefully something like this will be integrated natively in to VenusOS... Energy prices and feedback prices are going to fluctuate in the near future as solar and wind will be a bigger part in the energy supply chain. Prices already fluctuate around 0,20-0,50 per hour on a day to day basis in the summer... Anticipating on this and the weather could mean This script could be used to not only save some money but also make some money... (Depending on your system and intents).


I can't test this at the moment but (reworking our home network and automation system at the moment). Looking forward to experiences from other users.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image
Christian Butterweck answered ·

New Release: v0.6

  • possibility to enter decimal points of the energy prices,
  • added third charging logic (charge if energy including fees is cheaper than your own feedin-tariff of your solar system),
  • extended possible Fritz DECT 200/210 switchable sockets from 1 to 6
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image
Christian Butterweck answered ·

New Release: v0,7

Ability to abort nightly charging if enough sun is expected

Added solar weather report and possibility to cancel the charging if there will be enough sun.
Solarenergy today will be 2.8 megajoule per sqaremeter.
Solarenergy tomorrow will be 0.9 megajoule per squaremeter.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image
Christian Butterweck answered ·

New Release: v0.8, please update

Finally the script is supporting the free Entso-E API. See notes within the script how to get the API key. Whole Europe is supported now. See https://www.entsoe.eu/data/map/
Happy testing and saving.

Pleas give me your feedback.

Regards

Christian

2 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

oyfant avatar image oyfant commented ·
Will Sweden and Norway be included also?


0 Likes 0 ·
Christian Butterweck avatar image Christian Butterweck oyfant commented ·

Yes, it should be possible.
See https://www.entsoe.eu/data/map/

There are comments in the controller.sh how to configure the API.


Regards,

Christian


0 Likes 0 ·
Christian Butterweck avatar image
Christian Butterweck answered ·

New Release: v0.9, please update

Code cleanups.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image
Christian Butterweck answered ·

New Release: v1.0, please update

Solar API improvements, please update (Hourly query of solar data instead of daily / Changed API link to avoid problems with time zone.)

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image
Christian Butterweck answered ·

New Release: v1.1, please update

Fixed Bug with single-digit calendar days, please update


2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

beny avatar image
beny answered ·

Hey. Great idea.
I'm a bit bad at Linux, please can you advise me how I can get through Putty scrypt (modified by my API) to Venus OS?
Thank you

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image Christian Butterweck commented ·
Please check the latest version, i added a installer script with the needed commands.
0 Likes 0 ·
Christian Butterweck avatar image
Christian Butterweck answered ·

New Release: v1.3 Added a Venus OS Installer script (should survive Firmware upgrades)

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image
Christian Butterweck answered ·

New Release v1.5: This is a bugfix of v1.3 and v1.4 (added Venus OS Installer script / should survive Firmware upgrades)

Please update immedeately (redownload the run script)
It appears that the /data/rc.local file has been accidentally populated with multiple entries.
This new version will fix this finally.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image
Christian Butterweck answered ·

New Release:

v1.7 Added switching logfile / fixed bug #2

v1.8 Consideration of charger efficiency / Support of Shelly Plug S Wifi switchable socket

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image
Christian Butterweck answered ·

v1.9 Fix of Awattar API issue/bug #3
v2.0 new Entso-E API endpoint, please update.
The old REST API endpoint is planned to be discontinued by Entso-E on 14.02.2023.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

beny avatar image
beny answered ·

How to install a script into Venus OS
I'm trying to get a script into Venus OS. I use wget to get the appropriate file into the directory, but I can't unzip it any further.

Can someone give me a push?

Thank you

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

beny avatar image
beny answered ·

Pls


root@raspberrypi4:/data/etc/Spotmarket-Switcher# ./controller.sh
./controller.sh: line 114: 51.530600today=042300: command not found
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 903 100 903 0 0 3670 0 --:--:-- --:--:-- --:--:-- 3685
/tmp/entsoe_today_prices.xml downloaded
/tmp/entsoe_today_prices.txt was empty, we have to try it again until the new prices are online.
rm: can't remove '/tmp/entsoe_tomorrow_prices.xml': No such file or directory
rm: can't remove '/tmp/entsoe_tomorrow_prices_sorted.txt': No such file or directory
rm: can't remove '/tmp/entsoe_tomorrow_prices.txt': No such file or directory
sed: /tmp/entsoe_prices_sorted.txt: No such file or directory
sed: /tmp/entsoe_prices_sorted.txt: No such file or directory
sed: /tmp/entsoe_prices_sorted.txt: No such file or directory
sed: /tmp/entsoe_prices_sorted.txt: No such file or directory
sed: /tmp/entsoe_prices_sorted.txt: No such file or directory
sed: /tmp/entsoe_prices_sorted.txt: No such file or directory
awkNR: /tmp/entsoe_prices_sorted.txt: No such file or directory
awk: /tmp/entsoe_prices_sorted.txt: No such file or directory
./controller.sh: line 272: printf: e14: invalid number
./controller.sh: line 272: printf: e14: invalid number
./controller.sh: line 272: printf: e14: invalid number
./controller.sh: line 272: printf: e14: invalid number
./controller.sh: line 272: printf: e14: invalid number
./controller.sh: line 272: printf: e14: invalid number
./controller.sh: line 272: printf: e14: invalid number
./controller.sh: line 272: printf: e14: invalid number

Tnx

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image Christian Butterweck commented ·

@beny Please use the commands of the install script for your setup. Are you using Venus OS?
https://github.com/christian1980nrw/Victron-ESS__Shelly-Plug-S__AVM-Fritz-DECT200-210__Spotmarket-Switcher/blob/main/victron-venus-os-install.sh

0 Likes 0 ·
Oliver avatar image
Oliver answered ·

Hi Christian,
if I am using tibber, I have to configure controller.sh for "entso-e", right?
Best Regards,
Oliver

3 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image Christian Butterweck commented ·
Hi Oliver,

if you are from germany or austria you can also use the awattar api, it doesnt matter.
Everything is described in the controller.sh.

Regards Christian


0 Likes 0 ·
Oliver avatar image Oliver Christian Butterweck commented ·
Yes, Munich, Germany.

I'd prefer tipper as a supplier, so I hope awattar and entso-e further allow access to these data without having a customer relationsship with them....


0 Likes 0 ·
Christian Butterweck avatar image Christian Butterweck Oliver commented ·
Currently both of them are free...
0 Likes 0 ·
Christian Butterweck avatar image
Christian Butterweck answered ·

v2.1 Tibber API integration & Entso-E API bugfix

Release notes see https://github.com/christian1980nrw/Spotmarket-Switcher/blob/main/release_notes.md Thanks to moeller@debian.org for joining the project. I appreciate it.
Please update as soon as possible.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

Christian Butterweck avatar image
Christian Butterweck answered ·

v2.2 Consider battery life cycle costs, added economic charge-check based on average prices, fixed Tibber abort price calculation

4 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

larsea-dk avatar image larsea-dk commented ·

Will it work for Denmark? I have some NodeRed for controlling the max charge (amp) based on the expected solar(solar forecast), mainly for summer use to take care of my batteries. Also a nordpool api is used to avoid supplying power back to gid in case prices are too low, since i do not want to stress my system especially when i do not earn money.

Will your script conflict with this? Can it be deactivated if i have conflicts?

1 Like 1 ·
Christian Butterweck avatar image Christian Butterweck larsea-dk commented ·

Hi, yes it will work but "ess --> maximum inverter power" setting will be overwritten to 0w to disable discharging during too cheap spotmarket prices. After that it will be re-enabled to limit_inverter_power_after_enabling=YOURVALUE . You can find this parameter in the sample config of the script. If you change this with your NodeRed script, the conflict should maybe be solved. You can use the integrated Entso-E API for Denmark. You can disable it by the setting use_victron_charger=0 if you only have limited time frames to test. I am interested in infos of the nordpool api. Can you tell me how to get access for testing so that i can integrate this api (next day prices) too? Regards Christian

1 Like 1 ·
mrjj avatar image mrjj Christian Butterweck commented ·
I am interested in Nordpool integration. I live in Finland and I would be very happy to help on this. I am looking for a nice start for automation of solar + battery combination. Regardless of solar, if spot price is enough high system should empty battery for selling. Like today here was 3 hours 0.5-0.3€/kWh in the middle of the day. What I want aim first is to find 3-4hours each 24hours period to charge batteries from grid (after or during solar charge)
0 Likes 0 ·
mrjj avatar image mrjj larsea-dk commented ·
Could you share your node-red logic ?
0 Likes 0 ·

Related Resources

Experiments, Modifications and Adaptions. Mods (Modifications) can be made to Victron Software by the Community. Please use the modifications space for enthusiasts who want to push what is possible, without official Victron Support.