node-red-contrib-homebridge-automation 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/HAP-NodeRed.html CHANGED
@@ -1,20 +1,41 @@
1
1
  <script type="text/x-red" data-template-name="hb-conf">
2
2
  <div class="form-row">
3
3
  <label for="node-config-input-username"><i class="icon-tag"></i> Pin</label>
4
- <input type="text" id="node-config-input-username">
5
- </div>
4
+ <input type="text" id="node-config-input-username" placeholder="031-45-154">
5
+ </div>
6
+ <div class="form-row">
7
+ <label for="node-config-input-macAddress"><i class="icon-wifi"></i> MAC Address (optional)</label>
8
+ <input type="text" id="node-config-input-macAddress" placeholder="00:00:00:A1:2B:CC">
9
+ </div>
6
10
  </script>
7
11
 
8
12
  <script type="text/x-red" data-help-name="hb-conf">
9
13
  <p>This allows you to register your homebridge PIN</p>
10
-
11
14
  </script>
12
15
 
13
16
  <script type="text/javascript">
14
17
  RED.nodes.registerType('hb-conf', {
15
18
  category: 'config',
16
19
  defaults: {
17
- username: {}
20
+ username: {
21
+ value: '',
22
+ validate: function (v) {
23
+ if (v === '') {
24
+ return true;
25
+ }
26
+ return /^\d{3}-\d{2}-\d{3}$/.test(v);
27
+ },
28
+ },
29
+ macAddress: {
30
+ value: '',
31
+ validate: function (v) {
32
+ if (v === '') {
33
+ return true;
34
+ }
35
+ return /^([\da-fA-F]{2}:){5}[\da-fA-F]{2}$/.test(v);
36
+ },
37
+ required: false
38
+ },
18
39
  },
19
40
  credentials: {
20
41
  password: {
@@ -26,8 +47,8 @@
26
47
  return this.username;
27
48
  },
28
49
  oneditsave: function() {
29
- var node = this;
30
- var user = $('#node-config-input-PIN').val();
50
+ // var node = this;
51
+ // var user = $('#node-config-input-PIN').val();
31
52
  // var pass = $('#node-config-input-password').val();
32
53
  // console.log("pass: ", pass);
33
54
  // if (pass != '_PWD_') {
@@ -36,13 +57,13 @@
36
57
  // user: user,
37
58
  // pass: pass
38
59
  // }
39
- // $.ajax({
40
- // data: JSON.stringify(account),
41
- // url: 'alexa-home/new-account',
42
- // contentType: 'application/json',
43
- // type: 'POST',
44
- // processData: false
45
- // });
60
+ // $.ajax({
61
+ // data: JSON.stringify(account),
62
+ // url: 'alexa-home/new-account',
63
+ // contentType: 'application/json',
64
+ // type: 'POST',
65
+ // processData: false
66
+ // });
46
67
  // }
47
68
  }
48
69
  });
@@ -58,11 +79,18 @@
58
79
  <select id="node-input-device">
59
80
 
60
81
  </select>
61
- <a id="node-input-device-refresh" class="btn"><i class="fa fa-refresh"></i></a>
82
+ <a id="node-input-device-refresh" class="btn"><i class="fa fa-refresh"></i></a>
62
83
  </div>
63
-
64
- <input type="hidden" id="node-input-name">
84
+ <div class="form-row" style="height: 34px;">
85
+ <label>Options</label>
86
+ <div class="form-row" style="display: inline;">
87
+ <input type="checkbox" id="node-input-sendInitialState" style="display: inline-block; width: auto; vertical-align: top;">
88
+ <label for="node-input-sendInitialState" style="width: auto;"> Send initial state</label>
65
89
  </div>
90
+ </div>
91
+ <div>
92
+ <input type="hidden" id="node-input-name">
93
+ </div>
66
94
  </script>
67
95
 
68
96
 
@@ -112,6 +140,10 @@
112
140
  conf: {
113
141
  value: "",
114
142
  type: "hb-conf"
143
+ },
144
+ sendInitialState: {
145
+ value: false,
146
+ required: false
115
147
  }
116
148
  },
117
149
  outputs: 1,
@@ -390,7 +422,7 @@
390
422
  </dl>
391
423
  <h3>Details</h3>
392
424
  <p>On receipt of any input message this node will poll the homebridge accessory and retrieve the status of the service.</p>
393
- <p>For accessories with multiple services, a need will need to be created for service you want status for.</p>
425
+ <p>For accessories with multiple services, a Homebridge Status node will need to be created for each service you want status for.</p>
394
426
  </script>
395
427
 
396
428
  <script type="text/javascript">
@@ -504,19 +536,25 @@
504
536
 
505
537
  <script type="text/x-red" data-template-name="hb-control">
506
538
  <div class="form-row">
507
- <label for="node-input-conf"><i class="icon-tag"></i> Pin </label>
539
+ <label for="node-input-conf"><i class="icon-tag"></i>Homebridge Pin</label>
508
540
  <input type="text" id="node-input-conf">
509
541
  </div>
510
542
  <div class="form-row">
511
- <label for="node-input-device"><i class="icon-tag"></i> Device</label>
543
+ <label for="node-input-device"><i class="icon-tag"></i>Device</label>
512
544
  <select id="node-input-device">
513
545
 
514
546
  </select>
515
547
  <a id="node-input-device-refresh" class="btn"><i class="fa fa-refresh"></i></a>
548
+
516
549
  </div>
550
+ <div class="form-row" style="margin-bottom: 0px">
551
+ <label for="node-input-outputs"><i class="icon-tag"></i>Outputs</label>
552
+ <input id="node-input-outputs" style="width: 60px;" value="1">
553
+ </div>
517
554
 
518
555
  <input type="hidden" id="node-input-name">
519
556
  </div>
557
+
520
558
  </script>
521
559
 
522
560
  <script type="text/x-red" data-help-name="hb-control">
@@ -527,9 +565,14 @@
527
565
  <dt>payload<span class="property-type">object</span></dt>
528
566
  <dd>Accessory characteristic object</dd>
529
567
  </dl>
568
+ <h3>Outputs</h3>
569
+ <dl class="message-properties">
570
+ <dd>Only on Camera control nodes, select 1 to output an image buffer object as a payload.</dd>
571
+ </dl>
530
572
  <h3>Details</h3>
531
573
  <p>This node allows control of a single service of a homebridge accessory. The message payload needs to be an object containing updated values. ie {"On":false,"Brightness":0}</p>
532
574
  <p>To determine valid characteristics, send an invalid message. ie {"Foo":"bar"} and the valid characteristics will be output in the debug tab.</p>
575
+ <p>For camera control nodes, send any message and the node will outout a snapshot image as the payload from the camera. Payload format is a buffer object.</p>
533
576
  </script>
534
577
 
535
578
  <script type="text/javascript">
@@ -552,6 +595,9 @@
552
595
  conf: {
553
596
  value: "",
554
597
  type: "hb-conf"
598
+ },
599
+ outputs: {
600
+ value: 0
555
601
  }
556
602
  },
557
603
  outputs: 0,