Domoticz own dashbords electricity, bidirectional measurement
Moderator: leecollings
-
geoterm
- Posts: 29
- Joined: Saturday 20 December 2025 17:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Domoticz own dashbords electricity, bidirectional measurement
Hi,
I've created my own dashboard for electricity consumption and production in a single-family home. It's based on a PZEM-004T system with six units. Three are for production and three are for consumption by the building. Now I need to create devices: the amount of energy in kWh, the energy pumped into the grid (when there's overproduction), and the energy drawn from the grid so I can compare it with the utility's bidirectional energy meter. There's a device in Domoticz called a smart meter (an attachment), but I don't know how to use it. Please help.
I've created my own dashboard for electricity consumption and production in a single-family home. It's based on a PZEM-004T system with six units. Three are for production and three are for consumption by the building. Now I need to create devices: the amount of energy in kWh, the energy pumped into the grid (when there's overproduction), and the energy drawn from the grid so I can compare it with the utility's bidirectional energy meter. There's a device in Domoticz called a smart meter (an attachment), but I don't know how to use it. Please help.
- Attachments
-
- d3.JPG (36.65 KiB) Viewed 135 times
-
- d1.JPG (164.48 KiB) Viewed 135 times
-
- d2.JPG (106.75 KiB) Viewed 135 times
-
HvdW
- Posts: 663
- Joined: Sunday 01 November 2015 22:45
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2023.2
- Location: Twente
- Contact:
Re: Domoticz own dashbords electricity, bidirectional measurement
Most important: https://wiki.domoticz.com/DzVents:_next ... _scripting
Learn to use dzVents, the easiest scripting language around.
to get all data from Power - P1
domoticz.devices('Power').dump()
Watch the log every minute.
Here is another script
Create a dummy device with the name 'Electricity' should be the type TEXT device.
The script fills in the data.
Learn to use dzVents, the easiest scripting language around.
to get all data from Power - P1
domoticz.devices('Power').dump()
Code: Select all
return {
on = {
timer = { 'every minute' }
},
execute = function(domoticz)
domoticz.log(domoticz.devices('Power').dump(), domoticz.LOG_INFO)
end
}
Here is another script
Code: Select all
return {
on = {
timer = { 'every minute' }
},
execute = function(domoticz)
local powerDevice = domoticz.devices('Power')
local textDevice = domoticz.devices('Electricity')
if not powerDevice or not textDevice then
domoticz.log('Power of Electricity device niet gevonden', domoticz.LOG_ERROR)
return
end
-- sValue opsplitsen
local values = domoticz.utils.stringSplit(powerDevice.sValue, ';')
local usageT1 = values[1] or '0' -- laag
local usageT2 = values[2] or '0' -- hoog
local returnT1 = values[3] or '0'
local returnT2 = values[4] or '0'
local currentPower = values[5] or '0'
local returnExtra = values[6] or '0'
-- Verbruik vandaag (kWh)
local counterToday = powerDevice.counterToday or '0'
-- Netjes opgemaakte tekst
local text =
'⚡ Electricity overzicht\n' ..
'----------------------\n' ..
'Verbruik vandaag : ' .. counterToday .. ' kWh\n' ..
'\n' ..
'Verbruik T1 (laag) : ' .. usageT1 .. ' Wh\n' ..
'Verbruik T2 (hoog) : ' .. usageT2 .. ' Wh\n' ..
'Teruglevering T1 : ' .. returnT1 .. ' Wh\n' ..
'Teruglevering T2 : ' .. returnT2 .. ' Wh\n' ..
'Actueel vermogen : ' .. currentPower .. ' W\n' ..
'Teruglevering : ' .. returnExtra
-- Update Text device
textDevice.updateText(text)
end
}
The script fills in the data.
Bugs bug me.
- waltervl
- Posts: 6677
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2025.1
- Location: NL
- Contact:
Re: Domoticz own dashbords electricity, bidirectional measurement
See also the wiki for the Dummy/Virtual devices that states what they are used for.
https://wiki.domoticz.com/Dummy_for_vir ... mart_meter
https://wiki.domoticz.com/Dummy_for_vir ... mart_meter
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
-
geoterm
- Posts: 29
- Joined: Saturday 20 December 2025 17:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Domoticz own dashbords electricity, bidirectional measurement
Ok, Thank You, i will try.
-
geoterm
- Posts: 29
- Joined: Saturday 20 December 2025 17:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Domoticz own dashbords electricity, bidirectional measurement
I definitely need to create two output devices – one to count kWh drawn from the grid, and the other pumped into the grid. Two input devices: the total kWh from the photovoltaics and the total kWh consumed by the building.
- waltervl
- Posts: 6677
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2025.1
- Location: NL
- Contact:
Re: Domoticz own dashbords electricity, bidirectional measurement
You can do that with the P1 smart meter device, it has 2 counters, one for usage and one for delivery.
You do not have a real grid meter that measures these values for you?
You do not have a real grid meter that measures these values for you?
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
-
geoterm
- Posts: 29
- Joined: Saturday 20 December 2025 17:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Domoticz own dashbords electricity, bidirectional measurement
Okay, I'll do it through P1.
I have a bidirectional meter at the property line – from the power company – and I'm curious how these two measurements will compare.
Of course, I could buy a bidirectional meter at home, but it's important that it works with Domoticz so I don't have to buy BACnet gateways, etc.
I have a bidirectional meter at the property line – from the power company – and I'm curious how these two measurements will compare.
Of course, I could buy a bidirectional meter at home, but it's important that it works with Domoticz so I don't have to buy BACnet gateways, etc.
-
geoterm
- Posts: 29
- Joined: Saturday 20 December 2025 17:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Domoticz own dashbords electricity, bidirectional measurement
There is some problem.
Logs:
2025-12-23 20:39:31.087 Error: GetJSonDevices: exception occurred : 'stoull'
2025-12-23 20:40:00.970 Error: UpdateMultiMeter: Error converting sValue values! (IDX: 287, sValue: '-601;nil;nil;nil;nil;nil', dType: 250, sType: 1)
2025-12-23 20:43:33.064 Error: dzVents: An error occurred when calling event handler L123sP1 287 dzvents
2025-12-23 20:43:33.064 Error: dzVents: ...cripts/dzVents/generated_scripts/L123sP1 287 dzvents.lua:8: attempt to call a table value
dz vents:
Logs:
2025-12-23 20:39:31.087 Error: GetJSonDevices: exception occurred : 'stoull'
2025-12-23 20:40:00.970 Error: UpdateMultiMeter: Error converting sValue values! (IDX: 287, sValue: '-601;nil;nil;nil;nil;nil', dType: 250, sType: 1)
2025-12-23 20:43:33.064 Error: dzVents: An error occurred when calling event handler L123sP1 287 dzvents
2025-12-23 20:43:33.064 Error: dzVents: ...cripts/dzVents/generated_scripts/L123sP1 287 dzvents.lua:8: attempt to call a table value
dz vents:
Code: Select all
return {
on = {
devices = {
160
}
},
execute = function(domoticz, device)
domoticz.devices(287).updateP1(domoticz.utils.round((domoticz.devices(161).actualWatt - domoticz.devices(160).actualWatt), 0))
end
}- Attachments
-
- a1.JPG (21.26 KiB) Viewed 75 times
- waltervl
- Posts: 6677
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2025.1
- Location: NL
- Contact:
Re: Domoticz own dashbords electricity, bidirectional measurement
A P1 device needs 6 values, read the docs. You only supply 2.
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: No registered users and 1 guest