Python Plugin: GoodWe solar inverter via SEMS API

Python and python framework

Moderator: leecollings

User avatar
waltervl
Posts: 7012
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

RE: Python Plugin: GoodWe solar inverter via SEMS API

Post by waltervl »

Jeweettoch13 wrote: Tuesday 30 December 2025 10:36 Hello fellow members.

For some reason i got some errors today when requesting the data from the Goodwe SEMS plugin. Do you guys know what this means?
Update the plugin, see also https://github.com/JanJaapKo/domoticz-G ... /issues/30
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Jeweettoch13
Posts: 38
Joined: Saturday 23 July 2022 16:42
Target OS: NAS (Synology & others)
Domoticz version: 2026.2
Location: Netherlands
Contact:

Re: RE: Python Plugin: GoodWe solar inverter via SEMS API

Post by Jeweettoch13 »

waltervl wrote: Tuesday 30 December 2025 10:56
Jeweettoch13 wrote: Tuesday 30 December 2025 10:36 Hello fellow members.

For some reason i got some errors today when requesting the data from the Goodwe SEMS plugin. Do you guys know what this means?
Update the plugin, see also https://github.com/JanJaapKo/domoticz-G ... /issues/30
Replaced the file in Domoticz plugins, but no luck:

2025-12-30 11:03:41.058 Error: (FindModule) Domoticz and DomoticzEx modules both found in interpreter, use one or the other.
2025-12-30 11:03:41.058 Error: Goodwe SEMS: Call to function 'onHeartbeat' failed, exception details:
2025-12-30 11:03:41.059 Error: Goodwe SEMS: Traceback (most recent call last):
2025-12-30 11:03:41.059 Error: Goodwe SEMS: File "/opt/domoticz/userdata/plugins/domoticz-GoodWeSEMS/plugin.py", line 459, in onHeartbeat
2025-12-30 11:03:41.059 Error: Goodwe SEMS: _plugin.onHeartbeat()
2025-12-30 11:03:41.059 Error: Goodwe SEMS: File "/opt/domoticz/userdata/plugins/domoticz-GoodWeSEMS/plugin.py", line 370, in onHeartbeat
2025-12-30 11:03:41.059 Error: Goodwe SEMS: elif len(Parameters["Mode1"]) == 0:
2025-12-30 11:03:41.059 Error: Goodwe SEMS: ^^^^^^^^^^
2025-12-30 11:03:41.059 Error: Goodwe SEMS: NameError: name 'Parameters' is not defined
User avatar
waltervl
Posts: 7012
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by waltervl »

Did you restart Domoticz?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Jeweettoch13
Posts: 38
Joined: Saturday 23 July 2022 16:42
Target OS: NAS (Synology & others)
Domoticz version: 2026.2
Location: Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Jeweettoch13 »

waltervl wrote: Tuesday 30 December 2025 11:11 Did you restart Domoticz?
Yes i did. Only copy paste the file. Don't know if that's sufficient.
User avatar
waltervl
Posts: 7012
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by waltervl »

What file? The plugin.py or the Goodwe.py or both?
In your case it looks like Domoticz is confused now about the plugin.py.
You are running Domoticz in Docker it looks like so not sure how to restart properly.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Jeweettoch13
Posts: 38
Joined: Saturday 23 July 2022 16:42
Target OS: NAS (Synology & others)
Domoticz version: 2026.2
Location: Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Jeweettoch13 »

waltervl wrote: Tuesday 30 December 2025 11:23 What file? The plugin.py or the Goodwe.py or both?
In your case it looks like Domoticz is confused now about the plugin.py.
You are running Domoticz in Docker it looks like so not sure how to restart properly.
I copied the one provided by jeannot171 (GoodWe.py)

also copied just the plugin file,It's working :).

I see on a sidenote that new sensors have been made, but need the old log on the new sensors. Is this achieved by restoring the backup data?
User avatar
waltervl
Posts: 7012
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2026.3
Location: NL
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by waltervl »

Jeweettoch13 wrote: Tuesday 30 December 2025 11:26
waltervl wrote: Tuesday 30 December 2025 11:23 What file? The plugin.py or the Goodwe.py or both?
In your case it looks like Domoticz is confused now about the plugin.py.
You are running Domoticz in Docker it looks like so not sure how to restart properly.
I copied the one provided by jeannot171 (GoodWe.py)

also copied just the plugin file,It's working :).

I see on a sidenote that new sensors have been made, but need the old log on the new sensors. Is this achieved by restoring the backup data?
You could use the device replace function to move the history in the new device: https://wiki.domoticz.com/Managing_Devi ... ace_device
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Jeweettoch13
Posts: 38
Joined: Saturday 23 July 2022 16:42
Target OS: NAS (Synology & others)
Domoticz version: 2026.2
Location: Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Jeweettoch13 »

waltervl wrote: Tuesday 30 December 2025 11:52
Jeweettoch13 wrote: Tuesday 30 December 2025 11:26
waltervl wrote: Tuesday 30 December 2025 11:23 What file? The plugin.py or the Goodwe.py or both?
In your case it looks like Domoticz is confused now about the plugin.py.
You are running Domoticz in Docker it looks like so not sure how to restart properly.
I copied the one provided by jeannot171 (GoodWe.py)

also copied just the plugin file,It's working :).

I see on a sidenote that new sensors have been made, but need the old log on the new sensors. Is this achieved by restoring the backup data?
You could use the device replace function to move the history in the new device: https://wiki.domoticz.com/Managing_Devi ... ace_device
That should work indeed, if not turning the complete system haywire:

2025-12-30 12:03:17.255 Error: Goodwe SEMS: ~~~~~~~~~~~~~~~~~~~~~^^^^^^
2025-12-30 12:03:17.255 Error: Goodwe SEMS: KeyError: 2
2025-12-30 12:03:27.742 Error: Goodwe SEMS: (Goodwe SEMS) Unit creation failed, Hardware/DeviceID/Unit combination (5/56000DTS205W0092/2) already exists in Domoticz.
2025-12-30 12:03:27.743 Error: Goodwe SEMS: (Goodwe SEMS) Unit creation failed, Hardware/DeviceID/Unit combination (5/56000DTS205W0092/4) already exists in Domoticz.
2025-12-30 12:03:27.743 Error: Goodwe SEMS: (Goodwe SEMS) Unit creation failed, Hardware/DeviceID/Unit combination (5/56000DTS205W0092/5) already exists in Domoticz.
2025-12-30 12:03:27.743 Error: Goodwe SEMS: (Goodwe SEMS) Unit creation failed, Hardware/DeviceID/Unit combination (5/56000DTS205W0092/6) already exists in Domoticz.
2025-12-30 12:03:27.743 Error: Goodwe SEMS: (Goodwe SEMS) Unit creation failed, Hardware/DeviceID/Unit combination (5/56000DTS205W0092/14) already exists in Domoticz.
2025-12-30 12:03:27.743 Error: Goodwe SEMS: (Goodwe SEMS) Unit creation failed, Hardware/DeviceID/Unit combination (5/56000DTS205W0092/7) already exists in Domoticz.
2025-12-30 12:03:27.743 Error: Goodwe SEMS: (Goodwe SEMS) Unit creation failed, Hardware/DeviceID/Unit combination (5/56000DTS205W0092/8) already exists in Domoticz.
2025-12-30 12:03:27.743 Error: Goodwe SEMS: (Goodwe SEMS) Unit creation failed, Hardware/DeviceID/Unit combination (5/56000DTS205W0092/15) already exists in Domoticz.
2025-12-30 12:03:27.747 Error: Goodwe SEMS: Call to function 'onHeartbeat' failed, exception details:
2025-12-30 12:03:27.749 Error: Goodwe SEMS: Traceback (most recent call last):
2025-12-30 12:03:27.749 Error: Goodwe SEMS: File "/opt/domoticz/userdata/plugins/domoticz-GoodWeSEMS/plugin.py", line 519, in onHeartbeat
2025-12-30 12:03:27.749 Error: Goodwe SEMS: _plugin.onHeartbeat()
2025-12-30 12:03:27.749 Error: Goodwe SEMS: File "/opt/domoticz/userdata/plugins/domoticz-GoodWeSEMS/plugin.py", line 413, in onHeartbeat
2025-12-30 12:03:27.749 Error: Goodwe SEMS: self.startDeviceUpdateV2()
2025-12-30 12:03:27.754 Error: Goodwe SEMS: File "/opt/domoticz/userdata/plugins/domoticz-GoodWeSEMS/plugin.py", line 175, in startDeviceUpdateV2
2025-12-30 12:03:27.754 Error: Goodwe SEMS: self.updateDevices(DeviceData)
2025-12-30 12:03:27.755 Error: Goodwe SEMS: File "/opt/domoticz/userdata/plugins/domoticz-GoodWeSEMS/plugin.py", line 199, in updateDevices
2025-12-30 12:03:27.755 Error: Goodwe SEMS: UpdateDevice(inverter["sn"], theInverter.outputCurrentUnit, 0, str(inverter["output_current"]), AlwaysUpdate=True)
2025-12-30 12:03:27.755 Error: Goodwe SEMS: File "/opt/domoticz/userdata/plugins/domoticz-GoodWeSEMS/plugin.py", line 559, in UpdateDevice
2025-12-30 12:03:27.755 Error: Goodwe SEMS: logging.debug("Updating device '"+Devices[Device].Units[Unit].Name+ "' with current sValue '"+Devices[Device].Units[Unit].sValue+"' to '" +sValue+"'")

Luckily a backed up the database so can convert back easily.

Edit* Got it working. I restart the container per edit, and that works. Tnx for the help :)
Jeweettoch13
Posts: 38
Joined: Saturday 23 July 2022 16:42
Target OS: NAS (Synology & others)
Domoticz version: 2026.2
Location: Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Jeweettoch13 »

Hello all,

i got a error on the Sems plugin again (maybe because they went to Sems+ a short while ago)

Began around 4:20AM this morning.


Image

From the Sems+ portal the data is visible.
I'm on v5.0 plugin
Attachments
Error.jpg
Error.jpg (241.91 KiB) Viewed 593 times
JanJaap
Posts: 244
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by JanJaap »

Hi,

I'm aware of the issue, it has something to do with the authentication on the Goodwe server. Looking for a solution....

See Github - issue 36
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
RNEE
Posts: 77
Joined: Sunday 05 August 2018 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1
Location: NL/Eindhoven area
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by RNEE »

Same problem here, but I can't fix it.

This is a known issue, and this post might help us out: https://www.zonstraal.be/forum/viewtopic.php?p=352091

The GoodWe API documentation is available here: https://openapi.goodwe.com/#api/doc-10a71afe72c271

Do I understand correctly that a fixed authentication token must now be included?
Domoticz (since 2016) on Docker on Raspberry PI 5 with 500 Gb NVMe|Milight|KaKu + RFXCOM|Goodwe|Smartstuff P1 meter|Buienradar|Afval kalender|Tuya-wifi|Zigbee + deCONZ Conbee II|Marstek Homebattery 5,12Kwh via Modbus on Pusr-dr134|MQTTMapper|Quatt v2|
Jeweettoch13
Posts: 38
Joined: Saturday 23 July 2022 16:42
Target OS: NAS (Synology & others)
Domoticz version: 2026.2
Location: Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Jeweettoch13 »

RNEE wrote: Thursday 24 September 2026 9:44 Same problem here, but I can't fix it.

This is a known issue, and this post might help us out: https://www.zonstraal.be/forum/viewtopic.php?p=352091

The GoodWe API documentation is available here: https://openapi.goodwe.com/#api/doc-10a71afe72c271

Do I understand correctly that a fixed authentication token must now be included?
Seems that the Anton version is working, but where to put the code?
RNEE
Posts: 77
Joined: Sunday 05 August 2018 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1
Location: NL/Eindhoven area
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by RNEE »

I (and Ai) have now a dzVents script what the total load in a parameter with idx 2954.

Connection and data retrieval works now !

