Water boiler control optimized for dynamic electricity pricing #21915
Replies: 3 comments 35 replies
-
While I'm not trying to comment on your project (it is of course great that you got it to work for you), I wondered if you considered using the Berry language instead of rules. As the Shelly Pro 2 is ESP32-based, this "full" programming language is available in Tasmota, and allows much better local control than feasible within the restrictions of using rules, as you can create more than "minor programs". This includes a stronger http implementation than available with the |
Beta Was this translation helpful? Give feedback.
-
This project is my first exposure to Tasmota. Implementing this in Berry would seem to be the next natural step and a useful learning experience. For my installation with only one device, it indeed would make sense to make that device self-contained. As long as running the program will not cause any flash write cycles, it should be fine. Could you point me to an example that would be run on a schedule and fetch JSON data over HTTP or HTTPS and parse it? My implementation will have to be revised anyway when the Nord Pool market moves from 60-minute slots to 15-minute or shorter slots. In such a case, I would want to choose the N cheapest (not necessarily consecutive) slots of each day for running the load. For any installation where there are several devices that need to be controlled by dynamic pricing, I think that it is better to have a central management that caches the price information and sends commands to individual nodes. This could still be feasible to implement in the Berry language. |
Beta Was this translation helpful? Give feedback.
-
I filed #22529 for this. |
Beta Was this translation helpful? Give feedback.
-
I recently switched my electricity contract from fixed to dynamic pricing. A large consumer is a boiler that provides warm water for 1 to 2 days. Thanks to its smallish volume and high power, it will heat up from cold to hot in less than 1 hour. Coincidentally, the current dynamic electricity pricing of Nord Pool is set in 1-hour intervals.
I got a Shelly Pro 2, upgraded its proprietary firmware to 1.3.0 and further to Tasmota 14.1.0 using these instructions.
Power1
drives a 3-phase contactor that drives the 3×2kW water boiler resistor through a thermostat. Input 1 is wired to a signal "night time electricity tariff is available", which I do not currently do not use. The Tasmota configuration is as follows:Conveniently, pressing the Reset button in the electricity panel will turn on (or toggle) the state of the heater.
Edit: This example was wrong; We need SwitchMode 15 to fully detach a Switch from the corresponding Power output.
Every 24 hours, a
cron
job on a Linux box (actually, OpenWrt router) fetches the Nord Pool electricity prices for Finland in JSON format from https://sahkotin.fi. It fetches the prices for the next 23 hours, sleeps until the start of the cheapest hour, and finally sends a command to turn on the heat:Above, the logic for determining the earliest start time of the minimum price is implemented both in the OpenWrt specific https://openwrt.org/docs/guide-developer/jshn as well as in https://jqlang.github.io/jq/. You probably want to strip out the
if
,else
andfi
and the not-applicable part.The error handling is rather crude. The most likely error ought to be that the a connection to the price source fails, and an error from
wget
terminates the entire script due to theset -e
. If the server delivers malformed or invalid data, the computation ofdelay
could fail due to invaliddate -d "$bestdate"
parameter. Also the connection to$TASMOTA
could fail or the electricity supply of the house could be interrupted during thesleep
. I am willing to take the risk; there hopefully should be warm water on the next attempt (within in 24 hours), or someone could go and push the Reset button on the Shelly Pro 2 to start the water boiler for 1 hour. For any troubleshooting, the file/tmp/prices.txt
and its latest modification timestamp would be available.Instead of defining a static IPv4 address for the Tasmota node, I guess I could have enabled the mDNS server and used a
.wlan
or.local
address.If the Tasmota WebQuery command returned the result in the default firmware build, it might be possible to fetch and parse the JSON on the Tasmota itself.
Initially, I had implemented some more complex logic in Tasmota, starting the boiler at 3:00 am and turning it off at the end of the night time transfer tariff (7:00 am). I know, I would not really need any
var1
there, but I wanted to learn how to write some more complex rules:Something like this might be used as a fallback in case the
/bin/sh
script failed. Currently the timer and the rules are disabled on my system.The reason why I did not go for something like HomeAssistant is that I want to minimize the number of always-on systems in my home.
Beta Was this translation helpful? Give feedback.
All reactions