Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub4Eddy authored Apr 22, 2023
1 parent 07cf639 commit 0edc477
Show file tree
Hide file tree
Showing 5 changed files with 691 additions and 0 deletions.
1 change: 1 addition & 0 deletions Toon_Energy-20.fqa

Large diffs are not rendered by default.

127 changes: 127 additions & 0 deletions Toon_Energy-childs-20.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
-- Toon Energy Childs

class 'consumption'(QuickAppChild)
function consumption:__init(dev)
QuickAppChild.__init(self,dev)
end
function consumption:updateValue(data)
self:updateProperty("value", tonumber(data.Consumption))
self:updateProperty("power", tonumber(data.Consumption))
self:updateProperty("unit", "Watt")
self:updateProperty("log", "Total: "..string.format("%.0f",data.Consumption_Total) .." kWh")
end


class 'production'(QuickAppChild)
function production:__init(dev)
QuickAppChild.__init(self,dev)
if fibaro.getValue(self.id, "rateType") ~= "production" then
self:updateProperty("rateType", "production")
self:warning("Changed rateType interface of Production High child device (" ..self.id ..") to production")
end
end
function production:updateValue(data)
self:updateProperty("value", tonumber(data.Production))
self:updateProperty("power", tonumber(data.Production))
self:updateProperty("unit", "Watt")
self:updateProperty("log", "Total: "..string.format("%.0f",data.Production_Total) .." kWh")
end


class 'consumption_high'(QuickAppChild)
function consumption_high:__init(dev)
QuickAppChild.__init(self,dev)
if fibaro.getValue(self.id, "rateType") ~= "consumption" then
self:updateProperty("rateType", "consumption")
self:warning("Changed rateType interface of Consumption High child device (" ..self.id ..") to consumption")
end
end
function consumption_high:updateValue(data)
self:updateProperty("value", tonumber(data.Consumption_Total_H))
self:updateProperty("unit", "kWh")
self:updateProperty("log", " ")
end


class 'consumption_low'(QuickAppChild)
function consumption_low:__init(dev)
QuickAppChild.__init(self,dev)
if fibaro.getValue(self.id, "rateType") ~= "consumption" then
self:updateProperty("rateType", "consumption")
self:warning("Changed rateType interface of Consumption Low child device (" ..self.id ..") to consumption")
end
end
function consumption_low:updateValue(data)
self:updateProperty("value", tonumber(data.Consumption_Total_L))
self:updateProperty("unit", "kWh")
self:updateProperty("log", " ")
end


class 'production_high'(QuickAppChild)
function production_high:__init(dev)
QuickAppChild.__init(self,dev)
if fibaro.getValue(self.id, "rateType") ~= "production" then
self:updateProperty("rateType", "production")
self:warning("Changed rateType interface of Production High child device (" ..self.id ..") to production")
end
end
function production_high:updateValue(data)
self:updateProperty("value", tonumber(data.Production_Total_H))
self:updateProperty("unit", "kWh")
self:updateProperty("log", " ")
end


class 'production_low'(QuickAppChild)
function production_low:__init(dev)
QuickAppChild.__init(self,dev)
if fibaro.getValue(self.id, "rateType") ~= "production" then
self:updateProperty("rateType", "production")
self:warning("Changed rateType interface of Production Low child device (" ..self.id ..") to production")
end
end
function production_low:updateValue(data)
self:updateProperty("value", tonumber(data.Production_Total_L))
self:updateProperty("unit", "kWh")
self:updateProperty("log", " ")
end


class 'production_act'(QuickAppChild)
function production_act:__init(dev)
QuickAppChild.__init(self,dev)
if fibaro.getValue(self.id, "rateType") ~= "production" then
self:updateProperty("rateType", "production")
self:warning("Changed rateType interface of Production High child device (" ..self.id ..") to production")
end
end
function production_act:updateValue(data)
self:updateProperty("value", tonumber(data.Production_Act))
self:updateProperty("unit", "Watt")
self:updateProperty("log", " ")
end


class 'gas'(QuickAppChild)
function gas:__init(dev)
QuickAppChild.__init(self,dev)
end
function gas:updateValue(data)
self:updateProperty("value", tonumber(data.Gas_Usage))
self:updateProperty("unit", "l/h")
self:updateProperty("log", " ")
end


class 'total_gas'(QuickAppChild)
function total_gas:__init(dev)
QuickAppChild.__init(self,dev)
end
function total_gas:updateValue(data)
self:updateProperty("value", tonumber(data.Gas_Total))
self:updateProperty("unit", "")
self:updateProperty("log", " ")
end

-- EOF
38 changes: 38 additions & 0 deletions Toon_Energy-i18n-20.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
-- Toon Energy i18n Translations

class "i18n"
function i18n:translation(language)
translation = {
en = {
["SIMULATION MODE"] = "SIMULATION MODE",
["Consumption"] = "Consumption",
["Production"] = "Production",
["Consumption High"] = "Consumption High",
["Consumption Low"] = "Consumption Low",
["Production High"] = "Production High",
["Production Low"] = "Production Low",
["Consumption Total"] = "Consumption Total",
["Production Total"] = "Production Total",
["Production Actual"] = "Production Actual",
["Gas Usage"] = "Gas Usage",
["Gas Total"] = "Gas Total",
["Last Run"] = "Last Run"},
nl = {
["SIMULATION MODE"] = "SIMULATIE MODE",
["Consumption"] = "Consumptie",
["Production"] = "Productie",
["Consumption High"] = "Consumptie hoog",
["Consumption Low"] = "Consumptie laag",
["Production High"] = "Consumptie hoog",
["Production Low"] = "Consumptie laag",
["Consumption Total"] = "Consumptie totaal",
["Production Total"] = "Consumptie totaal",
["Production Actual"] = "Consumptie werkelijk",
["Gas Usage"] = "Gas verbruik",
["Gas Total"] = "Gas totaal",
["Last Run"] = "Laatste ronde"},}
translation = translation[language] -- Shorten the table to only the current translation
return translation
end

-- EOF
Loading

0 comments on commit 0edc477

Please sign in to comment.