But I have to work more things out.

Code: Select all

return {
    on = {
        timer = {
            'every 1 minutes' -- Haalt elke 1 minuten data op
        }
    },
    logging = {
        level = domoticz.LOG_INFO,
        marker = 'SEMS_PLUS'
    },
    execute = function(domoticz, item)
        
        -- ==========================================
        -- CONFIGURATIE (PAS DIT AAN JOUW GEGEVENS AN)
        -- ==========================================
        local semsUser     = 'user@sems'
        local semsPassword = 'password_of_user'
        local domoticzIdx  = 2954 -- Het Idx nummer van het virtuele apparaat
        local inverterNo   = 0  -- 0 = eerste omvormer, 1 = tweede, etc.
        -- ==========================================
        -- De correcte Europese Gateway endpoints voor SEMS+
        local baseUrl  = 'https://eu-gateway.semsportal.com'
        local loginUrl = baseUrl .. '/web/sems/sems-user/api/v1/auth/cross-login'
        local dataUrl  = baseUrl .. '/web/sems/sems-plant/api/web/device/centralized/page'

        domoticz.log('Starten met ophalen van de gegevens via SEMS+...', domoticz.LOG_INFO)

        -- 1. Wachtwoord versleutelen (MD5 -> Base64) via de Linux terminal
        local cmdEncrypt = 'echo -n "' .. semsPassword .. '" | md5sum | cut -d" " -f1 | tr -d "\\n" | base64 | tr -d "\\n"'
        local handleEnc = io.popen(cmdEncrypt)
        local encryptedPassword = handleEnc:read("*a"):gsub("%s+", "")
        handleEnc:close()

        -- 2. Inloggen en Token ophalen
        local loginPayload = domoticz.utils.toJSON({
            account = semsUser,
            pwd = encryptedPassword,
            isChinese = false,
            agreement = 1,
            isLocal = true
        })

        -- Schone curl-aanroep voor inloggen
        local cmdLogin = 'curl --silent --insecure --location --request POST "' .. loginUrl .. '" ' ..
                         '--header "Content-Type: application/json" ' ..
                         '--header "Accept: application/json, */*" ' ..
                         '--header "token: {\\"uid\\":\\"\\",\\"timestamp\\":0,\\"token\\":\\"\\",\\"client\\":\\"semsPlusWeb\\",\\"version\\":\\"\\",\\"language\\":\\"en\\"}" ' ..
                         '--data \'' .. loginPayload .. '\''
                         
        local handleLogin = io.popen(cmdLogin)
        local loginResult = handleLogin:read("*a")
        handleLogin:close()

        -- Controleer of er een netwerkrespons is
        if (not loginResult or loginResult == "") then
            domoticz.log('Geen netwerkrespons ontvangen van de inlogserver.', domoticz.LOG_ERROR)
            return
        end

        local loginJson = domoticz.utils.fromJSON(loginResult)

        -- Controleer of de login succesvol is verwerkt (Code 00000)
        if (loginJson and loginJson.code == '00000' and loginJson.data) then
            domoticz.log('Login op de EU Gateway succesvol! Token gegenereerd.', domoticz.LOG_INFO)
            
            local d = loginJson.data
            local tokenHeader = domoticz.utils.toJSON({
                uid = d.uid,
                timestamp = d.timestamp,
                token = d.token,
                client = "semsPlusWeb",
                version = d.version or "",
                language = d.language or "en",
                region = d.region or ""
            })

            -- 3. Data opvragen met het verkregen token uit Stap 2
            local dataPayload = '{"deviceTypeList":["INVERTER"],"current":1,"size":10}'
            
            local cmdData = 'curl --silent --insecure --location --request POST "' .. dataUrl .. '" ' ..
                            '--header "Content-Type: application/json" ' ..
                            '--header "Accept: application/json, */*" ' ..
                            '--header "token: ' .. tokenHeader:gsub('"', '\\"') .. '" ' ..
                            '--data \'' .. dataPayload .. '\''

            local handleData = io.popen(cmdData)
            local dataResult = handleData:read("*a")
            handleData:close()

            local dataJson = domoticz.utils.fromJSON(dataResult)

            -- 4. Gegevens valideren en wegschrijven naar de Domoticz sensor
            if (dataJson and dataJson.code == '00000' and dataJson.data and dataJson.data.dataList) then
                local dataList = dataJson.data.dataList
                
                -- Correcte navigatie door de SEMS+ array: dataList[1] -> children[1]
                if (dataList[1] and dataList[1].children and dataList[1].children[1]) then
                    local dev = dataList[1].children[1]
                    
                    local pAc       = tonumber(dev.pAc) or 0         -- Actueel vermogen (kW)
                    local proToday  = tonumber(dev.proToday) or 0    -- Dagopbrengst (kWh)
                    
                    -- Omrekenen naar Watts en Watt-uren voor Domoticz
                    local wattActueel = math.floor(pAc * 1000)
                    local whTotaal    = math.floor(proToday * 1000)
                    
                    domoticz.log('SEMS+ Data succesvol verwerkt -> Actueel: ' .. wattActueel .. ' W | Vandaag: ' .. proToday .. ' kWh', domoticz.LOG_INFO)
                    
                    -- Update de virtuele sensor (Formaat: ActueelVermogen;TotaalWh)
                    domoticz.devices(domoticzIdx).updateElectricity(wattActueel, whTotaal)
                else
                    domoticz.log('Geen actieve installatie of omvormer gevonden in dataList structure.', domoticz.LOG_ERROR)
                end
            else
                domoticz.log('Fout bij het ophalen van de installatiedata. Response: ' .. tostring(dataResult), domoticz.LOG_ERROR)
            end
        else
            domoticz.log('Inloggen op SEMS+ geweigerd. Response van server: ' .. tostring(loginResult), domoticz.LOG_ERROR)
        end
    end
}
Domoticz (since 2016) on Docker on Raspberry PI 5 with 500 Gb NVMe|Milight|KaKu + RFXCOM|Goodwe|Smartstuff P1 meter|Buienradar|Afval kalender|Tuya-wifi|Zigbee + deCONZ Conbee II|Marstek Homebattery 5,12Kwh via Modbus on Pusr-dr134|MQTTMapper|Quatt v2|
Jeweettoch13
Posts: 38
Joined: Saturday 23 July 2022 16:42
Target OS: NAS (Synology & others)
Domoticz version: 2026.2
Location: Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Jeweettoch13 »

