-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathI_MpcClient.xml
92 lines (92 loc) · 2.99 KB
/
I_MpcClient.xml
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
<?xml version="1.0"?>
<implementation>
<functions>
package.loaded.L_MpcClient = nil
mpcctrl = require ("L_MpcClient")
MPCCTRL_SERVICE = mpcctrl.MPCCTRL_SERVICE
function nextStep()
mpcctrl.doStep()
end
function startup(lul_device)
mpcctrl.initialize(lul_device)
end
</functions>
<incoming>
luup.log("when does this happen")
</incoming>
<startup>startup</startup>
<actionList>
<action>
<serviceId>urn:demo-micasaverde-com:serviceId:MpcControl1</serviceId>
<name>setMpcUrl</name>
<run>
luup.variable_set(MPCCTRL_SERVICE, "mpcUrl", lul_settings.xUrl or "", lul_device)
</run>
</action>
<action>
<serviceId>urn:demo-micasaverde-com:serviceId:MpcControl1</serviceId>
<name>setMpc</name>
<run>
yMpcID = mpcctrl.setMpc(lul_settings.xTransFunc, lul_settings.xTransFuncType, lul_settings.xSamplePeriod, lul_settings.xInputDelay)
if yMpcID then
luup.variable_set(MPCCTRL_SERVICE, "mpcid", yMpcID, lul_device)
luup.call_timer("nextStep", 1, tostring(lul_settings.xSamplePeriod), "")
end
</run>
</action>
<action>
<serviceId>urn:demo-micasaverde-com:serviceId:MpcControl1</serviceId>
<name>getStep</name>
<run>
yComputedY, yComputedU = mpcctrl.getNextStep()
if yComputedU then
luup.variable_set(MPCCTRL_SERVICE, "computedY", yComputedY, lul_device)
luup.variable_set(MPCCTRL_SERVICE, "computedU", yComputedU, lul_device)
end
</run>
</action>
<action>
<serviceId>urn:demo-micasaverde-com:serviceId:MpcControl1</serviceId>
<name>setSetPoint</name>
<run>
luup.variable_set(MPCCTRL_SERVICE, "setpoint", lul_settings.xSetpoint or "", lul_device)
</run>
</action>
<action>
<serviceId>urn:demo-micasaverde-com:serviceId:MpcControl1</serviceId>
<name>setBypass</name>
<run>
luup.variable_set(MPCCTRL_SERVICE, "bypass", "1", lul_device)
</run>
</action>
<action>
<serviceId>urn:demo-micasaverde-com:serviceId:MpcControl1</serviceId>
<name>unsetBypass</name>
<run>
luup.variable_set(MPCCTRL_SERVICE, "bypass", "0", lul_device)
mpcctrl.doStep()
</run>
</action>
<action>
<serviceId>urn:demo-micasaverde-com:serviceId:MpcControl1</serviceId>
<name>setCtrlDevice</name>
<run>
mpcctrl.setCtrlDevice(lul_settings.xDeviceId, lul_settings.xServiceId, lul_settings.xAction, lul_settings.xVariable)
</run>
</action>
<action>
<serviceId>urn:demo-micasaverde-com:serviceId:MpcControl1</serviceId>
<name>setMesDevice</name>
<run>
mpcctrl.setMesDevice(lul_settings.xDeviceId, lul_settings.xServiceId, lul_settings.xVariable)
</run>
</action>
<action>
<serviceId>urn:demo-micasaverde-com:serviceId:MpcControl1</serviceId>
<name>setOffset</name>
<run>
luup.variable_set(MPCCTRL_SERVICE, "uoffset", lul_settings.xUoffset or "", lul_device)
</run>
</action>
</actionList>
</implementation>