-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathI_SmartVT1.xml
More file actions
executable file
·561 lines (472 loc) · 26.2 KB
/
I_SmartVT1.xml
File metadata and controls
executable file
·561 lines (472 loc) · 26.2 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
<?xml version="1.0"?>
<implementation>
<functions>
-- Smart Virtual Thermostat v2.5
-- ServiceID
local TEMP_SID = "urn:upnp-org:serviceId:TemperatureSensor1"
local HVOS_SID = "urn:micasaverde-com:serviceId:HVAC_OperatingState1"
local TSH_SID = "urn:upnp-org:serviceId:TemperatureSetpoint1_Heat"
local TSC_SID = "urn:upnp-org:serviceId:TemperatureSetpoint1_Cool"
local HVUOM_SID = "urn:upnp-org:serviceId:HVAC_UserOperatingMode1"
local SVT_SID = "urn:micasaverde-com:serviceId:SmartVT1"
local SWP_SID = "urn:upnp-org:serviceId:SwitchPower1"
local DIM_SID = "urn:upnp-org:serviceId:Dimming1"
local DOOR_SID = "urn:micasaverde-com:serviceId:SecuritySensor1"
local VSW_SID = "urn:upnp-org:serviceId:VSwitch1"
local HAD_SID = "urn:micasaverde-com:serviceId:HaDevice1"
local SmartVT1_id = tonumber(lul_device)
-- DeviceID
local DOOR_DID = "urn:schemas-micasaverde-com:device:DoorSensor:1"
local MOTI_DID = "urn:schemas-micasaverde-com:device:MotionSensor:1"
local BIN_DID = "urn:schemas-upnp-org:device:BinaryLight:1"
local PIL_DID = "urn:antor-fr:device:PilotWire:1"
local DIM_DID = "urn:schemas-upnp-org:device:DimmableLight:1"
local VSW_DID = "urn:schemas-upnp-org:device:VSwitch:1"
local HEAT_DID = "urn:schemas-upnp-org:device:Heater:1"
local DEFAULT_HEAT_SP = 21
local DEFAULT_COOL_SP = 18
local DEFAULT_HG_SP = 8
local DEFAULT_constC = 60
local DEFAULT_constT = 1
local heaterStatus = "0"
local DeltaMax = 1 -- Seuil de tolerence au dessus de la consigne
local debug = false
function virtual_thermostat_startup (lul_device)
luup.set_failure(false)
local data = readSettings(lul_device)
-- check data before process
if (data.InSensors == nil or #data.InSensors < 1 or data.heaters == nil or #data.heaters < 1) then
luup.task('Bad parameters',2,'Smart Virtual Thermostat', -1)
return false
end
if (#data.inhibitSensors >= 1) then
register_watch(data.inhibitSensors)
end
luup.variable_set (SVT_SID, "EnergyModeStatus", data.EnergyModeStatus , lul_device)
luup.call_timer("RecurentUpdateStatus", 1, "1m", "", tostring(lul_device))
return true,"ok","Smart Virtual Thermostat"
end
function readSettings(lul_device)
local data = {}
-- Config ID
data.InSensors = toListOfNumbers(readVariableOrInit(lul_device,SVT_SID, "Inside Temp Sensors", "" ))
data.OutSensors = toListOfNumbers(readVariableOrInit(lul_device,SVT_SID, "Outside Temp Sensors", "" ))
data.inhibitSensors = toListOfNumbers(readVariableOrInit(lul_device,SVT_SID, "inhibit Sensors", "" ))
data.heaters = toListOfNumbers(readVariableOrInit(lul_device,SVT_SID, "heaters", "" ))
-- Config Variables
data.OpenTempo = tonumber(readVariableOrInit(lul_device,SVT_SID, "Waiting Time Open", "0" ))
data.CloseTempo = tonumber(readVariableOrInit(lul_device,SVT_SID, "Waiting Time Close", "0" ))
data.ForcedTempo = tonumber(readVariableOrInit(lul_device,SVT_SID, "Forced Mode Duration", "3600" ))
data.powerMin = tonumber(readVariableOrInit(lul_device,SVT_SID, "powerMin", "0" ))
data.CalcPeriod = tonumber(readVariableOrInit(lul_device,SVT_SID, "Calculation period", "3600" ))
data.constC = tonumber(readVariableOrInit(lul_device,SVT_SID, "ConstC", DEFAULT_constC ))
data.constT = tonumber(readVariableOrInit(lul_device,SVT_SID, "ConstT", DEFAULT_constT ))
data.heatSp = tonumber(readVariableOrInit(lul_device,TSH_SID, "CurrentSetpoint", DEFAULT_HEAT_SP ))
data.coolSp = tonumber(readVariableOrInit(lul_device,TSC_SID, "CurrentSetpoint", DEFAULT_COOL_SP ))
-- internal Variables
data.ForcedModeState = readVariableOrInit(lul_device,SVT_SID, "Forced Mode", "ForcedOff" )
data.inhibited = tonumber(readVariableOrInit(lul_device,SVT_SID, "Inhibited", "0" ))
data.EnergyModeStatus = readVariableOrInit(lul_device,HVUOM_SID, "EnergyModeStatus", "Normal" )
data.ModeStatus = readVariableOrInit(lul_device,HVUOM_SID, "ModeStatus", "Off" )
data.heatTimeleft = tonumber(readVariableOrInit(lul_device,SVT_SID, "heatTimeleft", "0" )) -- Temps restant en sec avant fin de chauffe
data.calTimeleft = tonumber(readVariableOrInit(lul_device,SVT_SID, "calTimeleft", "0" )) -- Temps restant en sec avec nouveau calcul de regul
data.EndHeatTimesStamp = tonumber(readVariableOrInit(lul_device,SVT_SID, "EndHeatTimesStamp", "0" ))
data.TimesStamp = tonumber(readVariableOrInit(lul_device,SVT_SID, "TimesStamp", "0" ))
data.AutoLearning = toListOfNumbers(readVariableOrInit(lul_device,SVT_SID, "AutoLearning", "0,1,1,0,0,0" )) -- init - poid I,poid E, Tint init, Text init,%
return data
end
-- Fonction lancee si changement d'etat d'une variable watchee
function watch_callback(lul_device, lul_service, lul_variable, lul_value_old, lul_value_new)
local data = readSettings(SmartVT1_id)
if (Inibitors(data.inhibitSensors)) then
if (data.OpenTempo ~= nil) and (data.OpenTempo > 0) then
luup.call_timer("gestionTempoOuverture", 1, data.OpenTempo, "", tostring(SmartVT1_id))
else
gestionTempoOuverture(SmartVT1_id)
end
else
if (data.CloseTempo ~= nil) and (data.CloseTempo > 0) then
luup.call_timer("gestionTempoFermeture", 1, data.CloseTempo, "", tostring(SmartVT1_id))
else
gestionTempoFermeture(SmartVT1_id)
end
end
end
-- Action a mener des que les variables surveillees changent d'etat
function gestionTempoOuverture(lul_device)
lul_device = tonumber(lul_device)
local data = readSettings(lul_device)
local ModeState = luup.variable_get (HVOS_SID, "ModeState", lul_device)
-- On verifie que Inibitors est toujours present apres la tempo pour desactiver le chauffage
if Inibitors(data.inhibitSensors) and (data.inhibited == 0) then
luup.variable_set (SVT_SID, "Inhibited", "1", lul_device)
updateStatus(lul_device)
end
end
function gestionTempoFermeture(lul_device)
lul_device = tonumber(lul_device)
local data = readSettings(lul_device)
-- On verifie que Inibitors est toujours absent apres la tempo pour activer le chauffage
if not(Inibitors(data.inhibitSensors)) and (data.inhibited == 1) then
luup.variable_set (SVT_SID, "Inhibited", "0", lul_device)
updateStatus(lul_device)
end
end
function updateStatus(lul_device)
local data = readSettings(lul_device)
local Tint, Text = readTemp(lul_device,data)
if (data.ModeStatus == "HeatOn") then
-- Si une tempo est paramétré pour le mode forced :
if data.ForcedTempo ~= nil and data.ForcedTempo > 0 then
-- Gestion du tempo du mode forced
local now = os.time()
if ( now >= data.EndHeatTimesStamp) then
-- Fin du mode forced
luup.call_action(HVUOM_SID, "SetModeTarget", { NewModeTarget = "AutoChangeOver" }, lul_device)
return
else
data.heatTimeleft = data.EndHeatTimesStamp - now -- Temps restant avec fin de chauffe
luup.variable_set (SVT_SID, "heatTimeleft", data.heatTimeleft, lul_device)
luup.variable_set (SVT_SID, "calTimeleft", data.heatTimeleft, lul_device)
luup.variable_set (HVOS_SID, "ModeState", "Heating", lul_device)
SetTargetTable("1",data.heaters)
end
else
luup.variable_set(SVT_SID, "heatTimeleft", "∞", lul_device)
luup.variable_set(SVT_SID, "calTimeleft", "∞", lul_device)
luup.variable_set (HVOS_SID, "ModeState", "Heating", lul_device)
SetTargetTable("1",data.heaters)
end
elseif (data.ModeStatus == "CoolOn") then -- mode bypass
luup.variable_set (HVOS_SID, "ModeState", "Cooling", lul_device)
luup.variable_set (SVT_SID, "heatTimeleft", "∞", lul_device)
luup.variable_set (SVT_SID, "calTimeleft", "∞", lul_device)
elseif (data.ModeStatus == "AutoChangeOver") then
-- Gestion de l'intelligence
if ( os.time() >= (data.TimesStamp + data.CalcPeriod )) then
-- On relance le calcul de la regulation tous les data.CalcPeriod secondes
AutoChangeOver(lul_device,true,true)
data = readSettings(lul_device)
end
local tempcal = (data.TimesStamp + data.CalcPeriod)
-- Gestion des commandes
local ModeState = luup.variable_get (HVOS_SID, "ModeState", lul_device)
local now = os.time()
data.heatTimeleft = data.EndHeatTimesStamp - now -- Temps restant avec fin de chauffe
if (data.heatTimeleft < 0) then data.heatTimeleft = 0 end
data.calTimeleft = tempcal - now -- Temps restant avec nouveau calcul de regulation
luup.variable_set (SVT_SID, "heatTimeleft", data.heatTimeleft, lul_device)
luup.variable_set (SVT_SID, "calTimeleft", data.calTimeleft, lul_device)
if (data.inhibited == 1) then
SetTargetTable("0",data.heaters)
local inhibited, time = Inibitors(data.inhibitSensors)
if not(inhibited) and (time + data.CloseTempo) < now then -- la tempo est terminee (securite pour assurer la reprise du chauffage)
luup.variable_set (SVT_SID, "Inhibited", "0", lul_device)
luup.call_timer("updateStatus", 1, "1", "", tostring(lul_device))
return
end
elseif (ModeState == "Heating") then
if ( Tint >= (Consigne(data) + DeltaMax)) then -- temperature de consigne + Delta depasse : On relance la chargement auto
AutoChangeOver(lul_device,true,true)
end
if( now >= data.EndHeatTimesStamp ) then
SetTargetTable("0",data.heaters)
else
SetTargetTable("1",data.heaters)
end
elseif(ModeState == "Cooling") then
-- a completer
else
SetTargetTable("0",data.heaters)
end
else
luup.variable_set (HVUOM_SID, "ModeStatus", "Off", lul_device)
luup.variable_set (HVOS_SID, "ModeState", "Idle", lul_device)
SetTargetTable("0",data.heaters)
end
end
function RecurentUpdateStatus(lul_device)
lul_device = tonumber(lul_device)
luup.call_timer("RecurentUpdateStatus", 1, "2m", "", tostring(lul_device))
pcall(updateStatus,lul_device)
end
function readTemp(lul_device,data)
local Tint = AvgTemperature(data.InSensors,data.CalcPeriod*2) or Consigne(data)
luup.variable_set (TEMP_SID, "CurrentTemperature", Tint, lul_device)
local Text = AvgTemperature(data.OutSensors,data.CalcPeriod*24) or Consigne(data)
--luup.variable_set (TEMP_SID, "CurrentTemperature", Text, lul_device)
return Tint,Text
end
function Inibitors(Sensors)
local GlobalLastSet = 0
for index = 1, #Sensors, 1 do
local device = Sensors[index]
local inhibitor
local lastSet
local invert = false
if (0 > device) then
device = 0 - device
invert = true
end
local type_device = luup.devices[device].device_type -- On determine le SID en fonction de l'ID.
if type_device == DOOR_DID or type_device == MOTI_DID then -- En fonction du SID, on determine la variable a lire.
inhibitor, lastSet = luup.variable_get(DOOR_SID, "Tripped", device)
GlobalLastSet = math.max(GlobalLastSet,tonumber(lastSet))
elseif type_device == VSW_DID then
inhibitor, lastSet = luup.variable_get(VSW_SID, "Status", device)
GlobalLastSet = math.max(GlobalLastSet,tonumber(lastSet))
elseif type_device == BIN_DID then
inhibitor, lastSet = luup.variable_get(SWP_SID, "Status", device)
GlobalLastSet = math.max(GlobalLastSet,tonumber(lastSet))
elseif type_device == VSW_DID then
inhibitor, lastSet = luup.variable_get(VSW_SID, "Status", device)
GlobalLastSet = math.max(GlobalLastSet,tonumber(lastSet))
else
invert = false
inhibitor = "0"
end
if (inhibitor == (invert and "0" or "1")) then
return true
end
end
return false, GlobalLastSet
end
function HeatOn(lul_device)
local data = readSettings(lul_device)
if data.ForcedTempo ~= nil and data.ForcedTempo > 0 then
local calnow = os.time()
local hforced = GetTime(calnow ,data.ForcedTempo) -- Needed to works with Vera 1 (single-precision floats)
luup.variable_set (SVT_SID, "TimesStamp", calnow, lul_device)
luup.variable_set (SVT_SID, "EndHeatTimesStamp", hforced, lul_device)
end
updateStatus(lul_device)
end
function AutoCallib(lul_device,data)
local Tint, Text = readTemp(lul_device,data)
local consigne = Consigne(data)
local calnow = os.time()
if #data.AutoLearning ~= 6 then
luup.variable_set (SVT_SID, "AutoLearning", "0,1,1,0,0,0", lul_device)
return true
elseif data.AutoLearning[1] ~= 1 then
-- data not initilised
return false
elseif data.AutoLearning[6] == 0 then
-- Heater was off, nothing to learn
return false
elseif data.AutoLearning[6] == 100 and consigne > Tint then
-- Heater was on max but consigne was not reached so we dont learn
return false
elseif data.TimesStamp > calnow or (calnow - data.TimesStamp) > (data.CalcPeriod * 2) then -- Evite de tout casser en cas de perte de date de la Vera
return false
elseif Tint > data.AutoLearning[4] and consigne > data.AutoLearning[4] then -- Si Tinterieur sup a Tinterieur initial et Consigne sup a Tinterieur initial
-- Learn ConstC
local ConstC = data.constC * ((consigne - data.AutoLearning[4]) / (Tint - data.AutoLearning[4] )) * (calnow - data.TimesStamp) / data.CalcPeriod
ConstC = round((data.constC * data.AutoLearning[2] + ConstC) / (data.AutoLearning[2] +1),1)
data.AutoLearning[2] = math.min(data.AutoLearning[2] +1 , 50)
luup.variable_set (SVT_SID, "AutoLearning", fromListOfNumbers(data.AutoLearning), lul_device)
luup.variable_set (SVT_SID, "ConstC", ConstC , lul_device)
return true
elseif consigne > data.AutoLearning[5] then
-- Learn ConstT
local ConstT = data.constT + (( consigne - Tint) / ( consigne - data.AutoLearning[5] )) * data.constC * (calnow - data.TimesStamp) / data.CalcPeriod
ConstT = round((data.constT * data.AutoLearning[3] + ConstT) / (data.AutoLearning[3] +1),1)
if ConstT < 0 then ConstT = 0 end
data.AutoLearning[3] = math.min(data.AutoLearning[3] +1 , 50)
luup.variable_set (SVT_SID, "AutoLearning", fromListOfNumbers(data.AutoLearning), lul_device)
luup.variable_set (SVT_SID, "ConstT", ConstT , lul_device)
return true
else
return false
end
end
function GraphIt(lul_device)
local TempExt, Chauffe
local data = readSettings(lul_device)
data.Grapher = luup.variable_get(SVT_SID,"Grapher", lul_device) or "http://mios.antor.fr/Graph/logger/temp.php"
local consigne = Consigne(data) * 100
local TempInt = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", math.abs(data.InSensors[1]))
local TempTherm = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", lul_device)
local Inhibited = (data.inhibited or 0) * 800 + 1000
local id = data.heaters[1]
local devicetype = luup.devices[id].device_type
if (devicetype == BIN_DID) then
Chauffe = luup.variable_get(SWP_SID, "Status", id)
Chauffe = tonumber(Chauffe) * 800 + 1000
elseif (devicetype == VSW_DID) then
Chauffe = luup.variable_get(VSW_SID, "Status", id) -- On recupere la variable du module
Chauffe = tonumber(Chauffe) * 800 + 1000
elseif (devicetype == PIL_DID) or (devicetype == DIM_DID) then
Chauffe = luup.variable_get(DIM_SID, "LoadLevelStatus", id)
Chauffe = tonumber(Chauffe) * 8 + 1000
elseif (devicetype == HEAT_DID) then
local heaterStatus = luup.variable_get(HVUOM_SID, "ModeStatus", id)
if heaterStatus == "HeatOn" then
Chauffe = 1800
elseif heaterStatus == "Off" then
Chauffe = 1000
end
end
if #data.OutSensors > 0 then
TempExt = luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1", "CurrentTemperature", math.abs(data.OutSensors[1]))
TempExt = tonumber(TempExt) * 100
else
TempExt = 0
end
local Vera_id = luup.pk_accesspoint
local Device_id = lul_device
TempInt = tonumber(TempInt) * 100
TempTherm = tonumber(TempTherm) * 100
local lul_update = data.Grapher .. '?Vera_id=' .. Vera_id .. '&Device_id=' .. Device_id .. '&TempExt=' .. TempExt .. '&TempInt=' .. TempInt .. '&TempTherm=' .. TempTherm .. '&Consigne=' .. consigne .. '&Chauffe=' .. Chauffe .. '&Inhibited=' .. Inhibited
luup.inet.wget(lul_update)
return true
end
function AutoChangeOver(lul_device,learn,dont_update_status)
local data = readSettings(lul_device)
local calnow = os.time()
if learn~=nil and learn == true then
if AutoCallib(lul_device,data) then
-- refresh data
data = readSettings(lul_device)
end
end
local Tint, Text = readTemp(lul_device,data)
local consigne = Consigne(data)
local power = round((consigne - Tint) * data.constC + (consigne - Text) * data.constT,1)
if (power < 0) then power = 0 end -- Limite basse
if (power > 100) then power = 100 end -- Limite haute
if (power > 0) and (power <= data.powerMin) then power = data.powerMin end -- Seuil mini de power
local tpschauf = power * (data.CalcPeriod/100)
tpschauf = math.floor(tpschauf)
--local hchauf = os.time(calnow + tpschauf)
local hchauf = GetTime(calnow,tpschauf) -- Needed to works with Vera 1 (single-precision floats)
if power == 0 then
luup.variable_set (HVOS_SID, "ModeState", "Idle", lul_device)
else
luup.variable_set (HVOS_SID, "ModeState", "Heating", lul_device)
end
luup.variable_set (SVT_SID, "TimesStamp", calnow, lul_device)
luup.variable_set (SVT_SID, "EndHeatTimesStamp", hchauf, lul_device)
if data.AutoLearning[1] < 2 then
data.AutoLearning[1] = 1
data.AutoLearning[4] = Tint
data.AutoLearning[5] = Text
data.AutoLearning[6] = power
luup.variable_set (SVT_SID, "AutoLearning", fromListOfNumbers(data.AutoLearning), lul_device)
end
if not dont_update_status then
updateStatus(lul_device)
end
end
</functions>
<startup>virtual_thermostat_startup</startup>
<files>L_SmartVT1.lua</files>
<actionList>
<action>
<serviceId>urn:micasaverde-com:serviceId:SmartVT1</serviceId>
<name>SetForcedMode</name>
<job>
luup.variable_set (SVT_SID, "Forced Mode", lul_settings.NewForcedMode, lul_device)
-- Action to do
return 4, 5
</job>
</action>
<action>
<serviceId>urn:upnp-org:serviceId:HVAC_UserOperatingMode1</serviceId>
<name>SetEnergyModeTarget</name>
<job>
luup.variable_set (HVUOM_SID, "EnergyModeTarget", lul_settings.NewEnergyModeTarget, lul_device)
luup.variable_set (HVUOM_SID, "EnergyModeStatus", lul_settings.NewEnergyModeTarget, lul_device)
luup.variable_set (SVT_SID, "EnergyModeStatus", lul_settings.NewEnergyModeTarget, lul_device)
AutoChangeOver(lul_device)
return 4, 5
</job>
</action>
<action>
<serviceId>urn:upnp-org:serviceId:HVAC_UserOperatingMode1</serviceId>
<name>SetModeTarget</name>
<job>
luup.variable_set (HVUOM_SID, "ModeTarget", lul_settings.NewModeTarget, lul_device)
luup.variable_set (HVUOM_SID, "ModeStatus", lul_settings.NewModeTarget, lul_device)
if lul_settings.NewModeTarget == "AutoChangeOver" then
AutoChangeOver(lul_device)
elseif lul_settings.NewModeTarget == "HeatOn" then
HeatOn(lul_device)
else
-- ajout de ce block par LV999 le 22/01/2016 pour un effet immédiat de
-- la commande "Off" et non par attente timer recurrent de 2 mins
updateStatus(lul_device)
end
return 4, 5
</job>
</action>
<action>
<serviceId>urn:upnp-org:serviceId:TemperatureSetpoint1_Heat</serviceId>
<name>SetCurrentSetpoint</name>
<job>
-- On conditionne le lancement des fonctions au mode selectionne pour ne pas recalculer le coef quand on est dans lautre mode
luup.variable_set (TSH_SID, "CurrentSetpoint", lul_settings.NewCurrentSetpoint, lul_device)
local EnergyModeStatus = luup.variable_get (HVUOM_SID, "EnergyModeStatus", lul_device)
local ModeStatus = luup.variable_get (HVUOM_SID, "ModeStatus", lul_device)
if ((ModeStatus == "AutoChangeOver") and (EnergyModeStatus == "Normal")) then
AutoChangeOver(lul_device)
end
return 4, 5
</job>
</action>
<action>
<serviceId>urn:upnp-org:serviceId:TemperatureSetpoint1</serviceId>
<name>SetCurrentSetpoint</name>
<job>
-- On conditionne le lancement des fonctions au mode selectionne pour ne pas recalculer le coef quand on est dans lautre mode
luup.variable_set (TSH_SID, "CurrentSetpoint", lul_settings.NewCurrentSetpoint, lul_device)
luup.variable_set (TSC_SID, "CurrentSetpoint", lul_settings.NewCurrentSetpoint, lul_device)
local EnergyModeStatus = luup.variable_get (HVUOM_SID, "EnergyModeStatus", lul_device)
local ModeStatus = luup.variable_get (HVUOM_SID, "ModeStatus", lul_device)
if ((ModeStatus == "AutoChangeOver") and (EnergyModeStatus == "Normal")) then
AutoChangeOver(lul_device)
end
return 4, 5
</job>
</action>
<action>
<serviceId>urn:upnp-org:serviceId:TemperatureSetpoint1_Cool</serviceId>
<name>SetCurrentSetpoint</name>
<job>
-- On conditionne le lancement des fonctions au mode selectionne pour ne pas recalculer le coef quand on est dans lautre mode
luup.variable_set (TSC_SID, "CurrentSetpoint", lul_settings.NewCurrentSetpoint, lul_device)
local EnergyModeStatus = luup.variable_get (HVUOM_SID, "EnergyModeStatus", lul_device)
local ModeStatus = luup.variable_get (HVUOM_SID, "ModeStatus", lul_device)
if ((ModeStatus == "AutoChangeOver") and (EnergyModeStatus == "EnergySavingsMode")) then
AutoChangeOver(lul_device)
end
return 4, 5
</job>
</action>
<action>
<serviceId>urn:upnp-org:serviceId:SwitchPower1</serviceId>
<name>SetTarget</name>
<job>
luup.variable_set (SWP_SID, "Target", lul_settings.newTargetValue, lul_device)
luup.variable_set (SWP_SID, "Status", lul_settings.newTargetValue, lul_device)
return 4, 5
</job>
</action>
<action>
<serviceId>urn:micasaverde-com:serviceId:SmartVT1</serviceId>
<name>GraphIt</name>
<job>
GraphIt(lul_device)
return 4, 5
</job>
</action>
<action>
<serviceId>urn:micasaverde-com:serviceId:SmartVT1</serviceId>
<name>UpdateStatus</name>
<job>
updateStatus(lul_device)
return 4, 5
</job>
</action>
</actionList>
</implementation>