RNEE wrote: Thursday 24 September 2026 17:51 I (and Ai) have now a dzVents script what the total load in a parameter with idx 2954.

Connection and data retrieval works now !

But I have to work more things out.

Code: Select all

return {
    on = {
        timer = {
            'every 1 minutes' -- Haalt elke 1 minuten data op
        }
    },
    logging = {
        level = domoticz.LOG_INFO,
        marker = 'SEMS_PLUS'
    },
    execute = function(domoticz, item)
        
        -- ==========================================
        -- CONFIGURATIE (PAS DIT AAN JOUW GEGEVENS AN)
        -- ==========================================
        local semsUser     = 'user@sems'
        local semsPassword = 'password_of_user'
        local domoticzIdx  = 2954 -- Het Idx nummer van het virtuele apparaat
        local inverterNo   = 0  -- 0 = eerste omvormer, 1 = tweede, etc.
        -- ==========================================
        -- De correcte Europese Gateway endpoints voor SEMS+
        local baseUrl  = 'https://eu-gateway.semsportal.com'
        local loginUrl = baseUrl .. '/web/sems/sems-user/api/v1/auth/cross-login'
        local dataUrl  = baseUrl .. '/web/sems/sems-plant/api/web/device/centralized/page'

        domoticz.log('Starten met ophalen van de gegevens via SEMS+...', domoticz.LOG_INFO)

        -- 1. Wachtwoord versleutelen (MD5 -> Base64) via de Linux terminal
        local cmdEncrypt = 'echo -n "' .. semsPassword .. '" | md5sum | cut -d" " -f1 | tr -d "\\n" | base64 | tr -d "\\n"'
        local handleEnc = io.popen(cmdEncrypt)
        local encryptedPassword = handleEnc:read("*a"):gsub("%s+", "")
        handleEnc:close()

        -- 2. Inloggen en Token ophalen
        local loginPayload = domoticz.utils.toJSON({
            account = semsUser,
            pwd = encryptedPassword,
            isChinese = false,
            agreement = 1,
            isLocal = true
        })

        -- Schone curl-aanroep voor inloggen
        local cmdLogin = 'curl --silent --insecure --location --request POST "' .. loginUrl .. '" ' ..
                         '--header "Content-Type: application/json" ' ..
                         '--header "Accept: application/json, */*" ' ..
                         '--header "token: {\\"uid\\":\\"\\",\\"timestamp\\":0,\\"token\\":\\"\\",\\"client\\":\\"semsPlusWeb\\",\\"version\\":\\"\\",\\"language\\":\\"en\\"}" ' ..
                         '--data \'' .. loginPayload .. '\''
                         
        local handleLogin = io.popen(cmdLogin)
        local loginResult = handleLogin:read("*a")
        handleLogin:close()

        -- Controleer of er een netwerkrespons is
        if (not loginResult or loginResult == "") then
            domoticz.log('Geen netwerkrespons ontvangen van de inlogserver.', domoticz.LOG_ERROR)
            return
        end

        local loginJson = domoticz.utils.fromJSON(loginResult)

        -- Controleer of de login succesvol is verwerkt (Code 00000)
        if (loginJson and loginJson.code == '00000' and loginJson.data) then
            domoticz.log('Login op de EU Gateway succesvol! Token gegenereerd.', domoticz.LOG_INFO)
            
            local d = loginJson.data
            local tokenHeader = domoticz.utils.toJSON({
                uid = d.uid,
                timestamp = d.timestamp,
                token = d.token,
                client = "semsPlusWeb",
                version = d.version or "",
                language = d.language or "en",
                region = d.region or ""
            })

            -- 3. Data opvragen met het verkregen token uit Stap 2
            local dataPayload = '{"deviceTypeList":["INVERTER"],"current":1,"size":10}'
            
            local cmdData = 'curl --silent --insecure --location --request POST "' .. dataUrl .. '" ' ..
                            '--header "Content-Type: application/json" ' ..
                            '--header "Accept: application/json, */*" ' ..
                            '--header "token: ' .. tokenHeader:gsub('"', '\\"') .. '" ' ..
                            '--data \'' .. dataPayload .. '\''

            local handleData = io.popen(cmdData)
            local dataResult = handleData:read("*a")
            handleData:close()

            local dataJson = domoticz.utils.fromJSON(dataResult)

            -- 4. Gegevens valideren en wegschrijven naar de Domoticz sensor
            if (dataJson and dataJson.code == '00000' and dataJson.data and dataJson.data.dataList) then
                local dataList = dataJson.data.dataList
                
                -- Correcte navigatie door de SEMS+ array: dataList[1] -> children[1]
                if (dataList[1] and dataList[1].children and dataList[1].children[1]) then
                    local dev = dataList[1].children[1]
                    
                    local pAc       = tonumber(dev.pAc) or 0         -- Actueel vermogen (kW)
                    local proToday  = tonumber(dev.proToday) or 0    -- Dagopbrengst (kWh)
                    
                    -- Omrekenen naar Watts en Watt-uren voor Domoticz
                    local wattActueel = math.floor(pAc * 1000)
                    local whTotaal    = math.floor(proToday * 1000)
                    
                    domoticz.log('SEMS+ Data succesvol verwerkt -> Actueel: ' .. wattActueel .. ' W | Vandaag: ' .. proToday .. ' kWh', domoticz.LOG_INFO)
                    
                    -- Update de virtuele sensor (Formaat: ActueelVermogen;TotaalWh)
                    domoticz.devices(domoticzIdx).updateElectricity(wattActueel, whTotaal)
                else
                    domoticz.log('Geen actieve installatie of omvormer gevonden in dataList structure.', domoticz.LOG_ERROR)
                end
            else
                domoticz.log('Fout bij het ophalen van de installatiedata. Response: ' .. tostring(dataResult), domoticz.LOG_ERROR)
            end
        else
            domoticz.log('Inloggen op SEMS+ geweigerd. Response van server: ' .. tostring(loginResult), domoticz.LOG_ERROR)
        end
    end
}
Is this piece of code anywhere to put in a current .py file?
RNEE
Posts: 77
Joined: Sunday 05 August 2018 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1
Location: NL/Eindhoven area
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by RNEE »

