Hi.
I wonder if someone can help me write a script that uses "Counter Incremental" Energy?
I have a Bosch Compress 7000i AWE 13 kW air/water heat pump. I see, among other things, the heat pump's total energy consumption since the heat pump was installed via Domoticz unit "HP_Supp energy tot" for example 74364 kWh right now. I would like to see the daily or per hour energy consumption like the image below.
.
I have seen information about how the sensor itself works, but no information about how the script itself is written.
I don't know anything about writing Dzventz code or Lua code, so I'm wondering if someone can help me create a script that solves this?
Many thanks for your help!
Best regards,
McLund
Script that uses "Counter Incremental" Energy
Moderator: leecollings
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Script that uses "Counter Incremental" Energy
You should not use a counter incremental but a normal energy counter. Then you get the hourly, daily, weekly, monthly etc overviews.
For a dzvents script you only need to update the total counter you get from the heat pump and put it in the counter with function
updateCounter(value) see also wiki https://www.domoticz.com/wiki/DzVents:_ ... ncremental
For an example script how to update a counter see https://www.domoticz.com/forum/viewtopic.php?p=234138
For a dzvents script you only need to update the total counter you get from the heat pump and put it in the counter with function
updateCounter(value) see also wiki https://www.domoticz.com/wiki/DzVents:_ ... ncremental
For an example script how to update a counter see https://www.domoticz.com/forum/viewtopic.php?p=234138
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 504
- Joined: Sunday 01 November 2015 22:45
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Twente
- Contact:
Re: Script that uses "Counter Incremental" Energy
Here's one.
It collects P1 data and puts the calculation in Saldo Hoog (return - usage) and so on.
Code: Select all
--[[
dzVents script dzVents script time
om P1 Smart Meter Elektriciteitswaarde te ontleden in afzonderlijke Meterstanden.
Houd er rekening mee dat de teller van vandaag aanvankelijk tot de volgende dag bij de GUI
een verkeerde waarde zal weergeven.
Script gedownload van huizebruin.nl
www.huizebruin.nl/domoticz/slimme-meter-(p1)-opsplitsen-naar-4-tellers-domoticz-met-lua/
29/08/2020-/-v1.10: verbeteringen in totaal verwerkt
1-0:1.8.1(00185.000*kWh) (Totaal verbruik tarief 1 (nacht)) - usage1
1-0:1.8.2(00084.000*kWh) (Totaal verbruik tarief 2 (dag)) - usage2
1-0:2.8.1(00013.000*kWh) (Totaal geleverd tarief 1 (nacht)) - return1
1-0:2.8.2(00019.000*kWh) (Totaal geleverd tarief 2 (dag)) - return2
--[[
Power usage 1 = Dal gebruik : 30163692 04-07-2023 29885000
Power usage 2 = Piek gebruik : 16186108 04-07-2023 15983000
Power return 1 = Dal terug : 11095413 04-07-2023 10747000
Power return 2 = Piek terug : 26657672 04-07-2023 25826000
]]--
-- 01-01-2023 -- 04-07-2023
local startUsageLow = 29885000 -- 29048762 --29885000
local startUsageHigh = 15983000 -- 15357636 --15983000
local startReturnLow = 10747000 -- 9937177 --10747000
local startReturnHigh = 25826000 -- 24233004 --25826000
local fetchIntervalMins = 20 -- (Geheel) Minutenfrequentie van deze scriptuitvoering 1 = elke minuut, 10 = elke 10 minuten, enz.) Moet een van (1,2,3,4,5,6,10,12,15,20,30) zijn.
local ScriptVersion = '1.10' -- domoticz > V2020.1 / dzVents >= 2.4.28
return {
on = {
timer = { 'every ' .. fetchIntervalMins .. ' minutes' }
},
logging = {
level = domoticz.LOG_DEBUG, domoticz.LOG_ERROR, -- Maak commentaar op deze regel om de instelling van dzVents global logging te overschrijven
marker = 'Afzonderlijke Meterstanden '.. ScriptVersion
},
execute = function(dz, item)
-- domoticz.utils.dumpTable(item.json)
-- local P1data = dz.devices('Power').dump()
local P1 = dz.devices('Power') -- Electra, P1 Smart Meter device (idx or "name") (required)
local saldoHoog = dz.devices('Saldo Hoog') -- verschil teruglevering - gebruik
local saldoLaag = dz.devices('Saldo Laag') -- verschil teruglevering - gebruik
local saldoTotaal = dz.devices('Saldo Totaal') -- verschil teruglevering - gebruik
local sumSaldoHoog = (P1.return2 - startReturnHigh) - (P1.usage2 - startUsageHigh)
local sumSaldoLaag = (P1.return1 - startReturnLow) - (P1.usage1 - startUsageLow)
--local sumSaldoTotaal = (P1.return2 - startReturnHigh) + (P1.return1 - startReturnLow)
-- - (P1.usage2 - startUsageHigh) - (P1.usage1 - startUsageLow)
local sumSaldoTotaal = sumSaldoLaag + sumSaldoHoog
dz.log('Consumption : ' ..P1.usage, dz.LOG_DEBUG)
dz.log('Production : ' ..P1.usageDelivered, dz.LOG_DEBUG)
dz.log('Saldo Hoog : ' ..sumSaldoHoog, dz.LOG_DEBUG)
dz.log('Saldo Laag : ' ..sumSaldoLaag, dz.LOG_DEBUG)
dz.log('Saldo Totaal : ' ..sumSaldoTotaal, dz.LOG_DEBUG)
dz.devices('Saldo Hoog').updateCounter(sumSaldoHoog)
dz.devices('Saldo Laag').updateCounter(sumSaldoLaag)
dz.devices('Saldo Totaal').updateCounter(sumSaldoTotaal)
end
}
-- einde Script
Bugs bug me.
-
- Posts: 7
- Joined: Monday 21 October 2024 14:33
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Script that uses "Counter Incremental" Energy
I am looking for a custom device in which I can store the hourly costs of gas / electric.
I read that I should not use a counter incremental but a normal energy counter.
But those counters are using the energy rates as defined with the setup.
I would like to store the hourly prices in a custom device using the dynamic hourly prices of my provider.
I already have a counter where I store my hourly gas /elec. prices.
How can I do that hourly calculation /storage with a custom device so that I have a hourly calculation of hourly gas/elec * hourprice gas/elec?
I would like to have the results in a domticz device like the energy counter since those counters have the hourly/daily etc graphs and tables.
Or should I use the JSON / API calls instead ?
I read that I should not use a counter incremental but a normal energy counter.
But those counters are using the energy rates as defined with the setup.
I would like to store the hourly prices in a custom device using the dynamic hourly prices of my provider.
I already have a counter where I store my hourly gas /elec. prices.
How can I do that hourly calculation /storage with a custom device so that I have a hourly calculation of hourly gas/elec * hourprice gas/elec?
I would like to have the results in a domticz device like the energy counter since those counters have the hourly/daily etc graphs and tables.
Or should I use the JSON / API calls instead ?
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Script that uses "Counter Incremental" Energy
In recent Domoticz, with the (dynamic) cost calculation activated in menu setup settings, tab meters, the energy costs are calculated automatically by Domoticz in the energy device you use. No need to have a separate device for that. Also in the log and reports pages of the devices the costs are shown per day, month, year etc.
And if you mean energy prices then a custom sensor would be enough to store the current price, that device can be used as input for the (dynamic) cost calculation in Domoticz.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 7
- Joined: Monday 21 October 2024 14:33
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Script that uses "Counter Incremental" Energy
Thank you for advising to a recent version. I'm testing it right now.
Do you know how its daily totals are being calculated within the monthly tables?
I'm expecting a sum of 24 calculations: 24* hourly price * hourly usage-delivery?
Do you know how its daily totals are being calculated within the monthly tables?
I'm expecting a sum of 24 calculations: 24* hourly price * hourly usage-delivery?
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Script that uses "Counter Incremental" Energy
I don't know how they are calculated. But I guess the costs are calculated against the current prices (could change more that once an hour..).
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest