help I want to make the sum of two values Topic is solved

Moderator: leecollings

Post Reply
smaus
Posts: 84
Joined: Sunday 18 February 2018 9:32
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

help I want to make the sum of two values

Post 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
Attachments
enphase.png
enphase.png (23.87 KiB) Viewed 1602 times
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: help I want to make the sum of two values

Post 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
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
nico4sen
Posts: 6
Joined: Saturday 15 February 2020 13:41
Target OS: -
Domoticz version:
Contact:

Re: help I want to make the sum of two values

Post 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
smaus
Posts: 84
Joined: Sunday 18 February 2018 9:32
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: help I want to make the sum of two values

Post 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
smaus
Posts: 84
Joined: Sunday 18 February 2018 9:32
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: help I want to make the sum of two values

Post by smaus »

nico4sen wrote: Monday 12 October 2020 19:37 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
Thanks for the link.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest