Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


Question

Posted

po dodaniu falownika solaredge mogę czytać aktualna moc ale nie jest to pokazywane w panelu energii 

w zakładce zaawansowane urządzenia są liczniki, ale cały czas jest na nich zero więc pewnie to jest powodem iż urządzenie nie jest doliczane na panelu energii.

 

może ktoś wie jak dostać się do zmiennych odpowiedzialnych za te liczniki?

 

kod pobrany z fibaro z  drobna modyfikacja aby pokazywał aktualna moc na ikonie urządzenia

 

---------------------------------------------------------------------------------------------------

function QuickApp:loop(text)
    local address = "https://monitoringapi.solaredge.com/site/"..self:getVariable("site_id").."/overview.json?api_key="..self:getVariable("api_key")
    self:debug(address)
    self.http:request(address, {
        options={
            headers = {  
                Accept = "application/json"
            },
            method = 'GET'
        },
        success = function(response)
            self:debug("response status:", response.status) 
            self:debug("headers:", response.headers["Content-Type"]) 

            local sedata = json.decode(response.data)
            local actpower = sedata.overview.currentPower.power
            actpower = actpower/1000
            actpower = string.format("%.2f", actpower)
            local todayenergy = sedata.overview.lastDayData.energy
            todayenergy = todayenergy/1000
            todayenergy = string.format("%.2f", todayenergy)
            local thismonthenergy = sedata.overview.lastMonthData.energy
            thismonthenergy = thismonthenergy/1000
            thismonthenergy = string.format("%.2f", thismonthenergy)
            local thisyearenergy = sedata.overview.lastYearData.energy
            thisyearenergy = thisyearenergy/1000
            thisyearenergy = string.format("%.2f", thisyearenergy)
            local allenergy = sedata.overview.lifeTimeData.energy
            allenergy = allenergy/1000
            self:updateProperty("value", allenergy) 
            allenergy = string.format("%.2f", allenergy)

            local seAPower = "Current Power: " ..actpower.." kW"
            self:debug(seAPower)
            self:updateView("seAP", "text", seAPower)

            local seToday = "Today Data: " ..todayenergy.." kWh"
            self:debug(seToday)
            self:updateView("seTD", "text", seToday)

            local seMonth = "This Month Data: " ..thismonthenergy.." kWh"
            self:debug(seMonth)
            self:updateView("seMD", "text", seMonth)

            local seYear = "This Year Data: " ..thisyearenergy.." kWh"
            self:debug(seYear)
            self:updateView("seYD", "text", seYear)

            local seLife = "Lifetime Data: " ..allenergy.." kWh"
            self:debug(seLife)
            self:updateView("seLD", "text", seLife)
            print("----------------------------------------")
        end,

        error = function(error)
            self:debug('error: ' .. json.encode(error))
        end
    }) 
    
fibaro.setTimeout(600000, function() 
        self:loop(text)
    end)
 

end

function QuickApp:onInit()
    self:debug("onInit")
    self.http = net.HTTPClient({timeout=10000})
    self:loop("hello from loop")
end

 

Please login or register to see this attachment.

1 answer to this question

Recommended Posts

  • 0
Posted (edited)

możesz też użyć mojego QuickApp 

 

plug and play 

 

Please login or register to see this attachment.


 

Please login or register to see this image.

/monthly_2021_08/98A575E5-9F5A-479E-A6A0-A78ABBE6679C.jpeg.09adebbc769d1ea7db8f30750d38d18c.jpeg" />

 

8840EDB9-DF6B-4F8D-AB3A-57F4ACA362F5.jpeg.ba07f08d69a068b93c33ac6b542fdfc3.jpeg
 

 

 

Edited by SmartHomeEddy

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...