Heater Control

Moderator: leecollings

Post Reply
Daro1003
Posts: 203
Joined: Monday 14 November 2022 12:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.1
Location: Poland
Contact:

Heater Control

Post by Daro1003 »

Hello

Based on Domoticz, I would like to control a heater that is connected to the EARU relay module.

The assumption is to use the overproduction power that is flowing into the network, I have new rules and currently gives off energy for which Tauron will not pay because I gave back 3x more than I took, i.e. every kilowatt currently flowing into the network is free.

So:

1. I have a reading of the L1 L2 L2 power in domoticz directly from the inverter. So I know how much is flowing from the sofa to the installation at a given moment.

2. I have a reading of how much the devices in the house are currently drawing, i.e. the power on L1 L2 L3

3. The heater connected via the EARU module before the power measurement described in point 2.

The block is quite long, so in two pictures.

Assumptions:

If:
Heater OFF and Power L1 below 500 and Power L2 below 500 and Power L3 below 500 and Power from photovoltaics above 1000
Then:
Turn on the heater
If:
Heater ON and Power L1 above 500 or Power L2 above 500 or Power L3 above 500 or Power from photovoltaics below 1000
Then:
Turn off the heater

1. The first question is whether the block is made properly and should work or whether it has errors.
2. The second question is whether it is possible to expand the block with other values, i.e. adding conditions due to the increase in charging power from photovoltaics but also increased consumption at home.
Attachments
Block 1.png
Block 1.png (40.61 KiB) Viewed 2514 times
Block 2.png
Block 2.png (26.6 KiB) Viewed 2514 times
voyo
Posts: 40
Joined: Monday 17 February 2020 19:16
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Poland
Contact:

Re: Heater Control

Post by voyo »

Unless you have other safeguards that prevent the heater from heating above a certain temperature, your solution is quite dangerous. At least in theory, you can boil the water in the tank ;)

re 1 - for errors check in logs. At first sight - it should work.
re 2 - yes, you can extend conditions further, however I dont know limitations how many nested conditions we can use...
but TBH, for more sophisticated scripts I personally preferer just regular scripts.
For reference , here is my script (similar purpose). (apologize, comments in polish)

CWU

return {
active = true,
on = {
timer = {
'every 6 minutes'
},
},

logging = {
level = domoticz.LOG_DEBUG,
marker = 'CWU/Sofar'
},




execute = function(domoticz)
local solarPowerDevice = domoticz.devices('DDS238-7 - TotalEnergy') -- Urządzenie monitorujące produkcję prądu
local cwuTemperatureDevice = domoticz.devices('Panasonic T-Cap - tank_water_temp') -- Urządzenie monitorujące temperaturę wody w zbiorniku CWU
local cwuHeaterDevice = domoticz.devices('Panasonic T-Cap - System On/Off') -- Urządzenie do włączania grzania wody w zbiorniku CWU
local triggerTemp = 40
local triggerPower = 3500

local usage1 = solarPowerDevice.usage1
local usage2 = solarPowerDevice.usage2
local return1 = solarPowerDevice.return1
local return2 = solarPowerDevice.return2
local usageDelivered = solarPowerDevice.usageDelivered

domoticz.log ("usageDelivered = " .. usageDelivered )
-- .. ", Return1 = " .. return1 .. ", P1 cumulative=" .. usage1+usage2-return1-return2 )
domoticz.log ("Temp CWU = " .. cwuTemperatureDevice.temperature )
--domoticz.log('Solar Power Device: ' .. tonumber(solarPowerDevice.rawData[1]))
-- domoticz.log('CWU Temperature Device: ' .. cwuTemperatureDevice.temperature)



-- Sprawdzenie, czy jest dzień
if domoticz.time.isDayTime then
domoticz.log("jest dzien")

-- Sprawdzenie, czy produkcja prądu jest powyżej 3500 W

if usageDelivered > triggerPower then
domoticz.log("usageDelivered > triggerPower ")
-- Sprawdzenie, czy temperatura wody w zbiorniku CWU jest poniżej 35 stopni
if cwuTemperatureDevice.temperature < triggerTemp then
domoticz.log("temp < triggerTemp ")
if cwuHeaterDevice.active == false then
domoticz.log("PC wyłączona, włączam PC")
-- Włączenie grzania wody w zbiorniku CWU
cwuHeaterDevice.switchOn()
domoticz.notify('CWU/Sofar', 'mocne słonce a woda zimna, włączam PC')
else
domoticz.log("PC juz działa")
end
else
domoticz.log("temp > triggerTemp ")
-- Jeśli temperatura wody jest powyżej 35 stopni, wyłączenie grzania wody w zbiorniku CWU
-- cwuHeaterDevice.switchOff()
end
else
domoticz.log("usageDelivered < triggerPower ")

-- Jeśli produkcja prądu jest poniżej 3500 W, wyłączenie grzania wody w zbiorniku CWU
-- cwuHeaterDevice.switchOff()
end
else
domoticz.log("jest noc")
-- Jeśli nie jest dzień, wyłączenie grzania wody w zbiorniku CWU
-- cwuHeaterDevice.switchOff()
end
end
}
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest