-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToon_Energy-childs-20.lua
127 lines (109 loc) · 4.14 KB
/
Toon_Energy-childs-20.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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", "m³")
self:updateProperty("log", " ")
end
-- EOF