Design - slashdev/loconet_domotica GitHub Wiki
Loconet Domotica module
This module is intended to be used in e.g. houses to switch on or off different lights. The module works with a mask for 16 outputs.
Modi
The module supports three modi:
- React on an input message (B2, opc_input_rep)
- Indiviual switches per output (B0, switch using opc_sw_req)
- Fast clock enabled
Modus: React on input message
The module can react on 6 addresses that send opc_input_rep (0xB2) messages. For each address, the response on a high and low value can be set. A response always consists of two masks: a mask to switch on outputs, and a mask to switch off outputs.
Modus: Individual switches
The module has 16+1 addresses, that can be used to switch outputs on/off, by sending a opc_sw_req to the module. Let M be the address of the module, set in LNCV 0. Then:
Address | Corresponding output |
---|---|
M+0 | Output 0 |
M+1 | Output 1 |
M+2 | Output 2 |
M+3 | Output 3 |
M+4 | Output 4 |
M+5 | Output 5 |
M+6 | Output 6 |
M+7 | Output 7 |
M+8 | Output 8 |
M+9 | Output 9 |
M+10 | Output 10 |
M+11 | Output 11 |
M+12 | Output 12 |
M+13 | Output 13 |
M+14 | Output 14 |
M+15 | Output 15 |
M+16 | All outputs |
Modus: Fast clock enabled
There are 60 time stamps available on which the module can respond. If the timestamp is reached by the fast clock, then the system responds by switching the outputs on/off based on these two masks.
Masks
We use masks to switch the output. Each bit corresponds to an output:
15 | 14 | 13 | 12 | 11 | 10 | 09 | 08 | 07 | 06 | 05 | 04 | 03 | 02 | 01 | 00 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Out15 | Out14 | Out13 | Out12 | Out11 | Out10 | Out09 | Out08 | Out07 | Out06 | Out05 | Out04 | Out03 | Out02 | Out01 | Out00 |
For example value 65535 switches all outputs, value 34945 switches outputs 0, 7, 11 and 15.
Denoting time
For now, we choose a simple format to denote timestamps as an int:
Time = hours * 100 + minutes
E.g., the value 1735 corresponds to timestamp 17:35.
LNCV values
LNCV | Name | Possible values |
---|---|---|
0 | Address of the module | 1 - 65535 |
1 | Reserved | |
2 | Priority | 1-10 |
3 | Fast clock modus | 0 - switched off |
1 - switched on, overridable by other modi | ||
2 - switched on, fast clock always overrides other modi | ||
4-13 | Reserved for future use | |
14 | Brightness output 0 | 0 - 255 |
15 | Brightness output 1 | 0 - 255 |
16 | Brightness output 2 | 0 - 255 |
17 | Brightness output 3 | 0 - 255 |
18 | Brightness output 4 | 0 - 255 |
19 | Brightness output 5 | 0 - 255 |
20 | Brightness output 6 | 0 - 255 |
21 | Brightness output 7 | 0 - 255 |
22 | Brightness output 8 | 0 - 255 |
23 | Brightness output 9 | 0 - 255 |
24 | Brightness output 10 | 0 - 255 |
25 | Brightness output 11 | 0 - 255 |
26 | Brightness output 12 | 0 - 255 |
27 | Brightness output 13 | 0 - 255 |
28 | Brightness output 14 | 0 - 255 |
29 | Brightness output 15 | 0 - 255 |
From 30 - 59 the LNCV numbers are used for the react on modus:
React on address | Mask on high | Mask off high | Mask on low | Mask off low |
---|---|---|---|---|
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 |
From 60 - 239 the LNCV numbers are used for the fast clock modus:
Time stamp | Mask on | Mask off |
---|---|---|
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 |