House consumption as a device
Moderators: leecollings, remb0
- imautohuttraeger
- Posts: 426
- Joined: Saturday 14 March 2020 13:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Germany
- Contact:
House consumption as a device
The energy dashboard already shows the house consumption with actual power in Watt and daily Energie in kWh.
I am looking for an easy way to get these data into a virtual utility device type "general, kWh". As the calculation of these data is already done in the background obviously, I thought I could maybe pick the data via dzvents script, but without extra calculation, so that the figures are really identical.
Is this possible - and if yes: How?
I am looking for an easy way to get these data into a virtual utility device type "general, kWh". As the calculation of these data is already done in the background obviously, I thought I could maybe pick the data via dzvents script, but without extra calculation, so that the figures are really identical.
Is this possible - and if yes: How?
Stop, look and listen.
- madpatrick
- Posts: 894
- Joined: Monday 26 December 2016 12:17
- Target OS: Linux
- Domoticz version: 2026.1
- Location: Netherlands
- Contact:
Re: House consumption as a device
If you have data available you can do almost everything with it
Make a dummy devices and place the data into it
Make a dummy devices and place the data into it
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2026.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
-= Checkout https://github.com/MadPatrick for the plugins =-
- imautohuttraeger
- Posts: 426
- Joined: Saturday 14 March 2020 13:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Germany
- Contact:
Re: House consumption as a device
Sure. But where do I get the data from? I only see it in the right bubble of the energy dashboard (actual power and daily energy). So it is calculated and displayed already but I don't know how to address these data in a script.
I want to avoid of calculating it in parallel with possible slightly different results and additional unnecessary workload for Domoticz
I want to avoid of calculating it in parallel with possible slightly different results and additional unnecessary workload for Domoticz
Stop, look and listen.
- madpatrick
- Posts: 894
- Joined: Monday 26 December 2016 12:17
- Target OS: Linux
- Domoticz version: 2026.1
- Location: Netherlands
- Contact:
Re: House consumption as a device
You data in the Energy dashboard is defined in the settings of the Energy dashboard
This is setup by yourself. The must be devices measuring the power, otherwise you have a very smart system
This is setup by yourself. The must be devices measuring the power, otherwise you have a very smart system
-= HP server GEN11 =- ZwaveJS-=- Domoticz v2026.2 -=- Dashticz =-
-= Checkout https://github.com/MadPatrick for the plugins =-
-= Checkout https://github.com/MadPatrick for the plugins =-
- imautohuttraeger
- Posts: 426
- Joined: Saturday 14 March 2020 13:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Germany
- Contact:
Re: House consumption as a device
Got you. Sure. I know I can calculate it from P1, solar and batterie. I just thought I could avoid it, because the system is already doing this calculation process somewhere in the background.
Stop, look and listen.
- waltervl
- Posts: 7024
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2026.3
- Location: NL
- Contact:
Re: House consumption as a device
As the data is calculated by the Energy dashboard itself it is not put into a device.
You can use the same logic as used in the energy dashboard to calculate the house consumption and put it into an Energy device by a dzvents script.
The logic is in the file: https://github.com/domoticz/domoticz/bl ... troller.js
You can use the same logic as used in the energy dashboard to calculate the house consumption and put it into an Energy device by a dzvents script.
The logic is in the file: https://github.com/domoticz/domoticz/bl ... troller.js
Code: Select all
fTotalHomeUsage (kWh today):
Grid used + Solar generated − Grid returned
+ Battery discharged (if configured)
− Battery charged (if configured)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
- imautohuttraeger
- Posts: 426
- Joined: Saturday 14 March 2020 13:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Germany
- Contact:
Re: House consumption as a device
Thanks. With AI help, I could make this script and it works well. (Comments by Claude in German - sorry)
Maybe grid import and export could even be fetched directly from the P1 device, but I had it as separate devices already.
Code: Select all
return {
on = {
devices = { 743, 747, 746, 906 }
},
execute = function(domoticz, item)
local pvcounter = domoticz.devices(743)
local importcounter = domoticz.devices(747)
local exportcounter = domoticz.devices(746)
local battery = domoticz.devices(906)
local dummyVerbrauch = domoticz.devices(816)
-- Aktuelle Leistung berechnen
-- battery.actualWatt: negativ = Entladen (liefert zusätzlich Energie an den Haushalt
-- -> muss addiert werden), positiv = Laden (Energie fließt in die Batterie statt in
-- den Haushalt -> muss abgezogen werden)
local aktuelleLeistung = pvcounter.actualWatt + importcounter.actualWatt - math.abs(exportcounter.actualWatt) - battery.actualWatt
-- Nur den Watt-Wert übergeben; kWh übernimmt Domoticz selbst (Energy read = computed)
dummyVerbrauch.update(0, string.format("%.1f;0", aktuelleLeistung))
end
}
- Attachments
-
- Screenshot_20260715-123401.png (49.98 KiB) Viewed 782 times
Stop, look and listen.