A MWE of the dzvents script is shown below
Code: Select all
return {
active = true,
on = {
devices = {
'Solax - Grid Power',
'Solax - Battery Power',
}
},
execute = function(domoticz, device)
local GP = domoticz.devices('Solax - Grid Power') -- Power from/to grid
local BP = domoticz.devices('Solax - Battery Power') -- Battery charge
local EVSEGRIDMETER = domoticz.devices('dombus - (1.c) Grid Power') -- EVSE device
EVSEGRIDMETER.setValues(0,tostring(-GP.actualWatt - BP.actualWatt)..';0')
end
}
Code: Select all
2024-07-29 11:33:02.565 dombus: onDeviceModified: device description=ID=1.c,CUSTOM,TypeName=kWh
2024-07-29 11:33:02.565 dombus: DEBUG:Parse Description field for device 1.c
2024-07-29 11:33:02.565 dombus: DEBUG:opt=ID=1.c
2024-07-29 11:33:02.565 dombus: DEBUG:opt=CUSTOM
2024-07-29 11:33:02.565 dombus: DEBUG:opt=CUSTOM setType=2147483648 typeName=Switch
2024-07-29 11:33:02.565 dombus: DEBUG:opt=TypeName=kWh
2024-07-29 11:33:02.566 dombus: INFO: Config device 0x1: type=0x80000000 typeName=kWh Options={'EnergyMeterMode': '1', 'SignedWatt': '1'}
2024-07-29 11:33:02.566 dombus: INFO: TypeName='kWh', nValue=0, sValue='-4499.858;-6.2175', Description='ID=1.c,CUSTOM,TypeName=kWh', Options={'EnergyMeterMode': '1', 'SignedWatt': '1'}
2024-07-29 11:33:02.578 dombus: DUMP: TX frame: P:2 3a 0000 -> 0001 12 DCMDCFG 0c 00 | CFG 0c 80 00 00 00 00 00 00 | c4
2024-07-29 11:33:02.678 dombus: DUMP: RX frame: P:2 3a 0001 -> 0000 03 A-CFG 0c 80 | d3
2024-07-29 11:33:04.080 dombus: DUMP: TX frame: P:2 3a 0000 -> 0001 03 DCMDCFG 0c 00 | 2b
`