Kaco Inverter - transfer from CSV to Domoticz

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
plantex
Posts: 9
Joined: Monday 30 October 2017 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Kaco Inverter - transfer from CSV to Domoticz

Post by plantex »

Hello Everyone
I've got Kaco inverter (apparently this is Siemens) , unfortunately havent seen solution in the web in terms of pulling data to Domoticz :/ which I am trying to do.
I've got an access by chrome typing http://192.168.1.21/20201026.csv - then Kaco is giving me the whole table with values.

Code: Select all

Typ falownika;Numer seryjny;Adres RS485;Adres IP;Zysk[kWh]
blueplanet 5.0 TL3;XXXXXXXXXXXXX;1;192.168.1.21;13.53
Godzina;Udc1[V];Idc1[A];Pdc1[W];Udc2[V];Idc2[A];Pdc2[W];Uac1[V];Iac1[A];Uac2[V];Iac2[A];Uac3[V];Iac3[A];Pdc[W];[b]Pac[W[/b]];Tsys[°C]
07:21:59;0.0;0.00;0;0.0;0.00;0;0.0;0.00;0.0;0.00;0.0;0.00;0;0;0.0
07:22:07;13.8;0.03;0;72.1;0.02;1;231.4;0.00;228.4;0.00;229.8;0.00;2;0;20.7
07:22:25;0.0;0.00;0;0.0;0.00;0;0.0;0.00;0.0;0.00;0.0;0.00;0;0;0.0
07:27:25;85.3;0.00;0;481.2;0.00;0;226.3;0.00;225.2;0.00;226.6;0.00;0;0;21.0
07:32:25;95.3;0.00;0;508.5;0.01;7;230.2;0.01;228.4;0.01;229.0;0.01;9;9;22.2
07:37:25;2.0;0.00;0;455.1;0.11;54;230.4;0.07;229.7;0.07;228.7;0.07;54;53;23.1
07:42:25;2.0;0.00;0;455.1;0.14;66;230.8;0.09;229.4;0.09;228.8;0.09;66;65;24.0
07:47:25;2.0;0.00;0;455.1;0.18;81;230.7;0.11;228.2;0.11;227.9;0.11;82;80;24.6
07:52:25;2.0;0.00;0;455.1;0.22;102;230.8;0.14;227.6;0.14;228.5;0.14;103;102;25.1
...
16:22:44;2.0;0.00;0;482.0;0.25;120;228.6;0.17;221.8;0.18;230.1;0.17;121;120;36.9
16:27:44;2.0;0.00;0;473.5;0.22;105;227.6;0.15;222.3;0.15;229.7;0.15;106;105;36.8
16:32:44;2.0;0.00;0;473.8;0.20;98;227.3;0.14;223.8;0.14;232.2;0.13;99;97;36.7
16:37:44;2.0;0.00;0;464.0;0.18;86;227.6;0.12;225.0;0.12;232.4;0.12;86;85;36.6
16:42:44;2.1;0.00;0;455.1;0.17;79;229.9;0.10;224.6;0.11;231.8;0.10;79;77;36.5
16:47:45;2.1;0.00;0;455.1;0.16;75;230.1;0.10;225.1;0.10;230.7;0.10;75;74;36.4
16:52:45;2.0;0.00;0;455.1;0.13;61;229.8;0.08;225.5;0.08;229.8;0.08;62;61;36.3
16:57:45;2.0;0.00;0;455.1;0.11;54;231.2;0.07;224.6;0.07;228.8;0.07;54;53;36.2
and so on ...
The name of the csv file is current date (above case 26th of October).
It looks like Kaco sends values every 5 minutes until the value of energy Pac[W] drops to 0 - then it finish to store the data.
I am trying to pull two values:
1st row is a description for profit - Zysk[kWh] which is stored in 2nd row and for now is 13.53
then
3rd row there is a description for currently produced energy Pac[W] which is stored in the next rows...

So I would like to collect data for two dummy devices - Profit(kWh) and Currently produced energy [W] and refreshed every 5 minutes.

Could somebody help me with a working script ? I am unfortunately not a programmer
My problem is "living" csv file - everyday different file name, where "inside" every 5 minutes new value is added, then it ends at different time (now 5pm, summertime of course late c.a. 9pm...)

Help please.
Thank You in advance.
User avatar
FireWizard
Posts: 1862
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by FireWizard »

HI,

According to a Post in the Home Assistant forum, this inverter supports Modbus.
See: https://community.home-assistant.io/t/c ... /165625/40
(Post from May 23)

Also this might help you: https://github.com/ardexa/kaco-inverters

and

https://github.com/plieningerweb/kacors485

I have also found at https://forum.fhem.de/index.php?topic=98581.0, that the unit is SolarEdge oriented.

If you "google" on Kako and Github you will find a number of projects.

If you can enable the ModBus protocol then it is not too difficult to read the register with Node Red and pushing the desired data to Domoticz with MQTT.

Regards
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by waaren »

plantex wrote: Monday 26 October 2020 16:13 I've got Kaco inverter (apparently this is Siemens) , unfortunately havent seen solution in the web in terms of pulling data to Domoticz :/ which I am trying to do.
Could somebody help me with a working script ? I am unfortunately not a programmer
Can you try with this 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

--[[    Kaco Inverter - transfer from CSV to Domoticz

        I've got Kaco inverter http://192.168.1.21/20201026.csv - then Kaco is giving me the whole table with values.
        The name of the csv file is current date
        It looks like Kaco sends values every 5 minutes until the value of energy Pac[W] drops to 0 - then it finish to store the data.

        pull two values:
        1st row is a description for profit - Zysk[kWh] which is stored in 2nd row and for now is 13.53
        3rd row there is a description for currently produced energy Pac[W] which is stored in the next rows...
        So I would like to collect data for two dummy devices - Profit(kWh) and Currently produced energy [W] and refreshed every 5 minutes.

]]

