- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
/D_VistaAlarmPanel1.json
r1 r3 30 30 "Variable": "PluginVersion", 31 31 "Top": 20, 32 "Left": 2 45,32 "Left": 250, 33 33 "Width": 110, 34 34 "Height": 20 … … 43 43 "Display": { 44 44 "Top": 100, 45 "Left": 50,45 "Left": 250, 46 46 "Width": 110, 47 47 "Height": 20 -
/D_VistaAlarmPartition1.json
r1 r3 1 1 { 2 "flashicon": "icons\/Door_Lock.swf", 3 "imgIconBody": "", 4 "imgIconDimmable": "", 5 "imgIconTurnable": "", 6 "imgIconMin": "pics\/devices\/Door_UNLOCKED.png", 7 "imgIconMax": "pics\/devices\/Door_LOCKED.png", 8 "halloIconsDir": "pics\/hallo", 9 "DisplayStatus": { 10 "Style": "label", 11 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 12 "Variable": "ArmMode", 13 "MinValue": "Disarmed", 14 "MaxValue": "Armed" 15 }, 16 "doc_url": { 17 "doc_language": 1, 18 "doc_manual": 1, 19 "doc_version": 1, 20 "doc_platform": 0, 21 "doc_page": "devices" 22 }, 23 "ToggleButton": 1, 24 "Tabs": [ 25 { 26 "Label": { 27 "lang_tag": "tabname_control", 28 "text": "Alarm Partition" 29 }, 30 "Position": "0", 31 "TabType": "flash", 32 "ControlGroup": [ 33 { 34 "id": "1", 35 "type": "info" 36 }, 37 { 38 "id": "2" 39 } 40 ], 41 "Control": [ 42 { 43 "ControlGroup": "1", 44 "ControlHeader": "1", 45 "ControlType": "label", 46 "Label": { 47 "lang_tag": "device_settings_page", 48 "text": "Status:" 49 }, 50 "Display": { 51 "Top": 0, 52 "Left": 50, 53 "Width": 200, 54 "Height": 20 55 } 56 }, 57 { 58 "ControlGroup": "1", 59 "ControlHeader": "1", 60 "ControlType": "variable", 61 "Display": { 62 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 63 "Variable": "DetailedArmMode", 64 "Top": 20, 65 "Left": 50, 66 "Width": 200, 67 "Height": 20 68 } 69 }, 70 { 71 "ControlGroup": "2", 72 "ControlHeader": "1", 73 "ControlType": "label", 74 "Label": { 75 "lang_tag": "device_settings_page", 76 "text": "Arming Options" 77 }, 78 "Display": { 79 "Top": 60, 80 "Left": 50, 81 "Width": 200, 82 "Height": 20 83 } 84 }, 85 { 86 "ControlGroup": "2", 87 "ControlPair": "1", 88 "ControlType": "input", 89 "ID": "PINCode", 90 "Display": { 91 "Top": 80, 92 "Left": 20, 93 "Width": 100, 94 "Height": 20 95 } 96 }, 97 { 98 "ControlGroup": "2", 99 "ControlPair": "1", 100 "ControlType": "button", 101 "Label": { 102 "lang_tag": "cmd_set", 103 "text": "Arm" 104 }, 105 "Display": { 106 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 107 "Variable": "ArmMode", 108 "Value": "Armed", 109 "Top": 80, 110 "Left": 130, 111 "Width": 50, 112 "Height": 20 113 }, 114 "Command": { 115 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 116 "Action": "RequestArmMode", 117 "Parameters": [ 118 { 119 "Name": "State", 120 "Value": "Armed" 121 }, 122 { 123 "Name": "PINCode", 124 "ID": "PINCode" 125 } 126 ] 127 } 128 }, 129 { 130 "ControlGroup": "2", 131 "ControlPair": "1", 132 "ControlType": "button", 133 "Label": { 134 "lang_tag": "cmd_set", 135 "text": "Stay" 136 }, 137 "Display": { 138 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 139 "Variable": "ArmMode", 140 "Value": "Stay", 141 "Top": 80, 142 "Left": 190, 143 "Width": 50, 144 "Height": 20 145 }, 146 "Command": { 147 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 148 "Action": "RequestArmMode", 149 "Parameters": [ 150 { 151 "Name": "State", 152 "Value": "Stay" 153 }, 154 { 155 "Name": "PINCode", 156 "ID": "PINCode" 157 } 158 ] 159 } 160 }, 161 { 162 "ControlGroup": "2", 163 "ControlPair": "1", 164 "ControlType": "button", 165 "Label": { 166 "lang_tag": "cmd_set", 167 "text": "Night" 168 }, 169 "Display": { 170 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 171 "Variable": "ArmMode", 172 "Value": "Night", 173 "Top": 80, 174 "Left": 250, 175 "Width": 50, 176 "Height": 20 177 }, 178 "Command": { 179 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 180 "Action": "RequestArmMode", 181 "Parameters": [ 182 { 183 "Name": "State", 184 "Value": "Night" 185 }, 186 { 187 "Name": "PINCode", 188 "ID": "PINCode" 189 } 190 ] 191 } 192 }, 193 { 194 "ControlGroup": "2", 195 "ControlPair": "1", 196 "ControlType": "button", 197 "Label": { 198 "lang_tag": "cmd_set", 199 "text": "Force" 200 }, 201 "Display": { 202 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 203 "Variable": "DetailedArmMode", 204 "Value": "Force", 205 "Top": 100, 206 "Left": 130, 207 "Width": 50, 208 "Height": 20 209 }, 210 "Command": { 211 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 212 "Action": "RequestArmMode", 213 "Parameters": [ 214 { 215 "Name": "State", 216 "Value": "Force" 217 }, 218 { 219 "Name": "PINCode", 220 "ID": "PINCode" 221 } 222 ] 223 } 224 }, 225 { 226 "ControlGroup": "2", 227 "ControlPair": "1", 228 "ControlType": "button", 229 "Label": { 230 "lang_tag": "cmd_set", 231 "text": "iStay" 232 }, 233 "Display": { 234 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 235 "Variable": "DetailedArmMode", 236 "Value": "StayInstant", 237 "Top": 100, 238 "Left": 190, 239 "Width": 50, 240 "Height": 20 241 }, 242 "Command": { 243 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 244 "Action": "RequestArmMode", 245 "Parameters": [ 246 { 247 "Name": "State", 248 "Value": "StayInstant" 249 }, 250 { 251 "Name": "PINCode", 252 "ID": "PINCode" 253 } 254 ] 255 } 256 }, 257 { 258 "ControlGroup": "2", 259 "ControlPair": "1", 260 "ControlType": "button", 261 "Label": { 262 "lang_tag": "cmd_set", 263 "text": "iNight" 264 }, 265 "Display": { 266 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 267 "Variable": "DetailedArmMode", 268 "Value": "NightInstant", 269 "Top": 100, 270 "Left": 250, 271 "Width": 50, 272 "Height": 20 273 }, 274 "Command": { 275 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 276 "Action": "RequestArmMode", 277 "Parameters": [ 278 { 279 "Name": "State", 280 "Value": "NightInstant" 281 }, 282 { 283 "Name": "PINCode", 284 "ID": "PINCode" 285 } 286 ] 287 } 288 }, 289 { 290 "ControlGroup": "2", 291 "ControlPair": "1", 292 "ControlType": "button", 293 "Label": { 294 "lang_tag": "cmd_set", 295 "text": "Disarm" 296 }, 297 "Display": { 298 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 299 "Variable": "ArmMode", 300 "Value": "Disarmed", 301 "Top": 120, 302 "Left": 130, 303 "Width": 50, 304 "Height": 20 305 }, 306 "Command": { 307 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 308 "Action": "RequestArmMode", 309 "Parameters": [ 310 { 311 "Name": "State", 312 "Value": "Disarmed" 313 }, 314 { 315 "Name": "PINCode", 316 "ID": "PINCode" 317 } 318 ] 319 } 320 }, 321 { 322 "ControlType": "label", 323 "Label": { 324 "lang_tag": "device_settings_page", 325 "text": "Panic Alarm Options" 326 }, 327 "Display": { 328 "Top": 160, 329 "Left": 50, 330 "Width": 200, 331 "Height": 20 332 } 333 }, 334 { 335 "ControlType": "button", 336 "Label": { 337 "lang_tag": "cmd_set", 338 "text": "Police" 339 }, 340 "Display": { 341 "Top": 180, 342 "Left": 50, 343 "Width": 75, 344 "Height": 20 345 }, 346 "Command": { 347 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 348 "Action": "RequestPanicMode", 349 "Parameters": [ 350 { 351 "Name": "State", 352 "Value": "Police" 353 } 354 ] 355 } 356 }, 357 { 358 "ControlType": "button", 359 "Label": { 360 "lang_tag": "cmd_set", 361 "text": "Medical" 362 }, 363 "Display": { 364 "Top": 180, 365 "Left": 135, 366 "Width": 75, 367 "Height": 20 368 }, 369 "Command": { 370 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 371 "Action": "RequestPanicMode", 372 "Parameters": [ 373 { 374 "Name": "State", 375 "Value": "Medical" 376 } 377 ] 378 } 379 }, 380 { 381 "ControlType": "button", 382 "Label": { 383 "lang_tag": "cmd_set", 384 "text": "Fire" 385 }, 386 "Display": { 387 "Top": 180, 388 "Left": 220, 389 "Width": 75, 390 "Height": 20 391 }, 392 "Command": { 393 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 394 "Action": "RequestPanicMode", 395 "Parameters": [ 396 { 397 "Name": "State", 398 "Value": "Fire" 399 } 400 ] 401 } 402 }, 403 { 404 "ControlType": "label", 405 "Label": { 406 "lang_tag": "device_settings_page", 407 "text": "Vendor Options" 408 }, 409 "Display": { 410 "Top": 220, 411 "Left": 50, 412 "Width": 200, 413 "Height": 20 414 } 415 }, 416 { 417 "ControlType": "variable", 418 "Display": { 419 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 420 "Variable": "VendorStatus", 421 "Top": 240, 422 "Left": 50, 423 "Width": 200, 424 "Height": 20 425 } 426 }, 427 { 428 "ControlType": "variable", 429 "Display": { 430 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 431 "Variable": "VendorStatusCode", 432 "Top": 260, 433 "Left": 50, 434 "Width": 200, 435 "Height": 20 436 } 437 }, 438 { 439 "ControlType": "variable", 440 "Display": { 441 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 442 "Variable": "VendorStatusData", 443 "Top": 280, 444 "Left": 50, 445 "Width": 200, 446 "Height": 20 447 } 448 } 449 ] 450 }, 451 { 452 "Label": { 453 "lang_tag": "notifications", 454 "text": "Notifications" 455 }, 456 "Position": "2", 457 "TabType": "javascript", 458 "ScriptName": "shared.js", 459 "Function": "device_notifications" 460 }, 461 { 462 "Label": { 463 "lang_tag": "logs", 464 "text": "Logs" 465 }, 466 "Position": "3", 467 "TabType": "javascript", 468 "ScriptName": "shared.js", 469 "Function": "device_logs" 470 }, 471 { 472 "Label": { 473 "lang_tag": "advanced", 474 "text": "Advanced" 475 }, 476 "Position": "4", 477 "TabType": "javascript", 478 "ScriptName": "shared.js", 479 "Function": "advanced_device" 480 } 481 ], 482 "DeviceType": "urn:schemas-micasaverde-com:device:AlarmPartition:2", 483 "eventList": { 484 "event_1": { 485 "label": "Armed state", 486 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 487 "argumentList" : { 488 "argument_1" : { 489 "dataType": "string", 490 "defaultValue": "Armed", 491 "allowedValueList" : { 492 "Yes" : "Armed", 493 "No" : "Disarmed" 494 }, 495 "name": "ArmMode", 496 "comparisson": "=", 497 "prefix": "Is Armed?", 498 "suffix": "" 499 } 500 } 501 }, 502 "event_2": { 503 "label": "Armed detailed state", 504 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 505 "argumentList" : { 506 "argument_1" : { 507 "dataType": "string", 508 "defaultValue": "Armed", 509 "allowedValueList" : { 510 "Disarmed" : "Disarmed", 511 "Armed" : "Armed", 512 "Stay" : "Stay", 513 "StayInstant" : "StayInstant", 514 "Night" : "Night", 515 "NightInstant" : "NightInstant", 516 "Force" : "Force", 517 "Ready" : "Ready", 518 "Vacation" : "Vacation", 519 "NotReady" : "NotReady", 520 "FailedToArm" : "FailedToArm", 521 "EntryDelay" : "EntryDelay", 522 "ExitDelay" : "ExitDelay" 523 }, 524 "name": "DetailedArmMode", 525 "comparisson": "=", 526 "prefix": "Armed state", 527 "suffix": "" 528 } 529 } 530 }, 531 "event_3": { 532 "label": "Alarm Active", 533 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 534 "argumentList" : { 535 "argument_1" : { 536 "dataType": "boolean", 537 "defaultValue": "Active", 538 "allowedValueList" : { 539 "Active" : "Active", 540 "NotActive" : "None" 541 }, 542 "name": "Alarm", 543 "comparisson": "=", 544 "prefix": "Is Active?", 545 "suffix": "" 546 } 547 } 548 }, 549 "event_4": { 550 "label": "A PIN Code is entered", 551 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 552 "argumentList" : { 553 "argument_1" : { 554 "dataType": "string", 555 "defaultValue": "", 556 "name": "LastUser", 557 "comparisson": "=", 558 "prefix": "User", 559 "suffix": "" 560 } 561 } 562 }, 563 "event_5": { 564 "label": "Vendor Status Code", 565 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 566 "argumentList" : { 567 "argument_1" : { 568 "dataType": "string", 569 "defaultValue": "", 570 "name": "VendorStatusCode", 571 "comparisson": "=", 572 "prefix": "Code", 573 "suffix": "" 574 } 575 } 576 } 577 }, 578 "sceneList": { 579 "group_1": { 580 "cmd_1": { 581 "label": "Set Partition ... (PIN)", 582 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 583 "action": "RequestArmMode", 584 "argumentList": { 585 "argument_1": { 586 "dataType": "string", 587 "defaultValue": "Disarmed", 588 "allowedValueList": { 589 "Disarmed" : "Disarmed", 590 "Armed" : "Armed", 591 "Stay" : "Stay", 592 "StayInstant" : "StayInstant", 593 "Night" : "Night", 594 "NightInstant" : "NightInstant", 595 "Force" : "Force", 596 "Vacation" : "Vacation" 597 }, 598 "name": "State", 599 "prefix": "State", 600 "suffix": "" 601 }, 602 "argument_2": { 603 "dataType": "string", 604 "defaultValue": "1234", 605 "prefix" : "PIN", 606 "suffix" : "0-99999999, (insecure)", 607 "name": "PINCode" 608 } 609 } 610 } 611 }, 612 "group_2": { 613 "cmd_1": { 614 "label": "Set Partition Disarmed (No PIN)", 615 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 616 "action": "RequestArmMode", 617 "arguments": { 618 "State": "Disarmed" 619 } 620 }, 621 "cmd_2": { 622 "label": "Set Partition Armed (No PIN)", 623 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 624 "action": "RequestArmMode", 625 "arguments": { 626 "State": "Armed" 627 } 628 }, 629 "cmd_3": { 630 "label": "Set Partition Stay (No PIN)", 631 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 632 "action": "RequestArmMode", 633 "arguments": { 634 "State": "Stay" 635 } 636 }, 637 "cmd_4": { 638 "label": "Set Partition StayInstant (No PIN)", 639 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 640 "action": "RequestArmMode", 641 "arguments": { 642 "State": "StayInstant" 643 } 644 }, 645 "cmd_5": { 646 "label": "Set Partition Night (No PIN)", 647 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 648 "action": "RequestArmMode", 649 "arguments": { 650 "State": "Night" 651 } 652 }, 653 "cmd_6": { 654 "label": "Set Partition NightInstant (No PIN)", 655 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 656 "action": "RequestArmMode", 657 "arguments": { 658 "State": "NightInstant" 659 } 660 }, 661 "cmd_7": { 662 "label": "Set Partition Force (No PIN)", 663 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 664 "action": "RequestArmMode", 665 "arguments": { 666 "State": "Force" 667 } 668 }, 669 "cmd_8": { 670 "label": "Set Partition Vacation (No PIN)", 671 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 672 "action": "RequestArmMode", 673 "arguments": { 674 "State": "Vacation" 675 } 676 } 677 }, 678 "group_3": { 679 "cmd_1": { 680 "label": "Request Medical Panic", 681 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 682 "action": "RequestPanicMode", 683 "arguments": { 684 "State": "Medical" 685 } 686 }, 687 "cmd_2": { 688 "label": "Request Police Panic", 689 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 690 "action": "RequestPanicMode", 691 "arguments": { 692 "State": "Police" 693 } 694 }, 695 "cmd_3": { 696 "label": "Request Fire Panic", 697 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 698 "action": "RequestPanicMode", 699 "arguments": { 700 "State": "Fire" 701 } 702 } 703 } 704 } 2 "flashicon": "icons\/Door_Lock.swf", 3 "imgIconBody": "", 4 "imgIconDimmable": "", 5 "imgIconTurnable": "", 6 "imgIconMin": "pics\/devices\/Door_UNLOCKED.png", 7 "imgIconMax": "pics\/devices\/Door_LOCKED.png", 8 "halloIconsDir": "pics\/hallo", 9 "DisplayStatus": { 10 "Style": "label", 11 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 12 "Variable": "ArmMode", 13 "MinValue": "Disarmed", 14 "MaxValue": "Armed" 15 }, 16 "doc_url": { 17 "doc_language": 1, 18 "doc_manual": 1, 19 "doc_version": 1, 20 "doc_platform": 0, 21 "doc_page": "devices" 22 }, 23 "ToggleButton": 1, 24 "Tabs": [ 25 { 26 "Label": { 27 "lang_tag": "tab_alarm_partition", 28 "text": "Alarm Partition" 29 }, 30 "Position": "0", 31 "TabType": "flash", 32 "ControlGroup": [ 33 { 34 "id": "1", 35 "type": "info" 36 } 37 ], 38 "Control": [ 39 { 40 "ControlGroup": "1", 41 "ControlHeader": "1", 42 "ControlType": "label", 43 "Label": { 44 "lang_tag": "label_status", 45 "text": "Status:" 46 }, 47 "Display": { 48 "Top": 20, 49 "Left": 285, 50 "Width": 75, 51 "Height": 20 52 } 53 }, 54 { 55 "ControlGroup": "1", 56 "ControlHeader": "1", 57 "ControlType": "variable", 58 "Display": { 59 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 60 "Variable": "DetailedArmMode", 61 "Top": 40, 62 "Left": 285, 63 "Width": 75, 64 "Height": 20 65 } 66 }, 67 { 68 "ControlType": "label", 69 "Label": { 70 "lang_tag": "device_settings_page", 71 "text": "PIN Code:" 72 }, 73 "Display": { 74 "Top": 80, 75 "Left": 70, 76 "Width": 75, 77 "Height": 20 78 } 79 }, 80 { 81 "ControlType": "input", 82 "ID": "PINCode", 83 "Display": { 84 "Top": 110, 85 "Left": 70, 86 "Width": 75, 87 "Height": 20 88 } 89 }, 90 { 91 "ControlType": "label", 92 "Label": { 93 "lang_tag": "label_arm_mode", 94 "text": "Arm Mode:" 95 }, 96 "Display": { 97 "Top": 80, 98 "Left": 285, 99 "Width": 75, 100 "Height": 20 101 } 102 }, 103 { 104 "ControlType": "button", 105 "Label": { 106 "lang_tag": "button_away", 107 "text": "Away" 108 }, 109 "Display": { 110 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 111 "Variable": "DetailedArmMode", 112 "Value": "Armed", 113 "Top": 100, 114 "Left": 200, 115 "Width": 75, 116 "Height": 20 117 }, 118 "Command": { 119 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 120 "Action": "RequestArmMode", 121 "Parameters": [ 122 { 123 "Name": "State", 124 "Value": "Armed" 125 }, 126 { 127 "Name": "PINCode", 128 "ID": "PINCode" 129 } 130 ] 131 } 132 }, 133 { 134 "ControlType": "button", 135 "Label": { 136 "lang_tag": "button_iAway", 137 "text": "iAway" 138 }, 139 "Display": { 140 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 141 "Variable": "DetailedArmMode", 142 "Value": "ArmedInstant", 143 "Top": 120, 144 "Left": 200, 145 "Width": 75, 146 "Height": 20 147 }, 148 "Command": { 149 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 150 "Action": "RequestArmMode", 151 "Parameters": [ 152 { 153 "Name": "State", 154 "Value": "ArmedInstant" 155 }, 156 { 157 "Name": "PINCode", 158 "ID": "PINCode" 159 } 160 ] 161 } 162 }, 163 { 164 "ControlType": "button", 165 "Label": { 166 "lang_tag": "button_stay", 167 "text": "Stay" 168 }, 169 "Display": { 170 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 171 "Variable": "DetailedArmMode", 172 "Value": "Stay", 173 "Top": 100, 174 "Left": 285, 175 "Width": 75, 176 "Height": 20 177 }, 178 "Command": { 179 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 180 "Action": "RequestArmMode", 181 "Parameters": [ 182 { 183 "Name": "State", 184 "Value": "Stay" 185 }, 186 { 187 "Name": "PINCode", 188 "ID": "PINCode" 189 } 190 ] 191 } 192 }, 193 { 194 "ControlType": "button", 195 "Label": { 196 "lang_tag": "button_iStay", 197 "text": "iStay" 198 }, 199 "Display": { 200 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 201 "Variable": "DetailedArmMode", 202 "Value": "StayInstant", 203 "Top": 120, 204 "Left": 285, 205 "Width": 75, 206 "Height": 20 207 }, 208 "Command": { 209 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 210 "Action": "RequestArmMode", 211 "Parameters": [ 212 { 213 "Name": "State", 214 "Value": "StayInstant" 215 }, 216 { 217 "Name": "PINCode", 218 "ID": "PINCode" 219 } 220 ] 221 } 222 }, 223 { 224 "ControlType": "button", 225 "Label": { 226 "lang_tag": "button_night", 227 "text": "Night" 228 }, 229 "Display": { 230 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 231 "Variable": "DetailedArmMode", 232 "Value": "Night", 233 "Top": 100, 234 "Left": 370, 235 "Width": 75, 236 "Height": 20 237 }, 238 "Command": { 239 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 240 "Action": "RequestArmMode", 241 "Parameters": [ 242 { 243 "Name": "State", 244 "Value": "Night" 245 }, 246 { 247 "Name": "PINCode", 248 "ID": "PINCode" 249 } 250 ] 251 } 252 }, 253 { 254 "ControlType": "button", 255 "Label": { 256 "lang_tag": "button_disarm", 257 "text": "Disarm" 258 }, 259 "Display": { 260 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 261 "Variable": "ArmMode", 262 "Value": "Disarmed", 263 "Top": 120, 264 "Left": 370, 265 "Width": 75, 266 "Height": 20 267 }, 268 "Command": { 269 "Service": "urn:micasaverde-com:serviceId:AlarmPartition2", 270 "Action": "RequestArmMode", 271 "Parameters": [ 272 { 273 "Name": "State", 274 "Value": "Disarmed" 275 }, 276 { 277 "Name": "PINCode", 278 "ID": "PINCode" 279 } 280 ] 281 } 282 }, 283 { 284 "ControlType": "label", 285 "Label": { 286 "lang_tag": "label_lettered_keys", 287 "text": "Lettered Keys" 288 }, 289 "Display": { 290 "Top": 160, 291 "Left": 285, 292 "Width": 75, 293 "Height": 20 294 } 295 }, 296 { 297 "ControlType": "button", 298 "Label": { 299 "lang_tag": "button_a_key", 300 "text": "A" 301 }, 302 "Display": { 303 "Top": 180, 304 "Left": 158, 305 "Width": 75, 306 "Height": 20 307 }, 308 "Command": { 309 "Service": "urn:micasaverde-com:serviceId:VistaAlarmPanel1", 310 "Action": "RequestLetteredKeyPress", 311 "Parameters": [ 312 { 313 "Name": "Key", 314 "Value": "A" 315 }, 316 { 317 "Name": "PINCode", 318 "ID": "PINCode" 319 } 320 ] 321 } 322 }, 323 { 324 "ControlType": "button", 325 "Label": { 326 "lang_tag": "button_b_key", 327 "text": "B" 328 }, 329 "Display": { 330 "Top": 180, 331 "Left": 243, 332 "Width": 75, 333 "Height": 20 334 }, 335 "Command": { 336 "Service": "urn:micasaverde-com:serviceId:VistaAlarmPanel1", 337 "Action": "RequestLetteredKeyPress", 338 "Parameters": [ 339 { 340 "Name": "Key", 341 "Value": "B" 342 }, 343 { 344 "Name": "PINCode", 345 "ID": "PINCode" 346 } 347 ] 348 } 349 }, 350 { 351 "ControlType": "button", 352 "Label": { 353 "lang_tag": "button_c_key", 354 "text": "C" 355 }, 356 "Display": { 357 "Top": 180, 358 "Left": 328, 359 "Width": 75, 360 "Height": 20 361 }, 362 "Command": { 363 "Service": "urn:micasaverde-com:serviceId:VistaAlarmPanel1", 364 "Action": "RequestLetteredKeyPress", 365 "Parameters": [ 366 { 367 "Name": "Key", 368 "Value": "C" 369 }, 370 { 371 "Name": "PINCode", 372 "ID": "PINCode" 373 } 374 ] 375 } 376 }, 377 { 378 "ControlType": "button", 379 "Label": { 380 "lang_tag": "button_d_key", 381 "text": "D" 382 }, 383 "Display": { 384 "Top": 180, 385 "Left": 413, 386 "Width": 75, 387 "Height": 20 388 }, 389 "Command": { 390 "Service": "urn:micasaverde-com:serviceId:VistaAlarmPanel1", 391 "Action": "RequestLetteredKeyPress", 392 "Parameters": [ 393 { 394 "Name": "Key", 395 "Value": "D" 396 }, 397 { 398 "Name": "PINCode", 399 "ID": "PINCode" 400 } 401 ] 402 } 403 } 404 ] 405 }, 406 { 407 "Label": { 408 "lang_tag": "notifications", 409 "text": "Notifications" 410 }, 411 "Position": "2", 412 "TabType": "javascript", 413 "ScriptName": "shared.js", 414 "Function": "device_notifications" 415 }, 416 { 417 "Label": { 418 "lang_tag": "logs", 419 "text": "Logs" 420 }, 421 "Position": "3", 422 "TabType": "javascript", 423 "ScriptName": "shared.js", 424 "Function": "device_logs" 425 }, 426 { 427 "Label": { 428 "lang_tag": "advanced", 429 "text": "Advanced" 430 }, 431 "Position": "4", 432 "TabType": "javascript", 433 "ScriptName": "shared.js", 434 "Function": "advanced_device" 435 } 436 ], 437 "DeviceType": "urn:schemas-micasaverde-com:device:ElkAlarmPartition:1", 438 "eventList": { 439 "event_1": { 440 "label": "Armed state", 441 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 442 "argumentList" : { 443 "argument_1" : { 444 "dataType": "string", 445 "defaultValue": "Armed", 446 "allowedValueList" : { 447 "Yes" : "Armed", 448 "No" : "Disarmed" 449 }, 450 "name": "ArmMode", 451 "comparisson": "=", 452 "prefix": "Is Armed?", 453 "suffix": "" 454 } 455 } 456 }, 457 "event_2": { 458 "label": "Armed detailed state", 459 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 460 "argumentList" : { 461 "argument_1" : { 462 "dataType": "string", 463 "defaultValue": "Armed", 464 "allowedValueList" : { 465 "Disarmed" : "Disarmed", 466 "Away" : "Away", 467 "AwayInstant" : "AwayInstant", 468 "Stay" : "Stay", 469 "StayInstant" : "StayInstant", 470 "Night" : "Night", 471 "NightInstant" : "NightInstant", 472 "Force" : "Force", 473 "Ready" : "Ready", 474 "Vacation" : "Vacation", 475 "NotReady" : "NotReady", 476 "FailedToArm" : "FailedToArm", 477 "EntryDelay" : "EntryDelay", 478 "ExitDelay" : "ExitDelay" 479 }, 480 "name": "DetailedArmMode", 481 "comparisson": "=", 482 "prefix": "Armed state", 483 "suffix": "" 484 } 485 } 486 }, 487 "event_3": { 488 "label": "Alarm Active", 489 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 490 "argumentList" : { 491 "argument_1" : { 492 "dataType": "boolean", 493 "defaultValue": "Active", 494 "allowedValueList" : { 495 "Active" : "Active", 496 "NotActive" : "None" 497 }, 498 "name": "Alarm", 499 "comparisson": "=", 500 "prefix": "Is Active?", 501 "suffix": "" 502 } 503 } 504 } 505 }, 506 "sceneList": { 507 "group_1": { 508 "cmd_1": { 509 "label": "Set Partition ... (PIN)", 510 "serviceId": "urn:micasaverde-com:serviceId:AlarmPartition2", 511 "action": "RequestArmMode", 512 "argumentList": { 513 "argument_1": { 514 "dataType": "string", 515 "defaultValue": "Disarmed", 516 "allowedValueList": { 517 "Disarmed" : "Disarmed", 518 "Away" : "Away", 519 "AwayInstant" : "AwayInstant", 520 "Stay" : "Stay", 521 "StayInstant" : "StayInstant", 522 "Night" : "Night", 523 "NightInstant" : "NightInstant", 524 "Force" : "Force", 525 "Vacation" : "Vacation" 526 }, 527 "name": "State", 528 "prefix": "State", 529 "suffix": "" 530 }, 531 "argument_2": { 532 "dataType": "string", 533 "defaultValue": "1234", 534 "allowedValueRange": { 535 "minimum": "0", 536 "maximum": "999999999999" 537 }, 538 "prefix" : "PIN", 539 "suffix" : "0-99999999, (insecure)", 540 "name": "PINCode" 541 } 542 } 543 } 544 } 545 } 705 546 } -
/S_VistaAlarmPanel1.xml
r1 r3 15 15 </stateVariable> 16 16 <stateVariable> 17 <name>StorePinInFile</name>18 <datatype>boolean</datatype>19 </stateVariable>20 <stateVariable>21 17 <name>NumPartitions</name> 22 18 <datatype>ui1</datatype> … … 25 21 <actionList> 26 22 <action> 23 <name>RequestLetteredKeyPress</name> 24 <argumentList> 25 <argument> 26 <name>Key</name> 27 <direction>in</direction> 28 <relatedStateVariable>string</relatedStateVariable> 29 </argument> 30 <argument> 31 <name>PINCode</name> 32 <direction>in</direction> 33 <relatedStateVariable>string</relatedStateVariable> 34 </argument> 35 </argumentList> 36 </action> 37 <action> 27 38 <name>ClearTask</name> 28 39 <argumentList></argumentList> -
/S_AlarmPartition2.xml
r1 r3 50 50 Disarmed - The Partition is disarmed. 51 51 Armed - The Partition is currently armed, or in an "away" state. 52 ArmedInstant - The Partition is in an "away" state, Entry doors trigger Alarm immediately. 52 53 Stay - The Partition is in an "at-home" state, delays are permitted on Entry doors. 53 54 StayInstant - The Partition is in an "at-home" state, Entry doors trigger Alarm immediately. … … 70 71 <allowedValue>Disarmed</allowedValue> 71 72 <allowedValue>Armed</allowedValue> 72 <allowedValue>AwayInstant</allowedValue>73 <allowedValue>ArmedInstant</allowedValue> 73 74 <allowedValue>Stay</allowedValue> 74 75 <allowedValue>StayInstant</allowedValue> … … 258 259 status. 259 260 260 The PIN Code may have a blank value. If the PIN Code is blank, or not-passed if a261 particular UPnP platform supports that, then the request should be interpreted the262 same as if the corresponding RequestQuickArmMode call had been made.263 264 261 The following values must be accepted for the Arming mode, but Vendor specific values 265 262 may be input as well. If a particular Vendor doesn't support the mode requested … … 271 268 Disarmed - The Partition is disarmed. 272 269 Armed - The Partition is currently armed, or in an "away" mode. 270 ArmedInstant - The Partition is in an "away" state, Entry doors trigger Alarm immediately. 273 271 Stay - The Partition is in an "at-home" mode, delays are permitted on Entry doors. 274 272 StayInstant - The Partition is in an "at-home" mode, Entry doors trigger Alarm immediately. … … 289 287 <name>PINCode</name> 290 288 <direction>in</direction> 291 <relatedStateVariable> string</relatedStateVariable>289 <relatedStateVariable>ui4</relatedStateVariable> 292 290 </argument> 293 291 </argumentList> … … 306 304 Disarmed - The Partition is disarmed. 307 305 Armed - The Partition is currently armed, or in an "away" mode. 306 ArmedInstant - The Partition is in an "away" state, Entry doors trigger Alarm immediately. 308 307 Stay - The Partition is in an "at-home" mode, delays are permitted on Entry doors. 309 308 StayInstant - The Partition is in an "at-home" mode, Entry doors trigger Alarm immediately. -
/D_VistaAlarmPartition1.xml
r1 r3 15 15 <SCPDURL>S_AlarmPartition2.xml</SCPDURL> 16 16 </service> 17 <service> 18 <serviceType>urn:schemas-micasaverde-com:service:VistaAlarmPanel:1</serviceType> 19 <serviceId>urn:micasaverde-com:serviceId:VistaAlarmPanel1</serviceId> 20 <SCPDURL>S_VistaAlarmPanel1.xml</SCPDURL> 21 </service> 17 22 </serviceList> 18 23 </device> -
/I_VistaAlarmPanel1.xml
r1 r3 46 46 <action> 47 47 <serviceId>urn:micasaverde-com:serviceId:VistaAlarmPanel1</serviceId> 48 <name> StorePinCode</name>48 <name>RequestLetteredKeyPress</name> 49 49 <run> 50 vistaPlugin.storePinCode (lul_device, lul_settings.PinCode) 51 </run> 52 </action> 53 <action> 54 <serviceId>urn:micasaverde-com:serviceId:VistaAlarmPanel1</serviceId> 55 <name>ClearPinCode</name> 56 <run> 57 vistaPlugin.clearPinCode (lul_device) 50 vistaPlugin.requestLetteredKeyPress (lul_device, lul_settings.Key, lul_settings.PINCode) 58 51 </run> 59 52 </action> -
/L_VistaAlarmPanel1.lua
r1 r3 5 5 6 6 -- Constants 7 local VERSION = "0.1 Indev" 8 local PIN_FILE = "/tmp/vistapf" 7 local VERSION = "1.0 Alpha" 9 8 10 9 -- Defaults … … 13 12 14 13 local NUM_PARTITIONS = 1 14 15 local EUC_CNT = 3 -- After a lettered key is pressed, if the 'Enter User Code' message doesn't appear 16 -- within this number of messages, then that key wasn't a macro, 17 -- which means that it didn't require the user code. 15 18 16 19 local SID = { … … 29 32 local lug_device = nil 30 33 local g_taskHandle = -1 34 local g_pinCode = nil -- Used when a lettered key is pressed. 35 local g_eucCnt = EUC_CNT -- The actual counter. 31 36 32 37 local g_partitions = { 33 38 -- device 34 -- pinCode35 39 -- armMode 36 40 -- detailedArmMode … … 41 45 42 46 43 local arming Keys = {47 local armingCommands = { 44 48 ["Disarmed"] = "1", -- "DISARMED" 45 49 ["Armed"] = "2", -- "AWAY" 46 ["A wayInstant"] = "4", -- "MAXIMUM"50 ["ArmedInstant"] = "4", -- "MAXIMUM" 47 51 ["Stay"] = "3", -- "STAY" 48 52 ["StayInstant"] = "7", -- "INSTANT" … … 53 57 } 54 58 59 local keyCommands = { 60 ["A"] = string.char (1), 61 ["B"] = string.char (2), 62 ["C"] = string.char (3), 63 ["D"] = string.char (4) 64 } 55 65 56 66 ------------------------------ Generic Utilities ------------------------------ … … 135 145 136 146 137 local function getPartitionNumber (device) 138 for k, v in pairs (g_partitions) do 139 if (device == v.device) then 140 return k 141 end 147 local function getPartitionNumber (id) 148 if (type (id) == "number") then -- The 'id' is the device number. 149 for k, v in pairs (g_partitions) do 150 if (id == v.device) then 151 return k 152 end 153 end 154 else -- The 'id' is the device altid. 155 local partNo = id:match ("vista_partition_(%d+)") 156 return tostring (partNo) 142 157 end 143 158 … … 146 161 147 162 148 local function extractPartitionNumber (altid)149 local partition = altid:match ("vista_partition_(%d+)")150 debug ("(extractPartitionNumber) Extracted partition number = " .. tostring (partition) .. ".")151 152 return partition153 end154 155 156 163 ---------------------------- Action Implementations --------------------------- 157 164 158 165 159 function storePinCode (device, pinCode) 160 debug ("(storePinCode)") 161 162 -- Check PIN code. 163 if (not pinCode or not pinCode:match ("^%d%d%d%d$")) then 164 log ("(storePinCode) ERROR: Invalid PIN code.") 165 task ("Invalid PIN code.", TASK.ERROR) 166 return false 167 end 166 function requestArmMode (device, armMode, pinCode) 167 168 debug (string.format ("(requestArmMode) device=%d, armMode='%s'", device, armMode)) 168 169 169 170 -- Find the partition number. … … 174 175 return false 175 176 end 176 177 g_partitions[partNo].pinCode = pinCode 178 179 -- Store the PIN code in file. 180 local storePinInFile = luup.variable_get (SID.PANEL, "StorePinInFile", lug_device) or STORE_PIN_DEFAULT 181 if (storePinInFile == "1") then 182 local pinCodes = {} 183 for line in io.lines (PIN_FILE) do 184 table.insert (pinCodes, line:match ("%d+")) 185 end 186 pinCodes[partNo] = pinCode 187 io.output (PIN_FILE) 188 for _, v in ipairs (pinCodes) do 189 io.write (v .. "\n") 190 end 191 io.close() 192 end 193 194 debug ("(storePinCode) PIN code stored for partition " .. partNo .. ".") 195 return true 196 end 197 198 199 function clearPinCode (device) 200 debug ("(clearPinCode)") 201 202 -- Find the partition number. 203 local partNo = getPartitionNumber (device) 204 if (not partNo) then 205 log ("(requestArmMode) ERROR: Found unexpected child.") 206 task ("Found unexpected child.", TASK.ERROR) 207 return false 208 end 209 210 g_partitions[partNo].pinCode = nil 211 212 -- Clear the PIN code from the file. 213 local pinCodes = {} 214 for line in io.lines (PIN_FILE) do 215 table.insert (pinCodes, line:match ("%d+")) 216 end 217 pinCodes[partNo] = "0" 218 io.output (PIN_FILE) 219 for _, v in ipairs (pinCodes) do 220 io.write (v .. "\n") 221 end 222 io.close() 223 end 224 225 226 function requestArmMode (device, armMode, pinCode) 227 228 debug (string.format ("(requestArmMode) device=%d, armMode='%s'", device, armMode)) 229 230 -- Find the partition number. 231 local partNo = getPartitionNumber (device) 232 if (not partNo) then 233 log ("(requestArmMode) ERROR: Found unexpected child.") 234 task ("Found unexpected child.", TASK.ERROR) 235 return false 236 end 237 238 local armingCommand = "" 177 debug ("(requestArmMode) partNo=" .. partNo) 178 179 local command = "" 239 180 240 181 if (pinCode == "") then 241 182 pinCode = nil 242 183 end 243 pinCode = pinCode or g_partitions[partNo].pinCode244 184 if (not pinCode) then -- Attempt a quick arm. 245 185 debug ("(requestArmMode) Attempt quick arm. Current arm mode: '" .. tostring (g_partitions[partNo].detailedArmMode) .. "'") 246 186 if (armMode == "Disarmed") then 247 187 log ("(requestArmMode) ERROR: Cannot disarm without PIN code.") 248 task ("Cannot disarm without PIN code." )188 task ("Cannot disarm without PIN code.", TASK.ERROR) 249 189 return false 250 190 end 251 armingCommand = "#" .. armingKeys[armMode]191 command = "#" .. armingCommands[armMode] 252 192 else -- Attempt a normal arm. 253 193 debug ("(requestArmMode) Arm with PIN code. Current arm mode: '" .. tostring (g_partitions[partNo].detailedArmMode) .. "'") … … 259 199 return false 260 200 end 261 262 armingCommand = pinCode .. armingKeys[armMode] 263 end 264 265 debug ("(requestArmMode) armingCommand='" .. armingCommand .. "'") 266 luup.io.write (armingCommand) 267 end 268 269 270 function requestPanicMode (device, panicMode) 201 command = pinCode .. "*" .. partNo -- GOTO <partNo> command. 202 command = command .. pinCode .. armingCommands[armMode] 203 end 204 205 debug ("(requestArmMode) command='" .. command .. "'") 206 luup.io.write (command) 207 208 return true 209 end 210 211 212 function requestLetteredKeyPress (device, key, pinCode) 213 214 debug (string.format ("(requestLetteredKeyPress) device=%d, key='%s'", device, key)) 215 216 -- Check if the PIN code exists and is valid. 217 if (not pinCode) then 218 log ("(requestLetteredKeyPress) ERROR: Cannot use macro key without PIN code.") 219 task ("Cannot use macro key without PIN code.", TASK.ERROR) 220 return false 221 elseif (not pinCode:match ("^%d%d%d%d$")) then 222 log ("(requestLetteredKeyPress) ERROR: Invalid PIN code.") 223 task ("Invalid PIN code.", TASK.ERROR) 224 return false 225 end 226 227 -- Find the partition number. 228 local partNo = getPartitionNumber (device) 229 if (not partNo) then 230 log ("(requestLetteredKeyPress) ERROR: Found unexpected child.") 231 task ("Found unexpected child.", TASK.ERROR) 232 return false 233 end 234 debug ("(requestLetteredKeyPress) partNo=" .. partNo) 235 236 local command = pinCode .. "*" .. partNo 237 command = command .. keyCommands[key] 238 g_pinCode = pinCode 239 240 debug ("(requestLetteredKeyPress) command='" .. command .. "'") 241 luup.io.write (command) 242 243 return true 271 244 end 272 245 … … 276 249 277 250 278 ----------------- Message Processing: Function Implementations ---------------- 279 280 281 local function getArmMode (sections) 282 -- Get partition number. 283 local partNo = tonumber (sections[4]:match ("^%d") or 1) 284 251 function requestPanicMode (device, state) 252 log ("(requestPanicMode) ERROR: Action not implemented.") 253 task ("RequestPanicMode not implemented.", TASK.ERROR) 254 return false 255 end 256 257 258 ------------------------------ Message Processing ----------------------------- 259 260 261 local function updateArmMode (partNo, textMessage) 285 262 -- Split the string in words. 286 263 local words = {} 287 for word in sections[4]:gmatch ("%a+") do264 for word in textMessage:gmatch ("%a+") do 288 265 table.insert (words, word) 289 266 end … … 292 269 if (words[1] == "DISARMED") then 293 270 g_partitions[partNo].armMode = "Disarmed" 294 if ( sections[4]:find ("Ready to Arm", 1, true)) then271 if (textMessage:find ("Ready to Arm", 1, true)) then 295 272 g_partitions[partNo].detailedArmMode = "Ready" 296 273 else … … 298 275 end 299 276 elseif (words[1] == "ARMED") then 300 if ( sections[4]:find ("You may exit now", 1, true)) then277 if (textMessage:find ("You may exit now", 1, true)) then 301 278 g_partitions[partNo].detailedArmMode = "ExitDelay" 302 279 else … … 309 286 g_partitions[partNo].detailedArmMode = "StayInstant" 310 287 elseif (words[2] == "MAXIMUM") then 311 g_partitions[partNo].detailedArmMode = "A wayInstant"288 g_partitions[partNo].detailedArmMode = "ArmedInstant" 312 289 end 313 290 end … … 315 292 g_partitions[partNo].armMode = "Armed" 316 293 g_partitions[partNo].detailedArmMode = "Night" 294 elseif (textMessage:find ("FAULT", 1, true)) then 295 -- There are faulted zones, so the partition is not ready to arm. 296 g_partitions[partNo].armMode = "Disarmed" 297 g_partitions[partNo].detailedArmMode = "NotReady" 317 298 end 318 299 319 300 local currentArmMode = getPartitionState (partNo, "ArmMode") or "nil" 320 if (g_partitions[partNo].armMode ~= currentArmMode) then321 debug (string.format ("(getArmMode) current ArmMode = %s, new ArmMode = %s", currentArmMode, g_partitions[partNo].armMode))301 if (g_partitions[partNo].armMode and g_partitions[partNo].armMode ~= currentArmMode) then 302 debug (string.format ("(getArmMode) current ArmMode = '%s', new ArmMode = '%s'", currentArmMode, g_partitions[partNo].armMode)) 322 303 setPartitionState (partNo, "ArmMode", g_partitions[partNo].armMode) 323 304 end 324 305 325 306 local currentDetailedArmMode = getPartitionState (partNo, "DetailedArmMode") or "nil" 326 if (g_partitions[partNo].detailedArmMode ~= currentDetailedArmMode) then327 debug (string.format ("(getArmMode) current DetailedArmMode = %s, new DetailedArmMode = %s", currentDetailedArmMode, g_partitions[partNo].detailedArmMode))307 if (g_partitions[partNo].detailedArmMode and g_partitions[partNo].detailedArmMode ~= currentDetailedArmMode) then 308 debug (string.format ("(getArmMode) current DetailedArmMode = '%s', new DetailedArmMode = '%s'", currentDetailedArmMode, g_partitions[partNo].detailedArmMode)) 328 309 setPartitionState (partNo, "DetailedArmMode", g_partitions[partNo].detailedArmMode) 329 310 end 330 end 331 332 333 ------------------------------ Message Processing ----------------------------- 311 312 return true 313 end 314 315 316 local function getAddressBitMask (binaryMessageData) 317 local addressByte = binaryMessageData:match ("^%x%x%x%x%x%x(%x%x).*") 318 addressByte = tonumber (addressByte, 16) 319 local bitMask = {0, 0, 0, 0, 0, 0, 0, 0} 320 local i = 1 321 while (addressByte > 0) do 322 bitMask[i] = addressByte % 2 323 addressByte = math.floor (addressByte / 2) 324 i = i + 1 325 end 326 327 debug (string.format ("(getAddressBitMask) addressByte=%d, bitMask=%d%d%d%d%d%d%d%d", addressByte, bitMask[8], bitMask[7], bitMask[6], bitMask[5], bitMask[4], bitMask[3], bitMask[2], bitMask[1])) 328 return bitMask 329 end 330 331 332 local function getTargetPartitions (sections) 333 -- Get partition number from the text message. 334 local partNo = sections[4]:match ("^%d") 335 if (partNo) then 336 debug ("(getTargetPartitions) partNo=" .. partNo) 337 return tonumber (partNo) 338 end 339 340 -- Get the partition number from the address byte. 341 local targetPartitions = {} 342 local bitMask = getAddressBitMask (sections[3]) 343 for i = 1, 8 do 344 if (bitMask[i] == 1) then 345 table.insert (targetPartitions, i) 346 end 347 end 348 349 debug ("(getTargetPartitions) targetPartitions=" .. table.concat (targetPartitions, ",")) 350 if (#targetPartitions == 1) then 351 return targetPartitions[1] 352 end 353 354 return targetPartitions 355 end 334 356 335 357 … … 343 365 344 366 local sections = {} 345 sections[1], sections[2], sections[3], sections[4] = data:match ('%[([%d%-]+)%],(%d+),%[(%x+)%],"(.+)"') 346 for i, v in ipairs (sections) do 347 debug (string.format ("(processIncoming) Section %d: %s", i, tostring (v))) 348 end 349 350 getArmMode (sections) 367 sections[1], sections[2], sections[3], sections[4] = data:match ('%[([%d%-]+)%],(%x+),%[(%x+)%],"(.+)"') 368 for i = 1, 4 do 369 debug (string.format ("(processIncoming) Section %d: %s", i, tostring (sections[i]))) 370 end 371 372 -- Get the partitions this message is for. 373 local targetPart = getTargetPartitions (sections) 374 375 -- Process data. 376 if (g_pinCode) then -- We previously pressed a letterd key. 377 if (sections[4]:find ("Enter User Code", 1, true)) then -- The lettered key was a macro key. 378 debug ("(processIncoming) g_eucCnt=" .. (g_eucCnt - 1) .. ", sending user code...") 379 luup.io.write (g_pinCode) 380 g_pinCode = nil 381 g_eucCnt = EUC_CNT 382 else 383 g_eucCnt = g_eucCnt - 1 384 debug ("(processIncoming) g_eucCnt=" .. g_eucCnt) 385 if (g_eucCnt == 0) then 386 g_pinCode = nil 387 g_eucCnt = EUC_CNT 388 end 389 end 390 else -- Chances are this message is an alarm status report. 391 if (type (targetPart) == "number") then -- Arming status messages are only for one partition. 392 updateArmMode (targetPart, sections[4]) 393 end 394 end 351 395 352 396 return true … … 368 412 for k, v in pairs (luup.devices) do 369 413 if (v.device_num_parent == lug_device) then 370 local partNo = extractPartitionNumber (v.id)414 local partNo = getPartitionNumber (v.id) 371 415 if (partNo) then 372 416 debug (string.format ("(getChildDevices) Partition %s device = %d", partNo, k)) 373 417 g_partitions[tonumber (partNo)] = {device = k} 374 418 else 375 debug (string.format ("(getChildDevices) Found unexpected child: device #%d, id=%s", k, v.id))419 debug (string.format ("(getChildDevices) Found unexpected child: device #%d, id=%s", k, tostring (v.id))) 376 420 end 377 421 end … … 412 456 ]] 413 457 414 -- Initialize the StorePinInFile variable with a default value.415 local storePinInFile = luup.variable_get (SID.PANEL, "StorePinInFile", lug_device)416 if (not storePinInFile or storePinInFile == "") then417 luup.variable_set (SID.PANEL, "StorePinInFile", STORE_PIN_DEFAULT, lug_device)418 end419 420 458 -- Initialize the NumPartitions variable with a default value. Get the number of partitions. 421 459 local nPartitions = luup.variable_get (SID.PANEL, "NumPartitions", lug_device) … … 433 471 getChildDevices() 434 472 435 -- Create the PIN codes file.436 local pinCodes = {}437 for i = 1, NUM_PARTITIONS do438 pinCodes[i] = "0"439 end440 io.output (PIN_FILE)441 for _, v in ipairs (pinCodes) do442 io.write (v .. "\n")443 end444 io.close()445 446 473 debug ("(Vista Plugin Startup) SUCCESS: Startup successful.") 447 474 return true, "Startup successful.", "Vista Alarm Panel"
Note: See TracChangeset
for help on using the changeset viewer.