Page 1 of 1
help I want to make the sum of two values
Posted: Sunday 11 October 2020 16:03
by smaus
Hello,
Is there someone who can help me to make a script ( i don't have any idea how to do that ).
I want to make the sum of two values from my enphase 8.302kwh-5629kwh=2673kwh
the idx enphase1 = 5291
The idx enphase2 = 5293
thank you in advance
Re: help I want to make the sum of two values
Posted: Sunday 11 October 2020 22:26
by waaren
smaus wrote: ↑Sunday 11 October 2020 16:03
Is there someone who can help me to make a script ( i don't have any idea how to do that ).
I want to make the sum of two values from my enphase 8.302kwh-5629kwh=2673kwh
Could look like below as dzVents script
___________________________________________________________________________________________________________________________
When not yet familiar with dzVents please start with reading
Get started Before implementing (~ 5 minutes). Special attention please for "In Domoticz go to Setup > Settings > Other and in the section EventSystem make sure the checkbox 'dzVents enabled' is checked. Also make sure that in the Security section in the settings you allow 127.0.0.1 to not need a password. dzVents uses that port to send certain commands to Domoticz. Finally make sure you have set your current location in Setup > Settings > System > Location, otherwise there is no way to determine nighttime/daytime state."
___________________________________________________________________________________________________________________________
Code: Select all
return
{
on =
{
devices =
{
'Enphase1',
},
},
logging =
{
level = domoticz.LOG_DEBUG,
marker = 'Delta Enphase1 and 2',
},
execute = function(dz, item)
targetDevice = dz.devices('powerDelta') -- define as virtual custom sensor
local enphase1Today = item.counterToday
local enphase2Today = dz.devices('Enphase2').counterToday
local delta = enphase1Today - enphase2Today
dz.log('Delta of enphase1 en enphase2 counterToday: ' .. delta, dz.LOG_DEBUG)
targetDevice.updateCustomSensor(delta)
end
}
Re: help I want to make the sum of two values
Posted: Monday 12 October 2020 19:37
by nico4sen
I did it with a room plan and a PHP script. There is somewhere a topic about adding two values.
Update:
https://r.tapatalk.com/shareLink/topic? ... source=app
Re: help I want to make the sum of two values
Posted: Tuesday 13 October 2020 19:46
by smaus
waaren wrote: ↑Sunday 11 October 2020 22:26
smaus wrote: ↑Sunday 11 October 2020 16:03
Is there someone who can help me to make a script ( i don't have any idea how to do that ).
I want to make the sum of two values from my enphase 8.302kwh-5629kwh=2673kwh
Could look like below as dzVents script
waaren
the script works, absolutely great.
Thank you very much for the effort
Re: help I want to make the sum of two values
Posted: Tuesday 13 October 2020 19:48
by smaus