local scriptVar = 'KacoInverter'

return
{
    on =
    {
        timer =
        {
            'every 5 minutes between sunrise and sunset',  -- Change to reflect your requirements
            'every minute',
        },

        devices =
        {
            scriptVar .. 'Trigger', -- for test and development only; can be ignored during normal execution
        },

        httpResponses =
        {
            scriptVar,
        },
    },

    logging =
    {
        level = domoticz.LOG_INFO, -- change to domoticz.LOG_ERROR when all OK or domoticz.LOG_DEBUG if you need to DEBUG
        marker = scriptVar,
    },

    execute = function(dz, item)
        local test = false

        if item.isTimer or item.isDevice then
            local dateURL = 'http://192.168.1.21/' .. dz.time.year .. dz.time.month .. dz.time.day .. '.csv'
            dz.log(dateURL,dz.LOG_DEBUG)

            if test then dateURL = dz.settings['Domoticz url'] .. '/json.htm?type=command&param=getversion' end

            dz.openURL(
                {
                    url = dateURL,
                    callback = scriptVar,
                })
            return
        end

        local csvString ="Typ falownika;Numer seryjny;Adres RS485;Adres IP;Zysk[kWh]\rblueplanet 5.0 TL3;XXXXXXXXXXXXX;1;192.168.1.21;13.53\rGodzina;Udc1[V];Idc1[A];Pdc1[W];Udc2[V];Idc2[A];Pdc2[W];Uac1[V];Iac1[A];Uac2[V];Iac2[A];Uac3[V];Iac3[A];Pdc[W];[b]Pac[W[/b]];Tsys[°C]\r07:21:59;0.0;0.00;0;0.0;0.00;0;0.0;0.00;0.0;0.00;0.0;0.00;0;0;0.0\r07:22:07;13.8;0.03;0;72.1;0.02;1;231.4;0.00;228.4;0.00;229.8;0.00;2;0;20.7\r07:22:25;0.0;0.00;0;0.0;0.00;0;0.0;0.00;0.0;0.00;0.0;0.00;0;0;0.0\r07:27:25;85.3;0.00;0;481.2;0.00;0;226.3;0.00;225.2;0.00;226.6;0.00;0;0;2.0\r07:32:25;95.3;0.00;0;508.5;0.01;7;230.2;0.01;228.4;0.01;229.0;0.01;9;9;22.2\r07:37:25;2.0;0.00;0;455.1;0.11;54;230.4;0.07;229.7;0.07;22.7;0.07;54;53;23.1\r07:42:25;2.0;0.00;0;455.1;0.14;66;230.8;0.09;229.4;0.09;228.8;0.09;66;65;24.0\r07:47:25;2.0;0.00;0;455.1;0.18;81;230.7;11;228.2;0.11;227.9;0.11;82;80;24.6\r07:52:25;2.0;0.00;0;455.1;0.22;102;230.8;0.14;227.6;0.14;228.5;0.14;103;102;25.1"

        if test then item.data = csvString end

        if item.isHTTPResponse and item.ok then
            local dataTable = {}
            local pacWColumn = 15
            local zyskRow = 2
            local zyskColumn = 5
            local timeColumn = 1

            local profit = dz.devices('Profit') -- define as counter 
            local energy = dz.devices('Pac energy')   -- define as Usage electric

            local rows = dz.utils.stringSplit(item.data, '\r')
            for rowNumber, row in ipairs(rows) do

                dataTable[rowNumber] = {}
                local cells = dz.utils.stringSplit(row, ';')

                for columnNumber, cel in ipairs(cells) do
                    dataTable[rowNumber][columnNumber] = cel
                end

            end

            if _G.logLevel == dz.LOG_DEBUG then dz.utils.dumpTable(dataTable) end
            dz.log('zysk = ' .. dataTable[zyskRow][zyskColumn] .. ' kWh')
            dz.log('Pac = ' .. dataTable[#dataTable][pacWColumn] .. ' W' .. ' at ' .. dataTable[#dataTable][timeColumn])

            profit.updateCounter(dataTable[zyskRow][zyskColumn])
            energy.updateEnergy(dataTable[#dataTable][pacWColumn])
        else
            dz.log('There was a problem handling the request', dz.LOG_ERROR)
            dz.log(item, dz.LOG_DEBUG)
        end

    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
plantex
Posts: 9
Joined: Monday 30 October 2017 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by plantex »

Hi waaren
Thank You for your script.
I've created two dummy as described in your recipe.
I did not create extra http poller.
Also I'm not sure if I have to change something in this line - dont understand what is a "Trigger" in that case ?

Code: Select all

devices =
        {
            scriptVar .. 'Trigger', -- for test and development only; can be ignored during normal execution
        },

Should I create some user variables ? or device called trigger ?
Also changed one line to my domoticz location :

Code: Select all

if test then dateURL = dz.settings['http://192.168.1.101:8080/'] .. '/json.htm?type=command&param=getversion' end
I've enabled debug to see a little more.

Code: Select all

2020-10-27 12:42:02.175 Status: dzVents: > 886: 226.9
2020-10-27 12:42:02.175 Status: dzVents: > 887: 1.13
2020-10-27 12:42:02.175 Status: dzVents: > 888: 226.2
2020-10-27 12:42:02.175 Status: dzVents: > 889: 1.14
2020-10-27 12:42:02.175 Status: dzVents: > 890: 232.3
2020-10-27 12:42:02.175 Status: dzVents: > 891: 1.11
2020-10-27 12:42:02.175 Status: dzVents: > 892: 784
2020-10-27 12:42:02.175 Status: dzVents: > 893: 775
2020-10-27 12:42:02.175 Status: dzVents: > 894: 36.0 12:18:35
2020-10-27 12:42:02.175 Status: dzVents: > 895: 2.1
2020-10-27 12:42:02.175 Status: dzVents: > 896: 0.00
2020-10-27 12:42:02.175 Status: dzVents: > 897: 0
2020-10-27 12:42:02.175 Status: dzVents: > 898: 515.6
2020-10-27 12:42:02.175 Status: dzVents: > 899: 1.27
2020-10-27 12:42:02.175 Status: dzVents: > 900: 657
2020-10-27 12:42:02.175 Status: dzVents: > 901: 227.0
2020-10-27 12:42:02.175 Status: dzVents: > 902: 0.95
2020-10-27 12:42:02.175 Status: dzVents: > 903: 224.3
2020-10-27 12:42:02.175 Status: dzVents: > 904: 0.96
2020-10-27 12:42:02.175 Status: dzVents: > 905: 230.5
2020-10-27 12:42:02.176 Status: dzVents: > 906: 0.93
2020-10-27 12:42:02.176 Status: dzVents: > 907: 658
2020-10-27 12:42:02.176 Status: dzVents: > 908: 648
2020-10-27 12:42:02.176 Status: dzVents: > 909: 36.0 12:23:35
2020-10-27 12:42:02.176 Status: dzVents: > 910: 2.1
2020-10-27 12:42:02.176 Status: dzVents: > 911: 0.00
2020-10-27 12:42:02.176 Status: dzVents: > 912: 0
2020-10-27 12:42:02.176 Status: dzVents: > 913: 522.8
2020-10-27 12:42:02.176 Status: dzVents: > 914: 1.61
2020-10-27 12:42:02.176 Status: dzVents: > 915: 844
2020-10-27 12:42:02.176 Status: dzVents: > 916: 227.1
2020-10-27 12:42:02.176 Status: dzVents: > 917: 1.22
2020-10-27 12:42:02.176 Status: dzVents: > 918: 227.3
2020-10-27 12:42:02.176 Status: dzVents: > 919: 1.22
2020-10-27 12:42:02.176 Status: dzVents: > 920: 232.9
2020-10-27 12:42:02.176 Status: dzVents: > 921: 1.19
2020-10-27 12:42:02.176 Status: dzVents: > 922: 844
2020-10-27 12:42:02.176 Status: dzVents: > 923: 833
2020-10-27 12:42:02.176 Status: dzVents: > 924: 36.0 12:28:35
2020-10-27 12:42:02.176 Status: dzVents: > 925: 2.1
2020-10-27 12:42:02.176 Status: dzVents: > 926: 0.00
2020-10-27 12:42:02.176 Status: dzVents: > 927: 0
2020-10-27 12:42:02.176 Status: dzVents: > 928: 513.8
2020-10-27 12:42:02.176 Status: dzVents: > 929: 1.04
2020-10-27 12:42:02.176 Status: dzVents: > 930: 534
2020-10-27 12:42:02.176 Status: dzVents: > 931: 226.9
2020-10-27 12:42:02.176 Status: dzVents: > 932: 0.77
2020-10-27 12:42:02.176 Status: dzVents: > 933: 227.9
2020-10-27 12:42:02.176 Status: dzVents: > 934: 0.77
2020-10-27 12:42:02.176 Status: dzVents: > 935: 231.2
2020-10-27 12:42:02.176 Status: dzVents: > 936: 0.75
2020-10-27 12:42:02.176 Status: dzVents: > 937: 535
2020-10-27 12:42:02.176 Status: dzVents: > 938: 527
2020-10-27 12:42:02.176 Status: dzVents: > 939: 36.0 12:33:35
2020-10-27 12:42:02.176 Status: dzVents: > 940: 2.1
2020-10-27 12:42:02.176 Status: dzVents: > 941: 0.00
2020-10-27 12:42:02.176 Status: dzVents: > 942: 0
2020-10-27 12:42:02.176 Status: dzVents: > 943: 523.2
2020-10-27 12:42:02.176 Status: dzVents: > 944: 1.52
2020-10-27 12:42:02.177 Status: dzVents: > 945: 798
2020-10-27 12:42:02.177 Status: dzVents: > 946: 227.6
2020-10-27 12:42:02.177 Status: dzVents: > 947: 1.15
2020-10-27 12:42:02.177 Status: dzVents: > 948: 227.9
2020-10-27 12:42:02.177 Status: dzVents: > 949: 1.15
2020-10-27 12:42:02.177 Status: dzVents: > 950: 231.9
2020-10-27 12:42:02.177 Status: dzVents: > 951: 1.12
2020-10-27 12:42:02.177 Status: dzVents: > 952: 798
2020-10-27 12:42:02.177 Status: dzVents: > 953: 787
2020-10-27 12:42:02.177 Status: dzVents: > 954: 36.0 12:38:35
2020-10-27 12:42:02.177 Status: dzVents: > 955: 2.1
2020-10-27 12:42:02.177 Status: dzVents: > 956: 0.00
2020-10-27 12:42:02.177 Status: dzVents: > 957: 0
2020-10-27 12:42:02.177 Status: dzVents: > 958: 523.8
2020-10-27 12:42:02.177 Status: dzVents: > 959: 1.55
2020-10-27 12:42:02.177 Status: dzVents: > 960: 815
2020-10-27 12:42:02.177 Status: dzVents: > 961: 229.0
2020-10-27 12:42:02.177 Status: dzVents: > 962: 1.17
2020-10-27 12:42:02.177 Status: dzVents: > 963: 226.7
2020-10-27 12:42:02.177 Status: dzVents: > 964: 1.18
2020-10-27 12:42:02.177 Status: dzVents: > 965: 231.8
2020-10-27 12:42:02.177 Status: dzVents: > 966: 1.15
2020-10-27 12:42:02.177 Status: dzVents: > 967: 816
2020-10-27 12:42:02.177 Status: dzVents: > 968: 807
2020-10-27 12:42:02.177 Status: dzVents: > 969: 35.9 12:40:59
2020-10-27 12:42:02.177 Status: dzVents: > 970: 2.1
2020-10-27 12:42:02.177 Status: dzVents: > 971: 0.00
2020-10-27 12:42:02.177 Status: dzVents: > 972: 0
2020-10-27 12:42:02.177 Status: dzVents: > 973: 511.7
2020-10-27 12:42:02.177 Status: dzVents: > 974: 1.91
2020-10-27 12:42:02.177 Status: dzVents: > 975: 980
2020-10-27 12:42:02.177 Status: dzVents: > 976: 223.8
2020-10-27 12:42:02.177 Status: dzVents: > 977: 1.43
2020-10-27 12:42:02.177 Status: dzVents: > 978: 226.5
2020-10-27 12:42:02.178 Status: dzVents: > 979: 1.41
2020-10-27 12:42:02.178 Status: dzVents: > 980: 231.3
2020-10-27 12:42:02.178 Status: dzVents: > 981: 1.38
2020-10-27 12:42:02.178 Status: dzVents: > 982: 981
2020-10-27 12:42:02.178 Status: dzVents: > 983: 962
2020-10-27 12:42:02.178 Status: dzVents: > 984: 39.0
2020-10-27 12:42:02.178 Status: dzVents: Info: KacoInverter: ------ Finished Script #1
2020-10-27 12:42:02.178 Error: dzVents: Error: (3.0.2) KacoInverter: An error occurred when calling event handler Script #1
2020-10-27 12:42:02.178 Error: dzVents: Error: (3.0.2) KacoInverter: ...domoticz/scripts/dzVents/generated_scripts/Script #1.lua:87: attempt to index a nil value (field '?')
So the log shows an error. line 87 ?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by waaren »

plantex wrote: Tuesday 27 October 2020 12:49 I did not create extra http poller.
Also I'm not sure if I have to change something in this line - dont understand what is a "Trigger" in that case ?
That's OK just leave it in. It's for testing only and will not do anything during normal operation
Should I create some user variables ? or device called trigger ?
No it triggers on time
Also changed one line to my domoticz location :
Also only used during test. Will not do anything during normal operation
2020-10-27 12:42:02.178 Status: dzVents: Info: KacoInverter: ------ Finished Script #1
2020-10-27 12:42:02.178 Error: dzVents: Error: (3.0.2) KacoInverter: An error occurred when calling event handler Script #1
2020-10-27 12:42:02.178 Error: dzVents: Error: (3.0.2) KacoInverter: ...domoticz/scripts/dzVents/generated_scripts/Script #1.lua:87: attempt to index a nil value (field '?')[/code]
What happened is that dzVents does not recognize the separation of the individual lines in your csv return. It checks for a \n to separate the csv into rows.

Can you please run below script once and share the log? It will show me what code your output has for separating the lines.

Code: Select all

--[[    Kaco Inverter - transfer from CSV to Domoticz

        I've got Kaco inverter http://192.168.1.21/20201026.csv - then Kaco is giving me the whole table with values.
        The name of the csv file is current date
        It looks like Kaco sends values every 5 minutes until the value of energy Pac[W] drops to 0 - then it finish to store the data.

        pull two values:
        1st row is a description for profit - Zysk[kWh] which is stored in 2nd row and for now is 13.53
        3rd row there is a description for currently produced energy Pac[W] which is stored in the next rows...
        So I would like to collect data for two dummy devices - Profit(kWh) and Currently produced energy [W] and refreshed every 5 minutes.

]]

local scriptVar = 'KacoInverter'

return
{
    on =
    {
        timer =
        {
            'every 5 minutes between sunrise and sunset',  -- Change to reflect your requirements
            'every minute',
        },

        devices =
        {
            scriptVar .. 'Trigger', -- for test and development only; can be ignored during normal execution
        },

        httpResponses =
        {
            scriptVar,
        },
    },

    logging =
    {
        level = domoticz.LOG_INFO, -- change to domoticz.LOG_ERROR when all OK or domoticz.LOG_DEBUG if you need to DEBUG
        marker = scriptVar,
    },

    execute = function(dz, item)
        local test = false

        if item.isTimer or item.isDevice then
            local dateURL = 'http://192.168.1.21/' .. dz.time.year .. dz.time.month .. dz.time.day .. '.csv'
            dz.log(dateURL,dz.LOG_DEBUG)

            if test then dateURL = dz.settings['Domoticz url'] .. '/json.htm?type=command&param=getversion' end

            dz.openURL(
                {
                    url = dateURL,
                    callback = scriptVar,
                })
            return
        end

        local csvString ="Typ falownika;Numer seryjny;Adres RS485;Adres IP;Zysk[kWh]\nblueplanet 5.0 TL3;XXXXXXXXXXXXX;1;192.168.1.21;13.53\nGodzina;Udc1[V];Idc1[A];Pdc1[W];Udc2[V];Idc2[A];Pdc2[W];Uac1[V];Iac1[A];Uac2[V];Iac2[A];Uac3[V];Iac3[A];Pdc[W];[b]Pac[W[/b]];Tsys[°C]\n07:21:59;0.0;0.00;0;0.0;0.00;0;0.0;0.00;0.0;0.00;0.0;0.00;0;0;0.0\n07:22:07;13.8;0.03;0;72.1;0.02;1;231.4;0.00;228.4;0.00;229.8;0.00;2;0;20.7\n07:22:25;0.0;0.00;0;0.0;0.00;0;0.0;0.00;0.0;0.00;0.0;0.00;0;0;0.0\n07:27:25;85.3;0.00;0;481.2;0.00;0;226.3;0.00;225.2;0.00;226.6;0.00;0;0;2.0\n07:32:25;95.3;0.00;0;508.5;0.01;7;230.2;0.01;228.4;0.01;229.0;0.01;9;9;22.2\n07:37:25;2.0;0.00;0;455.1;0.11;54;230.4;0.07;229.7;0.07;22.7;0.07;54;53;23.1\n07:42:25;2.0;0.00;0;455.1;0.14;66;230.8;0.09;229.4;0.09;228.8;0.09;66;65;24.0\n07:47:25;2.0;0.00;0;455.1;0.18;81;230.7;11;228.2;0.11;227.9;0.11;82;80;24.6\n07:52:25;2.0;0.00;0;455.1;0.22;102;230.8;0.14;227.6;0.14;228.5;0.14;103;102;25.1"

        if test then item.data = csvString end

        if item.isHTTPResponse and item.ok then
            local dataTable = {}
            local pacWColumn = 15
            local zyskRow = 2
            local zyskColumn = 5
            local timeColumn = 1

            local profit = dz.devices('Profit') -- define as counter 
            local energy = dz.devices('Pac energy')   -- define as Usage electric
            
            do
                dz.log(dz.utils.urlEncode( (item.data:sub(1,400) )  ) , dz.LOG_FORCE) 
                return
            end
            
            local rows = dz.utils.stringSplit(item.data, '\n')
            for rowNumber, row in ipairs(rows) do

                dataTable[rowNumber] = {}
                local cells = dz.utils.stringSplit(row, ';')

                for columnNumber, cel in ipairs(cells) do
                    dataTable[rowNumber][columnNumber] = cel
                end

            end

            if _G.logLevel == dz.LOG_DEBUG then dz.utils.dumpTable(dataTable) end
            dz.log('zysk = ' .. dataTable[zyskRow][zyskColumn] .. ' kWh')
            dz.log('Pac = ' .. dataTable[#dataTable][pacWColumn] .. ' W' .. ' at ' .. dataTable[#dataTable][timeColumn])

            profit.updateCounter(dataTable[zyskRow][zyskColumn])
            energy.updateEnergy(dataTable[#dataTable][pacWColumn])
        else
            dz.log('There was a problem handling the request', dz.LOG_ERROR)
            dz.log(item, dz.LOG_DEBUG)
        end

    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
plantex
Posts: 9
Joined: Monday 30 October 2017 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by plantex »

Below fresh log :D

Code: Select all

2020-10-27 15:09:00.632 Status: dzVents: Info: KacoInverter: ------ Start internal script: Script #2:, trigger: "every minute"
2020-10-27 15:09:00.633 Status: dzVents: Info: KacoInverter: ------ Finished Script #2
2020-10-27 15:09:00.633 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-10-27 15:09:02.917 Status: dzVents: Info: Handling httpResponse-events for: "KacoInverter"
2020-10-27 15:09:02.918 Status: dzVents: Info: KacoInverter: ------ Start internal script: Script #2: HTTPResponse: "KacoInverter"
2020-10-27 15:09:02.938 Status: dzVents: !Info: KacoInverter: Typ+falownika%3BNumer+seryjny%3BAdres+RS485%3BAdres+IP%3BZysk%5BkWh%5D%0Dblueplanet+5.0+TL3%3B5.0TL01716052%3B1%3B192.168.1.21%3B8.58%0DGodzina%3BUdc1%5BV%5D%3BIdc1%5BA%5D%3BPdc1%5BW%5D%3BUdc2%5BV%5D%3BIdc2%5BA%5D%3BPdc2%5BW%5D%3BUac1%5BV%5D%3BIac1%5BA%5D%3BUac2%5BV%5D%3BIac2%5BA%5D%3BUac3%5BV%5D%3BIac3%5BA%5D%3BPdc%5BW%5D%3BPac%5BW%5D%3BTsys%5B%B0C%5D%0D07%3A41%3A46%3B0.0%3B0.00%3B0%3B0.0%3B0.00%3B0%3B0.0%3B0.00%3B0.0%3B0.00%3B0.0%3B0.00%3B0%3B0%3B0.0%0D07%3A42%3A01%3B9.3%3B0.01%3B0%3B69.0%3B0.00%3B0%3B138.4%3B0.00%3B138.6%3B0.00%3B139.4%3B0.00%3B0%3B0%3B13.3%0D07%3A42%3A18%3B0.0%3B0.00%3B0%3B0
2020-10-27 15:09:02.939 Status: dzVents: Info: KacoInverter: ------ Finished Script #2
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by waaren »

plantex wrote: Tuesday 27 October 2020 15:11 Below fresh log :D
Ok I changed the script in my original posting to use \r (0D)
Please use that one to test further.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
plantex
Posts: 9
Joined: Monday 30 October 2017 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by plantex »

Master waaren almost there :)
Log seems to be ok
Now wondering why the Profit value is still 0.000 not being updated.
Pac energy works like crazy :)

Code: Select all

2020-10-27 15:39:00.531 Status: dzVents: Info: KacoInverter: ------ Start internal script: Script #3:, trigger: "every minute"
2020-10-27 15:39:00.531 Status: dzVents: Info: KacoInverter: ------ Finished Script #3
2020-10-27 15:39:00.532 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-10-27 15:39:03.501 Status: dzVents: Info: Handling httpResponse-events for: "KacoInverter"
2020-10-27 15:39:03.501 Status: dzVents: Info: KacoInverter: ------ Start internal script: Script #3: HTTPResponse: "KacoInverter"
2020-10-27 15:39:03.528 Status: dzVents: Info: KacoInverter: zysk = 8.81 kWh
2020-10-27 15:39:03.528 Status: dzVents: Info: KacoInverter: Pac = 241 W at 15:36:53
2020-10-27 15:39:03.529 Status: dzVents: Info: KacoInverter: ------ Finished Script #3
2020-10-27 15:39:03.529 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-10-27 15:40:00.542 Status: dzVents: Info: KacoInverter: ------ Start internal script: Script #3:, trigger: "every 5 minutes between sunrise and sunset"
2020-10-27 15:40:00.542 Status: dzVents: Info: KacoInverter: ------ Finished Script #3
2020-10-27 15:40:00.543 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-10-27 15:40:02.976 Status: dzVents: Info: Handling httpResponse-events for: "KacoInverter"
2020-10-27 15:40:02.976 Status: dzVents: Info: KacoInverter: ------ Start internal script: Script #3: HTTPResponse: "KacoInverter"
2020-10-27 15:40:03.006 Status: dzVents: Info: KacoInverter: zysk = 8.81 kWh
2020-10-27 15:40:03.006 Status: dzVents: Info: KacoInverter: Pac = 241 W at 15:36:53
2020-10-27 15:40:03.006 Status: dzVents: Info: KacoInverter: ------ Finished Script #3
2020-10-27 15:40:03.006 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-10-27 15:41:00.590 Status: dzVents: Info: KacoInverter: ------ Start internal script: Script #3:, trigger: "every minute"
2020-10-27 15:41:00.590 Status: dzVents: Info: KacoInverter: ------ Finished Script #3
2020-10-27 15:41:00.590 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-10-27 15:41:02.919 Status: dzVents: Info: Handling httpResponse-events for: "KacoInverter"
2020-10-27 15:41:02.919 Status: dzVents: Info: KacoInverter: ------ Start internal script: Script #3: HTTPResponse: "KacoInverter"
2020-10-27 15:41:02.946 Status: dzVents: Info: KacoInverter: zysk = 8.81 kWh
2020-10-27 15:41:02.946 Status: dzVents: Info: KacoInverter: Pac = 241 W at 15:36:53
2020-10-27 15:41:02.947 Status: dzVents: Info: KacoInverter: ------ Finished Script #3
2020-10-27 15:41:02.947 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
Attachments
energy.PNG
energy.PNG (17.67 KiB) Viewed 1376 times
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by waaren »

plantex wrote: Tuesday 27 October 2020 15:51 Now wondering why the Profit value is still 0.000 not being updated.
Patience ... the value in the label in the Profit sensor is your daily total. When there is no previous value it cannot be determined yet. It should be there tomorrow.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
plantex
Posts: 9
Joined: Monday 30 October 2017 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by plantex »

Looks good :)

I set the Profit device as counter , type:Energy , divider I set to 1.

Result as attached.

Do You know maybe why there is a difference in these two values ? Main label is rounded down.. 8.980 -->8.000

Is there a way to force Domoticz and show the exact same value in the main label bar ?
Attachments
profit 1.PNG
profit 1.PNG (8.75 KiB) Viewed 1369 times
profit type.PNG
profit type.PNG (14.64 KiB) Viewed 1369 times
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by waaren »

plantex wrote: Tuesday 27 October 2020 17:49 Is there a way to force Domoticz and show the exact same value in the main label bar ?
You don't want that. They represent different things. On the top you see daily total, in the center you see overall total
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
plantex
Posts: 9
Joined: Monday 30 October 2017 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by plantex »

Hello again
waaren - Thank You very much for the script !

I have a tiny problem with date format.
It's 1st of November today and DzVents generated such file name: 2020111.csv --> so it is 2020 11 1 - I'm missing zero before a digit representing current day. I believe should be 20201101.csv

I tried to find workaround :

Code: Select all

local dateURL = 'http://192.168.1.12/' .. dz.time.year .. dz.time.month ..'0'.. dz.time.day .. '.csv'
- seems to work , but in that case my extra zero is there forever :)
Could You help me with the day format please ? so the script will add "extra zero" just for 1st to 9th day of the month.

Regarding the energy counter - maybe I'm missing something but it doesn't work as You described in Your previous post.
"On the top you see daily total, in the center you see overall total"
Last days I had some kWh generated and Domoticz is not showing the overall.
What I've got is the same like I had before: Main label is rounded down..eg. 8.980 -->8.000 and center is showing 8.980

Anyway Thank You for your help.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by waaren »

plantex wrote: Sunday 01 November 2020 13:00 I have a tiny problem with date format.
It's 1st of November today and DzVents generated such file name: 2020111.csv --> so it is 2020 11 1 - I'm missing zero before a digit representing current day. I believe should be 20201101.csv
Could You help me with the day format please ? so the script will add "extra zero" for 1st to 9th day of the month.
See below script where I used string.format
Regarding the energy counter - maybe I'm missing something but it doesn't work as You described in Your previous post.
"On the top you see daily total, in the center you see overall total"
Last days I had some kWh generated and Domoticz is not showing the overall.
What I've got is the same like I had before: Main label is rounded down..eg. 8.980 -->8.000 and center is showing 8.980
You might want to try this one.

Code: Select all

--[[    Kaco Inverter - transfer from CSV to Domoticz

        I've got Kaco inverter http://192.168.1.21/20201026.csv - then Kaco is giving me the whole table with values.
        The name of the csv file is current date
        It looks like Kaco sends values every 5 minutes until the value of energy Pac[W] drops to 0 - then it finish to store the data.

        pull two values:
        1st row is a description for profit - Zysk[kWh] which is stored in 2nd row and for now is 13.53
        3rd row there is a description for currently produced energy Pac[W] which is stored in the next rows...
        So I would like to collect data for two dummy devices - Profit(kWh) and Currently produced energy [W] and refreshed every 5 minutes.

]]

local scriptVar = 'KacoInverter'

return
{
    on =
    {
        timer =
        {
            'every 5 minutes between sunrise and sunset',  -- Change to reflect your requirements
            'every minute',
        },

        devices =
        {
            scriptVar .. 'Trigger', -- for test and development only; can be ignored during normal execution
        },

        httpResponses =
        {
            scriptVar,
        },
    },

    data =
    {
        total =
        {
            initial = 0,
        },
    },

    logging =
    {
        level = domoticz.LOG_INFO, -- change to domoticz.LOG_ERROR when all OK or domoticz.LOG_DEBUG if you need to DEBUG
        marker = scriptVar,
    },

    execute = function(dz, item)
        local test = false

        if item.isTimer or item.isDevice then
            local dateURL = 'http://192.168.1.21/' .. string.format("%04d%02d%02d",dz.time.year,dz.time.month,dz.time.day) .. '.csv'
            dz.log(dateURL,dz.LOG_DEBUG)

            if test then dateURL = dz.settings['Domoticz url'] .. '/json.htm?type=command&param=getversion' end

            dz.openURL(
                {
                    url = dateURL,
                    callback = scriptVar,
                })
            return
        end

        local csvString ="Typ falownika;Numer seryjny;Adres RS485;Adres IP;Zysk[kWh]\nblueplanet 5.0 TL3;XXXXXXXXXXXXX;1;192.168.1.21;13.53\nGodzina;Udc1[V];Idc1[A];Pdc1[W];Udc2[V];Idc2[A];Pdc2[W];Uac1[V];Iac1[A];Uac2[V];Iac2[A];Uac3[V];Iac3[A];Pdc[W];[b]Pac[W[/b]];Tsys[°C]\n07:21:59;0.0;0.00;0;0.0;0.00;0;0.0;0.00;0.0;0.00;0.0;0.00;0;0;0.0\n07:22:07;13.8;0.03;0;72.1;0.02;1;231.4;0.00;228.4;0.00;229.8;0.00;2;0;20.7\n07:22:25;0.0;0.00;0;0.0;0.00;0;0.0;0.00;0.0;0.00;0.0;0.00;0;0;0.0\n07:27:25;85.3;0.00;0;481.2;0.00;0;226.3;0.00;225.2;0.00;226.6;0.00;0;0;2.0\n07:32:25;95.3;0.00;0;508.5;0.01;7;230.2;0.01;228.4;0.01;229.0;0.01;9;9;22.2\n07:37:25;2.0;0.00;0;455.1;0.11;54;230.4;0.07;229.7;0.07;22.7;0.07;54;53;23.1\n07:42:25;2.0;0.00;0;455.1;0.14;66;230.8;0.09;229.4;0.09;228.8;0.09;66;65;24.0\n07:47:25;2.0;0.00;0;455.1;0.18;81;230.7;11;228.2;0.11;227.9;0.11;82;80;24.6\n07:52:25;2.0;0.00;0;455.1;0.22;102;230.8;0.14;227.6;0.14;228.5;0.14;103;102;25.1"

        if test then item.data = csvString end

        if item.isHTTPResponse and item.ok then
            local dataTable = {}
            local pacWColumn = 15
            local zyskRow = 2
            local zyskColumn = 5
            local timeColumn = 1

            local profit = dz.devices('Profit') -- define as counter
            local energy = dz.devices('Pac energy')   -- define as Usage electric

            local rows = dz.utils.stringSplit(item.data, '\r')
            for rowNumber, row in ipairs(rows) do

                dataTable[rowNumber] = {}
                local cells = dz.utils.stringSplit(row, ';')

                for columnNumber, cel in ipairs(cells) do
                    dataTable[rowNumber][columnNumber] = cel
                end

            end

            if _G.logLevel == dz.LOG_DEBUG then dz.utils.dumpTable(dataTable) end
            dz.log('zysk = ' .. dataTable[zyskRow][zyskColumn] .. ' kWh')
            dz.log('Pac = ' .. dataTable[#dataTable][pacWColumn] .. ' W' .. ' at ' .. dataTable[#dataTable][timeColumn])

            if profit.counterToday == 0  then  -- Keep total counter
                dz.data.total = profit.counter
            end
            profit.updateCounter(dz.data.total + dataTable[zyskRow][zyskColumn])
            energy.updateEnergy(dataTable[#dataTable][pacWColumn])
        else
            dz.log('There was a problem handling the request', dz.LOG_ERROR)
            dz.log(item, dz.LOG_DEBUG)
        end

    end
}

Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
plantex
Posts: 9
Joined: Monday 30 October 2017 20:50
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by plantex »

Hello

I tried the last script - please see the log

Code: Select all

2020-11-02 22:29:00.391 Status: dzVents: Info: KacoInverter: ------ Start internal script: Script #1:, trigger: "every minute"
2020-11-02 22:29:00.393 Status: dzVents: Info: KacoInverter: ------ Finished Script #1
2020-11-02 22:29:00.393 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-11-02 22:29:02.879 Status: dzVents: Info: Handling httpResponse-events for: "KacoInverter"
2020-11-02 22:29:02.879 Status: dzVents: Info: KacoInverter: ------ Start internal script: Script #1: HTTPResponse: "KacoInverter"
2020-11-02 22:29:02.904 Status: dzVents: !Info: KacoInverter: Typ+falownika%3BNumer+seryjny%3BAdres+RS485%3BAdres+IP%3BZysk%5BkWh%5D%0Dblueplanet+5.0+TL3%3B5.0TL01716052%3B1%3B192.168.1.12%3B3.08%0DGodzina%3BUdc1%5BV%5D%3BIdc1%5BA%5D%3BPdc1%5BW%5D%3BUdc2%5BV%5D%3BIdc2%5BA%5D%3BPdc2%5BW%5D%3BUac1%5BV%5D%3BIac1%5BA%5D%3BUac2%5BV%5D%3BIac2%5BA%5D%3BUac3%5BV%5D%3BIac3%5BA%5D%3BPdc%5BW%5D%3BPac%5BW%5D%3BTsys%5B%B0C%5D%0D06%3A24%3A48%3B0.0%3B0.00%3B0%3B0.0%3B0.00%3B0%3B0.0%3B0.00%3B0.0%3B0.00%3B0.0%3B0.00%3B0%3B0%3B0.0%0D06%3A25%3A08%3B10.9%3B0.02%3B0%3B82.3%3B0.01%3B1%3B147.4%3B0.00%3B146.4%3B0.00%3B148.9%3B0.00%3B1%3B0%3B12.8%0D06%3A25%3A25%3B0.0%3B0.00%3B0%3B
2020-11-02 22:29:02.905 Status: dzVents: Info: KacoInverter: ------ Finished Script #1
The only idea I had was to change \n in this script to \r as You suggested before but it didnt change a lot.

Log below:

Code: Select all

2020-11-02 22:38:22.354 Status: EventSystem: reset all events...
2020-11-02 22:38:22.355 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/Script #1.lua
2020-11-02 22:38:24.210 Status: Incoming connection from: 192.168.1.27
2020-11-02 22:39:00.538 Status: dzVents: Info: KacoInverter: ------ Start internal script: Script #1:, trigger: "every minute"
2020-11-02 22:39:00.540 Status: dzVents: Info: KacoInverter: ------ Finished Script #1
2020-11-02 22:39:00.541 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-11-02 22:39:03.423 Status: dzVents: Info: Handling httpResponse-events for: "KacoInverter"
2020-11-02 22:39:03.423 Status: dzVents: Info: KacoInverter: ------ Start internal script: Script #1: HTTPResponse: "KacoInverter"
2020-11-02 22:39:03.447 Status: dzVents: !Info: KacoInverter: Typ+falownika%3BNumer+seryjny%3BAdres+RS485%3BAdres+IP%3BZysk%5BkWh%5D%0Dblueplanet+5.0+TL3%3B5.0TL01716052%3B1%3B192.168.1.12%3B3.08%0DGodzina%3BUdc1%5BV%5D%3BIdc1%5BA%5D%3BPdc1%5BW%5D%3BUdc2%5BV%5D%3BIdc2%5BA%5D%3BPdc2%5BW%5D%3BUac1%5BV%5D%3BIac1%5BA%5D%3BUac2%5BV%5D%3BIac2%5BA%5D%3BUac3%5BV%5D%3BIac3%5BA%5D%3BPdc%5BW%5D%3BPac%5BW%5D%3BTsys%5B%B0C%5D%0D06%3A24%3A48%3B0.0%3B0.00%3B0%3B0.0%3B0.00%3B0%3B0.0%3B0.00%3B0.0%3B0.00%3B0.0%3B0.00%3B0%3B0%3B0.0%0D06%3A25%3A08%3B10.9%3B0.02%3B0%3B82.3%3B0.01%3B1%3B147.4%3B0.00%3B146.4%3B0.00%3B148.9%3B0.00%3B1%3B0%3B12.8%0D06%3A25%3A25%3B0.0%3B0.00%3B0%3B
2020-11-02 22:39:03.448 Status: dzVents: Info: KacoInverter: ------ Finished Script #1
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by waaren »

plantex wrote: Monday 02 November 2020 22:42 The only idea I had was to change \n in this script to \r as You suggested before but it didnt change a lot.
:oops: Left some debug stuff in

I now removed

Code: Select all

            do
                dz.log(dz.utils.urlEncode( (item.data:sub(1,400) )  ) , dz.LOG_FORCE)
                return
            end
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Rafalsz
Posts: 1
Joined: Friday 31 May 2024 9:16
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Kaco Inverter - transfer from CSV to Domoticz

Post by Rafalsz »

Hello,
I would like to refresh the topic.
Since few months in domoticz profit is showed as sum of produced power but as negative value (every day at midnight 00:00). In the past was correct. What was change?

BR
Rafal
Attachments
profit2.JPG
profit2.JPG (43.39 KiB) Viewed 815 times
Profit.JPG
Profit.JPG (32.45 KiB) Viewed 815 times
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest