Changeset 53
- Timestamp:
- 2013-01-06 17:39:14 (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/D_Powermax.json ¶
r52 r53 78 78 "left": "0", 79 79 "Display": { 80 "Top": 40,80 "Top": 50, 81 81 "Left": 50, 82 82 "Width": 75, … … 92 92 "Service": "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", 93 93 "Variable": "PowerlinkMode", 94 "Top": 40,94 "Top": 50, 95 95 "Left": 150, 96 96 "Width": 175, … … 105 105 }, 106 106 "Display": { 107 "Top": 60,107 "Top": 90, 108 108 "Left": 50, 109 109 "Width": 75, … … 120 120 "Service": "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", 121 121 "Variable": "PanelType", 122 "Top": 60,122 "Top": 90, 123 123 "Left": 150, 124 124 "Width": 175, … … 133 133 }, 134 134 "Display": { 135 "Top": 75,135 "Top": 115, 136 136 "Left": 50, 137 137 "Width": 75, … … 144 144 "Service": "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", 145 145 "Variable": "PanelName", 146 "Top": 75,146 "Top": 115, 147 147 "Left": 150, 148 148 "Width": 175, … … 157 157 }, 158 158 "Display": { 159 "Top": 90,159 "Top": 140, 160 160 "Left": 50, 161 161 "Width": 75, … … 168 168 "Service": "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", 169 169 "Variable": "PanelSerial", 170 "Top": 90,170 "Top": 140, 171 171 "Left": 150, 172 172 "Width": 175, … … 181 181 }, 182 182 "Display": { 183 "Top": 1 05,183 "Top": 165, 184 184 "Left": 50, 185 185 "Width": 75, … … 192 192 "Service": "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", 193 193 "Variable": "PanelEprom", 194 "Top": 1 05,194 "Top": 165, 195 195 "Left": 150, 196 196 "Width": 175, … … 205 205 }, 206 206 "Display": { 207 "Top": 1 20,207 "Top": 190, 208 208 "Left": 50, 209 209 "Width": 75, … … 216 216 "Service": "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", 217 217 "Variable": "PanelSoftware", 218 "Top": 1 20,218 "Top": 190, 219 219 "Left": 150, 220 220 "Width": 175, … … 229 229 }, 230 230 "Display": { 231 "Top": 135,231 "Top": 215, 232 232 "Left": 50, 233 233 "Width": 75, … … 240 240 "Service": "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", 241 241 "Variable": "PanelStatusCode", 242 "Top": 135,242 "Top": 215, 243 243 "Left": 150, 244 244 "Width": 175, … … 253 253 }, 254 254 "Display": { 255 "Top": 150,255 "Top": 240, 256 256 "Left": 50, 257 257 "Width": 75, … … 264 264 "Service": "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", 265 265 "Variable": "PanelStatusData", 266 "Top": 150, 267 "Left": 150, 268 "Width": 175, 269 "Height": 20 270 } 271 }, 272 { 273 "ControlType": "button", 274 "Label": { 275 "lang_tag": "synctime", 276 "text": "Sync Time on Powermax and Vera" 277 }, 278 "Display": { 279 "Top": 180, 280 "Left": 50, 281 "Width": 325, 282 "Height": 20 283 }, 284 "Command": { 285 "Service": "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", 286 "Action": "SyncTime" 287 } 288 }, 289 { 290 "ControlType": "button", 291 "Label": { 292 "lang_tag": "x10on", 293 "text": "On" 294 }, 295 "Display": { 296 "Top": 215, 297 "Left": 325, 298 "Width": 50, 299 "Height": 20 300 }, 301 "Command": { 302 "Service": "urn:upnp-org:serviceId:SwitchPower1", 303 "Action": "SetTarget", 304 "Parameters": [ 305 { 306 "Name": "DeviceId", 307 "ID" : "DeviceId" 308 }, 309 { 310 "Name": "newTargetValue", 311 "Value": "1" 312 } 313 ] 314 } 315 }, 316 { 317 "ControlType": "button", 318 "Label": { 319 "lang_tag": "x10off", 320 "text": "Off" 321 }, 322 "Display": { 323 "Top": 215, 324 "Left": 270, 325 "Width": 50, 326 "Height": 20 327 }, 328 "Command": { 329 "Service": "urn:upnp-org:serviceId:SwitchPower1", 330 "Action": "SetTarget", 331 "Parameters": [ 332 { 333 "Name": "DeviceId", 334 "ID" : "DeviceId" 335 }, 336 { 337 "Name": "newTargetValue", 338 "Value": "0" 339 } 340 ] 341 } 342 }, 343 { 344 "ControlType": "label", 345 "Label": { 346 "lang_tag": "deviceId", 347 "text": "Change status of X10 device" 348 }, 349 "Display": { 350 "Top": 220, 351 "Left": 50, 352 "Width": 175, 353 "Height": 20 354 } 355 }, 356 { 357 "ControlType": "input", 358 "ID": "DeviceId", 359 "Display": { 360 "Top": 215, 361 "Left": 225, 362 "Width": 30, 363 "Height": 20 364 } 365 }, 366 { 367 "ControlType": "button", 368 "Label": { 369 "lang_tag": "en_bypass", 370 "text": "Enable Bypass" 371 }, 372 "Display": { 373 "Top": 250, 374 "Left": 50, 375 "Width": 125, 376 "Height": 20 377 }, 378 "Command": { 379 "Service": "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", 380 "Action": "EnableBypass", 381 "Parameters": [ 382 { 383 "Name": "PINCode", 384 "ID" : "PINCode" 385 } 386 ] 387 } 388 }, 389 { 390 "ControlType": "button", 391 "Label": { 392 "lang_tag": "dis_bypass", 393 "text": "Disable Bypass" 394 }, 395 "Display": { 396 "Top": 250, 397 "Left": 195, 398 "Width": 125, 399 "Height": 20 400 }, 401 "Command": { 402 "Service": "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", 403 "Action": "DisableBypass", 404 "Parameters": [ 405 { 406 "Name": "PINCode", 407 "ID" : "PINCode" 408 } 409 ] 410 } 411 }, 412 { 413 "ControlType": "label", 414 "Label": { 415 "lang_tag": "PINCode", 416 "text": "Access Code needed for bypass" 417 }, 418 "Display": { 419 "Top": 285, 420 "Left": 50, 421 "Width": 200, 422 "Height": 20 423 } 424 }, 425 { 426 "ControlType": "input", 427 "ID": "PINCode", 428 "Display": { 429 "Top": 280, 430 "Left": 260, 431 "Width": 55, 432 "Height": 20 433 } 434 } 435 ] 266 "Top": 240, 267 "Left": 150, 268 "Width": 175, 269 "Height": 20 270 } 271 } 272 ] 436 273 }, 437 274 { … … 457 294 { 458 295 "Label": { 296 "lang_tag": "zones", 297 "text": "Zones" 298 }, 299 "Position": "3", 300 "TabType": "javascript", 301 "ScriptName": "J_Powermax.js", 302 "Function": "pmjsZonesTab" 303 }, 304 { 305 "Label": { 306 "lang_tag": "devices", 307 "text": "Devices" 308 }, 309 "Position": "4", 310 "TabType": "javascript", 311 "ScriptName": "J_Powermax.js", 312 "Function": "pmjsDevicesTab" 313 }, 314 { 315 "Label": { 459 316 "lang_tag": "advanced", 460 317 "text": "Advanced" 461 318 }, 462 "Position": " 3",319 "Position": "5", 463 320 "TabType": "javascript", 464 321 "ScriptName": "shared.js", … … 470 327 "text": "Logs" 471 328 }, 472 "Position": " 4",329 "Position": "6", 473 330 "TabType": "javascript", 474 331 "ScriptName": "shared.js", … … 480 337 "text": "Notifications" 481 338 }, 482 "Position": " 5",339 "Position": "7", 483 340 "TabType": "javascript", 484 341 "ScriptName": "shared.js", … … 503 360 }, 504 361 "cmd_2": { 505 "label": "SyncTime",506 "serviceId": "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1",507 "action": "SyncTime",508 "argumentList": {}509 },510 "cmd_3": {511 362 "label": "SetTarget", 512 363 "serviceId": "urn:upnp-org:serviceId:SwitchPower1", -
TabularUnified trunk/I_Powermax.xml ¶
r51 r53 142 142 </action> 143 143 144 <action>145 <serviceId>urn:micasaverde-com:serviceId:PowermaxAlarmPanel1</serviceId>146 <name>SyncTime</name>147 <run>148 if (pluginLib ~= nil) then pluginLib.SyncTime() end149 </run>150 </action>151 152 <action>153 <serviceId>urn:micasaverde-com:serviceId:PowermaxAlarmPanel1</serviceId>154 <name>EnableBypass</name>155 <run>156 if (pluginLib ~= nil) then pluginLib.EnableBypass(lul_settings.PINCode or "") end157 </run>158 </action>159 160 <action>161 <serviceId>urn:micasaverde-com:serviceId:PowermaxAlarmPanel1</serviceId>162 <name>DisableBypass</name>163 <run>164 if (pluginLib ~= nil) then pluginLib.DisableBypass(lul_settings.PINCode or "") end165 </run>166 </action>167 168 144 </actionList> 169 145 </implementation> -
TabularUnified trunk/J_Powermax.js ¶
r52 r53 35 35 document.getElementById('eventLogButton').style.visibility = 'hidden'; 36 36 document.getElementById('eventLogStatus').innerHTML = '<blink>Retrieving information...</blink>'; 37 setTimeout("pmjsUpdateEventLog("+device+")", 1000);37 setTimeout("pmjsUpdateEventLog("+device+")", 2000); 38 38 }; 39 40 function pmjsZonesTab(deviceID) { 41 var html = ''; 42 var canEdit = (get_device_state(deviceID, "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", "AutoCreate", 0) == '0'); 43 var extra = ''; 44 var dynamic; 45 if (canEdit == false) { 46 extra = ' disabled'; 47 dynamic = 1 48 } else { 49 dynamic = 0 50 } 51 var doorZones = get_device_state(deviceID, "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", "DoorZones", dynamic); 52 var motionZones = get_device_state(deviceID, "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", "MotionZones", dynamic); 53 var smokeZones = get_device_state(deviceID, "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", "SmokeZones", dynamic); 54 html += '<style type="text/css">td {text-align:center; vertical-align:middle;}</style>'; 55 html += '<table class="skinned-form-controls skinned-form-controls-mac" width="100%" border="0" cellspacing="2" cellpadding="0">'; 56 html += '</tr>'; 57 var zhtml = ['', '', '', '', '', '', '', '', '', '']; 58 for (var i = 1; i <= 30; i++) { 59 var row = (i - (i % 16)) / 16; 60 zhtml[0 + 5 * row] += '<td>' + i + '</td>'; 61 zhtml[1 + 5 * row] += '<td><input type="radio" id="Z' + i + '_door" name="Z' + i + '" value="door" onChange="pmjsUpdateZones(' + deviceID + ')"'+extra+'><span></span></td>'; 62 zhtml[2 + 5 * row] += '<td><input type="radio" id="Z' + i + '_motion" name="Z' + i + '" value="motion" onChange="pmjsUpdateZones(' + deviceID + ')"'+extra+'><span></span></td>'; 63 zhtml[3 + 5 * row] += '<td><input type="radio" id="Z' + i + '_smoke" name="Z' + i + '" value="smoke" onChange="pmjsUpdateZones(' + deviceID + ')"'+extra+'><span></span></td>'; 64 zhtml[4 + 5 * row] += '<td><input type="radio" id="Z' + i + '_none" name="Z' + i + '" value="none" onChange="pmjsUpdateZones(' + deviceID + ')"'+extra+'><span></span></td>'; 65 } 66 for (var i = 0; i <= 1; i++) { 67 html += '<tr><td colspan="16" style="text-align:left;"><b>Zone configuration ' + (15*i+1) + '-' + (15*(i+1)) + '</td></tr>'; 68 html += '<tr><td></td>' + zhtml[0 + 5 * i] + '</tr>'; 69 html += '<tr><td style="text-align:left;">Door/window</td>' + zhtml[1 + 5 * i] + '</tr>'; 70 html += '<tr><td style="text-align:left;">Motion</td>' + zhtml[2 + 5 * i] + '</tr>'; 71 html += '<tr><td style="text-align:left;">Smoke/gas</td>' + zhtml[3 + 5 * i] + '</tr>'; 72 html += '<tr><td style="text-align:left;">Not used</td>' + zhtml[4 + 5 * i] + '</tr>'; 73 html += '<tr><td colspan="16" style="padding-top:15px;"></td></tr>'; 74 } 75 if (canEdit == false) { 76 html += '<tr><td style="text-align:left; padding-top:5px;" colspan="16"><i>Note: Zones cannot be edited since the "Auto-create devices" option is On (see tab "Settings").</i></td></tr>' 77 } 78 html += '</table>'; 79 set_panel_html(html); 80 81 for (var i = 1; i <= 30; i++) { 82 var value; 83 var name = 'Z' + i 84 if (i < 10) { 85 name = 'Z0' + i 86 } 87 if (doorZones.indexOf(name) >= 0) { 88 document.getElementById('Z'+i+'_door').checked = true; 89 } else 90 if (motionZones.indexOf(name) >= 0) { 91 document.getElementById('Z'+i+'_motion').checked = true; 92 } else 93 if (smokeZones.indexOf(name) >= 0) { 94 document.getElementById('Z'+i+'_smoke').checked = true; 95 } else { 96 document.getElementById('Z'+i+'_none').checked = true; 97 } 98 } 99 } 100 101 function pmjsUpdateZones(deviceID) { 102 var doorZones = ''; 103 var motionZones = ''; 104 var smokeZones = ''; 105 for (var i = 1; i <= 30; i++) { 106 var value; 107 var name = 'Z' + i 108 if (i < 10) { 109 name = 'Z0' + i 110 } 111 if (document.getElementById('Z'+i+'_door').checked == true) { 112 doorZones += ',' + name; 113 } else 114 if (document.getElementById('Z'+i+'_motion').checked == true) { 115 motionZones += ',' + name; 116 } else 117 if (document.getElementById('Z'+i+'_smoke').checked == true) { 118 smokeZones += ',' + name; 119 } 120 } 121 set_device_state(deviceID, "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", "DoorZones", doorZones.substr(1), 0); 122 set_device_state(deviceID, "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", "MotionZones", motionZones.substr(1), 0); 123 set_device_state(deviceID, "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", "SmokeZones", smokeZones.substr(1), 0); 124 } 125 126 function pmjsDevicesTab(deviceID) { 127 var html = ''; 128 var canEdit = (get_device_state(deviceID, "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", "AutoCreate", 0) == '0'); 129 var extra = ''; 130 var dynamic; 131 if (canEdit == false) { 132 extra = ' disabled'; 133 dynamic = 1 134 } else { 135 dynamic = 0 136 } 137 var devices = get_device_state(deviceID, "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", "Devices", dynamic); 138 139 html += '<style type="text/css">td {text-align:center; vertical-align:middle;} input {margin:0px;}</style>'; 140 html += '<table class="skinned-form-controls skinned-form-controls-mac" width="100%" border="0" cellspacing="5" cellpadding="0">'; 141 html += '<tr><td style="text-align:left;" colspan="16"><b>Device configuration</td></tr><tr><td></td>'; 142 for (var i = 1; i <= 15; i++) { 143 html += '<td>' + i + '</td>'; 144 } 145 html += '</tr><tr><td style="text-align:left;">PGM</td><td><input type="checkbox" id="PGM" name="PGM" value="pgm" onChange="pmjsUpdateDevices(' + deviceID + ')"'+extra+'><span></span></td>'; 146 html += '</tr><tr><td style="text-align:left;">X-10</td>'; 147 for (var i = 1; i <= 15; i++) { 148 html += '<td><input type="checkbox" id="X'+i+'_x10" name="X'+i+'" value="x10" onChange="pmjsUpdateDevices(' + deviceID + ')"'+extra+'><span></span></td>'; 149 } 150 html += '</tr><tr><td style="text-align:left;">Keypad (1-way)</td>'; 151 for (var i = 1; i <= 2; i++) { 152 html += '<td><input type="checkbox" id="K1'+i+'_key" name="K1'+i+'" value="key" onChange="pmjsUpdateDevices(' + deviceID + ')"'+extra+'><span></span></td>'; 153 } 154 html += '</tr><tr><td style="text-align:left;">Keypad (2-way)</td>'; 155 for (var i = 1; i <= 8; i++) { 156 html += '<td><input type="checkbox" id="K2'+i+'_key" name="K2'+i+'" value="key" onChange="pmjsUpdateDevices(' + deviceID + ')"'+extra+'><span></span></td>'; 157 } 158 html += '</tr><tr><td style="text-align:left;">Siren</td>'; 159 for (var i = 1; i <= 2; i++) { 160 html += '<td><input type="checkbox" id="S'+i+'_siren" name="S'+i+'" value="siren" onChange="pmjsUpdateDevices(' + deviceID + ')"'+extra+'><span></span></td>'; 161 } 162 html +='</tr>'; 163 if (canEdit == false) { 164 html += '<tr><td style="text-align:left; padding-top:25px;" colspan="16"><i>Note: Devices cannot be edited since the "Auto-create devices" option is On (see tab "Settings").</i></td></tr>' 165 } 166 html += '</table>'; 167 set_panel_html(html); 168 169 for (var i = 1; i <= 2; i++) { 170 if (devices.indexOf('K1'+i) >= 0) { 171 document.getElementById('K1'+i+'_key').checked = true; 172 } 173 if (devices.indexOf('S0'+i) >= 0) { 174 document.getElementById('S'+i+'_siren').checked = true; 175 } 176 } 177 for (var i = 1; i <= 8; i++) { 178 if (devices.indexOf('K2'+i) >= 0) { 179 document.getElementById('K2'+i+'_key').checked = true; 180 } 181 } 182 for (var i = 1; i <= 15; i++) { 183 var name = 'X' + i 184 if (i < 10) { 185 name = 'X0' + i 186 } 187 if (devices.indexOf(name) >= 0) { 188 document.getElementById('X'+i+'_x10').checked = true; 189 } 190 } 191 if (devices.indexOf('PGM') >= 0) { 192 document.getElementById('PGM').checked = true; 193 } 194 } 195 196 function pmjsUpdateDevices(deviceID) { 197 var devices = ''; 198 for (var i = 1; i <= 2; i++) { 199 if (document.getElementById('K1'+i+'_key').checked == true) { 200 devices += ',K1' + i; 201 } 202 if (document.getElementById('S'+i+'_siren').checked == true) { 203 devices += ',S0' + i; 204 } 205 } 206 for (var i = 1; i <= 8; i++) { 207 if (document.getElementById('K2'+i+'_key').checked == true) { 208 devices += ',K2' + i; 209 } 210 } 211 for (var i = 1; i <= 15; i++) { 212 if (document.getElementById('X'+i+'_x10').checked == true) { 213 var name = 'X' + i 214 if (i < 10) { 215 name = 'X0' + i 216 } 217 devices += ',' + name; 218 } 219 } 220 if (document.getElementById('PGM').checked == true) { 221 devices += ',PGM'; 222 } 223 set_device_state(deviceID, "urn:micasaverde-com:serviceId:PowermaxAlarmPanel1", "Devices", devices.substr(1), 0); 224 } 39 225 40 226 function pmjsSettingsTab(deviceID) { … … 52 238 var timeouts = [{'value':'1','label':'1 minute'}, {'value':'2','label':'2 minutes'}, {'value':'3','label':'3 minutes'}, {'value':'4','label':'4 minutes'}, {'value':'5','label':'5 minutes'}]; 53 239 var languages = [{'value':'EN','label':'English'}, {'value':'NL','label':'Nederlands'}]; 54 55 html += pmjsAddPulldown(deviceID, 'Motion sensor timeout (sec):', 'MotionOffDelay', timeouts); 240 var remotearm = [{'value':'false','label':'No arm/disarm allowed'}, {'value':'arm','label':'Only arm away allowed'}, {'value':'stay','label':'Arm (Home) allowed'}, {'value':'disarm','label':'Arm & disarm allowed'}]; 241 242 html += pmjsAddPulldown(deviceID, 'Motion sensor timeout:', 'MotionOffDelay', timeouts); 56 243 html += pmjsAddPulldown(deviceID, 'Language selection:', 'PluginLanguage', languages); 57 244 html += pmjsAddButtons(deviceID, 'Generate debug logging & files:', 'PluginDebug'); … … 60 247 html += pmjsAddButtons(deviceID, 'Auto-create devices:', 'AutoCreate'); 61 248 html += pmjsAddButtons(deviceID, 'Auto-sync time on startup:', 'AutoSyncTime'); 249 html += pmjsAddPulldown(deviceID, 'Allow (dis-)arm without PIN:', 'EnableRemoteArm', remotearm); 62 250 html += '</table>'; 63 251 -
TabularUnified trunk/L_Powermax.lua ¶
r52 r53 59 59 local pmCommBypassOff = false; 60 60 local pmLang = "EN" 61 local pmRemoteArm = "false" 61 62 -- EVENT LOG -- 62 63 local pmEventLog = "" … … 542 543 local syncTime = (luup.variable_get(PANEL_SID, "AutoSyncTime", pmPanelDev) ~= "0") 543 544 if (syncTime == true) then 544 SyncTime() 545 local t = os.date('*t') 546 local year = t.year - 2000 547 local timePdu = string.char(t.sec, t.min, t.hour, t.day, t.month, year) 548 pmSendMessage("MSG_SETTIME", { time = timePdu }) 545 549 end 546 550 pmSendMessage("MSG_EXIT") -- Exit download mode … … 650 654 651 655 updateIfNeeded(PANEL_SID, "PluginVersion", PLUGIN_VERSION, pmPanelDev) 656 createIfNeeded(PANEL_SID, "MotionOffDelay", MotionOffDelay, pmPanelDev) 652 657 createIfNeeded(PANEL_SID, "PluginLanguage", "EN", pmPanelDev) 653 658 createIfNeeded(PANEL_SID, "PluginDebug", "0", pmPanelDev) … … 655 660 createIfNeeded(PANEL_SID, "AutoCreate", "1", pmPanelDev) 656 661 createIfNeeded(PANEL_SID, "AutoSyncTime", "1", pmPanelDev) 657 createIfNeeded(PANEL_SID, " MotionOffDelay", MotionOffDelay, pmPanelDev)662 createIfNeeded(PANEL_SID, "EnableRemoteArm", "false", pmPanelDev) 658 663 createIfNeeded(PANEL_SID, "DoorZones", "", pmPanelDev) 659 664 createIfNeeded(PANEL_SID, "MotionZones", "", pmPanelDev) … … 668 673 local forceStandard = (luup.variable_get(PANEL_SID, "ForceStandard", pmPanelDev) == "1") 669 674 pmLang = luup.variable_get(PANEL_SID, "PluginLanguage", pmPanelDev) 675 pmRemoteArm = luup.variable_get(PANEL_SID, "EnableRemoteArm", pmPanelDev) 670 676 671 677 if (luup.io.is_connected(pmPanelDev) == false) then … … 715 721 if (pin == "") or (pin == nil) or (string.len(pin) ~= 4) then 716 722 if (pmPowerlinkMode == true) then 717 return pmPincode_t[1] 723 return pmPincode_t[1], true 718 724 else 719 725 pmMessage("4 digit PIN needed", 2) 720 726 pinPDU = string.char(0x00, 0x00) 721 return pinPDU 727 return pinPDU, false 722 728 end 723 729 end 724 730 pinPDU = string.char(tonumber(string.sub(pin, 1, 2), 16)) .. string.char(tonumber(string.sub(pin, 3, 4), 16)) 725 731 726 return pinPDU 732 return pinPDU, false 727 733 end 728 734 … … 1493 1499 -- RequestArmMode 1494 1500 function RequestArmMode(state, pin) 1495 local pinPDU = pmGetPin(pin) 1496 local armPDU = pmArmMode_t[state] 1501 local pinPDU, isPL = pmGetPin(pin) 1502 local armCode = pmArmMode_t[state] 1503 local allowed = true 1497 1504 1498 1505 debug("RequestArmMode " .. (state or "N/A")) 1499 if (armPDU ~= nil) then 1500 pmSendMessage("MSG_ARM", { arm = string.char(armPDU), pin = pinPDU }) 1506 if (armCode ~= nil) then 1507 if (pmRemoteArm == "false") then 1508 allowed = false 1509 elseif (pmRemoteArm == "arm") then 1510 allowed = (bitw.band(armCode, 0x5) == 0x5) 1511 elseif (pmRemoteArm == "stay") then 1512 allowed = (bitw.band(armCode, 0x5) ~= 0) 1513 else 1514 allowed = true 1515 end 1516 if (allowed == true) or (isPL == false) then 1517 pmSendMessage("MSG_ARM", { arm = string.char(armCode), pin = pinPDU }) 1518 else 1519 pmMessage((state or "N/A") .. " not allowed without PIN.", 2) 1520 end 1501 1521 else 1502 1522 debug(string.format("RequestArmMode invalid state requested " .. (state or "N/A"))) … … 1509 1529 1510 1530 if (pmPowerlinkMode == true) then 1511 RequestArmMode(DetailedArmMode, pmPincode_t[1])1531 RequestArmMode(DetailedArmMode, "") 1512 1532 elseif (DetailedArmMode == "Stay") or (DetailedArmMode == "Armed") then 1513 1533 -- TODO: check system setting whether this mode is enabled … … 1634 1654 pmSendMessage("MSG_EVENTLOG", { pin = pmGetPin(PINCode) }) 1635 1655 end 1636 1637 -- SyncTime1638 function SyncTime()1639 debug("SyncTime")1640 local t = os.date('*t')1641 local year = t.year - 20001642 -- Does not work on all Powermax models1643 local timePdu = string.char(t.sec, t.min, t.hour, t.day, t.month, year)1644 pmSendMessage("MSG_SETTIME", { time = timePdu })1645 end1646 1647 -- EnableBypass1648 function EnableBypass(PINCode)1649 -- update bypass status before enabling1650 local bypassOn = 01651 for i = 1, 30 do1652 local child = findChild(pmPanelDev, string.format("Z%02d", i))1653 if (child ~= nil) then1654 local armed = tonumber(luup.variable_get(SECURITY_SID, "Armed", child) or 0)1655 debug(string.format("Updating bypass status for zone device %02d (%02d)", i, armed))1656 if (armed == 0) then1657 bypassOn = bypassOn + 2 ^ (i - 1) -- enable bypass1658 end1659 end1660 end1661 debug(string.format("Enable bypass setting is %08X", bypassOn))1662 local str = string.format("%08X", bypassOn)1663 local bypassStr = ""1664 for i = 0, 3 do1665 bypassStr = bypassStr .. string.char("0x" .. string.sub(str, 7 - i * 2, 8 - i * 2))1666 end1667 pmSendMessage("MSG_BYPASSEN", { pin = pmGetPin(PINCode), bypass = bypassStr })1668 end1669 1670 -- DisableBypass1671 function DisableBypass(PINCode)1672 -- update bypass status before disabling1673 local bypassOff = 01674 for i = 1, 30 do1675 local child = findChild(pmPanelDev, string.format("Z%02d", i))1676 if (child ~= nil) then1677 local armed = tonumber(luup.variable_get(SECURITY_SID, "Armed", child) or 0)1678 debug(string.format("Updating bypass status for zone device %02d (%02d)", i, armed))1679 if (armed == 1) then1680 bypassOff = bypassOff + 2 ^ (i - 1) -- disable bypass1681 end1682 end1683 end1684 debug(string.format("Enable bypass setting is %08X", bypassOff))1685 local str = string.format("%08X", bypassOff)1686 local bypassStr = ""1687 for i = 0, 3 do1688 bypassStr = bypassStr .. string.char("0x" .. string.sub(str, 7 - i * 2, 8 - i * 2))1689 end1690 pmSendMessage("MSG_BYPASSDIS", { pin = pmGetPin(PINCode), bypass = bypassStr })1691 end -
TabularUnified trunk/S_Powermax.xml ¶
r51 r53 3 3 <specVersion> 4 4 <major>1</major> 5 <minor> 2</minor>5 <minor>3</minor> 6 6 </specVersion> 7 7 <serviceStateTable> … … 53 53 </argumentList> 54 54 </action> 55 <action>56 <name>SyncTime</name>57 </action>58 <action>59 <name>EnableBypass</name>60 <argumentList>61 <argument>62 <name>PINCode</name>63 <direction>in</direction>64 <relatedStateVariable>ui4</relatedStateVariable>65 </argument>66 </argumentList>67 </action>68 <action>69 <name>DisableBypass</name>70 <argumentList>71 <argument>72 <name>PINCode</name>73 <direction>in</direction>74 <relatedStateVariable>ui4</relatedStateVariable>75 </argument>76 </argumentList>77 </action>78 55 </actionList> 79 56 </scpd>
Note: See TracChangeset
for help on using the changeset viewer.