Hi all!
I am rather new to automation and can’t seem to figure out how to do the following:
I have a HomeWizard P1 energy meter placed, which monitors power consumption.
Solar panels are installed and I have a variable energy contract with prices changing every hour.
When the solar panels produce more than I consume (see image), the power will be exported to the grid and billed within the hour. At this time, the energy price is very low, because there is a lot of solar energy at those times.
Therefor I would like to have an automated system that toggles a Wifi switch to activate a water heater that heats up a 300 L buffer tank for domestic water (3.000 watt - more than the solar panels should generate). I made a small script myself to get an idea (not working, just a concept):
execute = function(wifi switch ON)
at (whole hour xx:00) check consumption.today (P1 meter)
every minute check consumption.currenttotal;
loop()
if (consumption.today > consumption.currenttotal) switch heater on
if (consumption.today < consumption.currenttotal) switch heater off
delay(60 seconds)
if (consumption.today > consumption.currenttotal) switch heater on
if (consumption.today < consumption.currenttotal) switch heater off
What I would like to do is read the powercounter at every whole hour as a starting point, and then use the water heater to consume energy as long as the consumption is lower than the starting value. I need to do this every hour, since the eletric company charges me for every hour of consumption.
Is there anyone who could help me creating a script for this? I think it is not that comlicated, but I am not able to figure it out myself.
Thanks a million!