There is a lua-script that does this trick, but was not really happy with it. So, I decided to wrote a new one in dzVents. In fact, a script in dzVents is much more simple to write then Lua. Six vitual devices type Counter Incremental are created for the different values
The script is very straight forward. The values are fetchted from the P1 Smart Meter device (P1data) and put in a table (SMdata) in a fixed order. Then just update the devices with the accessory values from the table. That's all you have to do.
Code: Select all
--[[ dzVents script to Parse P1 Smart Meter Electricity value into seperated Meter Readings.
]]-- The following need updated for your environment get the 'Idx' or 'Name' of the Device tab.
local fetchIntervalMins = 1 -- (Integer) (Minutes, Range 5-60) How often SE file is fetched
local P1data = 33 -- Electra, P1 Smart Meter device
local idxu1 = 42 -- Meter Usage low, Virtual device, counter incremental
local idxu2 = 43 -- Meter Usage High, Virtual device, counter incremental
local idxr1 = 44 -- Meter Return Low, Virtual device, counter incremental
local idxr2 = 45 -- Meter Return High, Virtual device, counter incremental
local idxcons = 74 -- Meter Actual Usage, Virtual device, counter incremental
local idxprod = 75 -- Meter Actual Production, Virtual device, counter incremental
local ScriptVersion = '0.1.5'
return {
active = true,
logging = {
-- level = domoticz.LOG_DEBUG, -- Uncomment this line to override the dzVents global logging setting
marker = 'SME '.. ScriptVersion
},
on = {
timer = { 'every minute' }
},
execute = function(domoticz, device)
-- Get values from device P1Data of the Smart Meter
local SMdata = domoticz.devices(P1data).rawData
-- Update the device and Debug meassages with the accessory values from table SMdata
domoticz.devices(idxu1).updateCounter(SMdata[1])
domoticz.log('Gebruik laag = '.. SMdata[1], domoticz.LOG_DEBUG)
domoticz.devices(idxu2).updateCounter(SMdata[2])
domoticz.log('Gebruik hoog = '.. SMdata[2], domoticz.LOG_DEBUG)
domoticz.devices(idxr1).updateCounter(SMdata[3])
domoticz.log('Levering laag = '.. SMdata[3], domoticz.LOG_DEBUG)
domoticz.devices(idxr2).updateCounter(SMdata[4])
domoticz.log('Levering hoog = '.. SMdata[4], domoticz.LOG_DEBUG)
domoticz.devices(idxcons).updateCounter(SMdata[5])
domoticz.log('Actuele verbruik = '.. SMdata[5], domoticz.LOG_DEBUG)
domoticz.devices(idxprod).updateCounter(SMdata[6])
domoticz.log('Actuele levering = '.. SMdata[6], domoticz.LOG_DEBUG)
end -- execute
}