It is a standalone dzVents script. It is put in Events. It is not a python .py program.

Now this works maybe JanJaap can use the info from the script to change it to the plugin.
Domoticz (since 2016) on Docker on Raspberry PI 5 with 500 Gb NVMe|Milight|KaKu + RFXCOM|Goodwe|Smartstuff P1 meter|Buienradar|Afval kalender|Tuya-wifi|Zigbee + deCONZ Conbee II|Marstek Homebattery 5,12Kwh via Modbus on Pusr-dr134|MQTTMapper|Quatt v2|
JanJaap
Posts: 244
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by JanJaap »

I just pushed an update. But if I read the other blogs correctly, there is no data when the inverters are not active. And it is now 23:30.... I'll check tomorrow morning but likely only have time to fix tomorrow evening. Feel free to pull latest version of plugin and test
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
RNEE
Posts: 77
Joined: Sunday 05 August 2018 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1
Location: NL/Eindhoven area
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by RNEE »

JanJaap wrote: Thursday 24 September 2026 23:31 I just pushed an update. But if I read the other blogs correctly, there is no data when the inverters are not active. And it is now 23:30.... I'll check tomorrow morning but likely only have time to fix tomorrow evening. Feel free to pull latest version of plugin and test
Thank you for your work!

I will test it tomorrow.
Domoticz (since 2016) on Docker on Raspberry PI 5 with 500 Gb NVMe|Milight|KaKu + RFXCOM|Goodwe|Smartstuff P1 meter|Buienradar|Afval kalender|Tuya-wifi|Zigbee + deCONZ Conbee II|Marstek Homebattery 5,12Kwh via Modbus on Pusr-dr134|MQTTMapper|Quatt v2|
Jeweettoch13
Posts: 38
Joined: Saturday 23 July 2022 16:42
Target OS: NAS (Synology & others)
Domoticz version: 2026.2
Location: Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by Jeweettoch13 »

JanJaap wrote: Thursday 24 September 2026 23:31 I just pushed an update. But if I read the other blogs correctly, there is no data when the inverters are not active. And it is now 23:30.... I'll check tomorrow morning but likely only have time to fix tomorrow evening. Feel free to pull latest version of plugin and test
Much appreciated!

The inverter is in waiting mode but not present in Domoticz at the moment
Error.jpg
Error.jpg (19.62 KiB) Viewed 385 times
JanJaap
Posts: 244
Joined: Thursday 12 October 2017 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: Dev
Location: the Netherlands
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by JanJaap »

Same here, so I guess I need to give Copilot some more instructions.....

At least the amount of error loglines has been reduced :ugeek:
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
RNEE
Posts: 77
Joined: Sunday 05 August 2018 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version: 2026.1
Location: NL/Eindhoven area
Contact:

Re: Python Plugin: GoodWe solar inverter via SEMS API

Post by RNEE »

Update indeed not working. :x

I used Google AI to make the dzVents script but i had many repeating faults / corrections to make in the process and more detailed instructions to give before it worked.

I think my dzVents script can be used to instruct Copilot ?

I know the dzVents script is not ready for production but it is a start.
Domoticz (since 2016) on Docker on Raspberry PI 5 with 500 Gb NVMe|Milight|KaKu + RFXCOM|Goodwe|Smartstuff P1 meter|Buienradar|Afval kalender|Tuya-wifi|Zigbee + deCONZ Conbee II|Marstek Homebattery 5,12Kwh via Modbus on Pusr-dr134|MQTTMapper|Quatt v2|
Post Reply