Solivia Gateway to get inverter counters

In this subforum you can show projects you have made, or you are busy with. Please create your own topic.

Moderator: leecollings

Post Reply
bjornp
Posts: 6
Joined: Saturday 29 June 2019 12:28
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Solivia Gateway to get inverter counters

Post by bjornp »

If someone else want to read the Solivia Gateway counters of inverters you can use this.
Edit: do not use os.exit() :? .. It kills Domoticz. Use return instead. Changed code below.

Code: Select all

-- Get Solivia inverter counters
-- Change weburl and inverter device name

return {
    on      =   {   timer   = { "every 5 minutes"}},   
   
    execute = function(dz)            
        local inverter = dz.devices("Solivia invertername")
        weburl='http://<IP_ADRES_OF_GATEWAY>/ID_<ID_OF_INVERTER>'

        local f = assert(io.popen("curl -s " .. weburl, 'r'))
        local s = assert(f:read('*a'))
        f:close()
        
        -- Exit script if inverter is offline or unavailable
        if s:match('Operation failed') then return end

        power=s:match('Actual Power.-<td width="190">(.-)</td>') -- in W
        energy=s:match('Total Energy.-<td width="190">(.-)</td>') -- in kWh
        
        -- Exit script if inverter returns no data available value
        if power == "no data available" or energy == "no data available" then return end
        
        -- print("Power= " .. power .. " W | Energy = " .. energy .. " kWh")
        -- Solivia returns Total energy in kWh but Domoticz expects energy in Wh so multiply by 1000
        inverter.updateElectricity(power,energy*1000)
    end
}
Last edited by bjornp on Saturday 29 June 2019 23:36, edited 1 time in total.
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Solivia Gateway to get inverter counters

Post by sincze »

Tnx for sharing!
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests