Nya mjukvaran 4.x ger en snygg överblick på hur mycket el man förbrukar under en viss period.  Med en virtuell enhet så kan man även se denna information i Fibaro’s app för mobiltelefoner/paddor på ett enkelt sätt.

PowerConsumption_VD

 

Lua koden för detta ser du nedan

--- USER SETTINGS ---
-- Device you want to get energy values from
local deviceID = "260"
---------------------

--- DO NOT CHANGE BELOW HERE ---
thisId = fibaro:getSelfId(); 

HC2 = Net.FHttp("127.0.0.1")
response, status, errorCode = HC2:GET("/api/panels/energy?type=devices&id="..deviceID)

jsonTMP = string.sub(response, 2, -2) -- Need to remove first and last brackets
jsonNEW = json.decode(jsonTMP)

hourH = (jsonNEW.powerH)
dayD = (jsonNEW.powerD)
weekW = (jsonNEW.powerW)
monthM = (jsonNEW.powerM)
monthC = (jsonNEW.costM)

time = os.date("%H:%M:%S");

fibaro:call(thisId, "setProperty", "ui.LabelNow.value", hourH.." Watt");
fibaro:call(thisId, "setProperty", "ui.LabelHour.value",dayD.." kWh");
fibaro:call(thisId, "setProperty", "ui.LabelWeek.value", weekW.." kWh");
fibaro:call(thisId, "setProperty", "ui.LabelMonth.value", monthM.." kWh");
fibaro:call(thisId, "setProperty", "ui.lblCost.value", monthC.." SEK");
fibaro:call(thisId, "setProperty", "ui.LabelWhen.value", time);