node-red-contrib-homebridge-automation 0.3.0-beta.4 → 0.3.0-beta.6

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/README.md CHANGED
@@ -199,6 +199,7 @@ With a plugin, you can see if it supports Real Time events, by opening the Home
199
199
 
200
200
  - Add common supported types Window, Window Covering, Light Sensor #151, tks @HDeKnop
201
201
  - HB-Control Node Turns Off then On when this message is received #152
202
+ - Added `Debug logging` that creates a file `homebridge-automation-endpoints.json`, which contains all the homebridge devices discovered. It can be used as part of troubleshooting device issues.
202
203
 
203
204
  # Backlog / Roadmap
204
205
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-homebridge-automation",
3
- "version": "0.3.0-beta.4",
3
+ "version": "0.3.0-beta.6",
4
4
  "description": "NodeRED Automation for HomeBridge",
5
5
  "main": "src/HAP-NodeRed.js",
6
6
  "scripts": {
@@ -7,10 +7,23 @@
7
7
  <label for="node-config-input-macAddress"><i class="icon-wifi"></i> MAC Address (optional)</label>
8
8
  <input type="text" id="node-config-input-macAddress" placeholder="00:00:00:A1:2B:CC">
9
9
  </div>
10
+ <div class="form-row">
11
+ <label for="node-config-input-debug"><i class="icon-tag"></i>Debug Logging</label>
12
+ <input type="checkbox" id="node-config-input-debug" placeholder=false>
13
+ </div>
10
14
  </script>
11
15
 
12
16
  <script type="text/x-red" data-help-name="hb-conf">
13
- <p>This allows you to register your homebridge PIN</p>
17
+ <p>Configuration Node for Homebridge</p>
18
+ <h3>Settings</h3>
19
+ <dl class="message-properties">
20
+ <dt>PIN<span class="property-type">string</span></dt>
21
+ <dd>Please enter the PIN from your homebridge instances. Please note that the same pin must be used for all instances.</dd>
22
+ <dt>MAC Address<span class="property-type">object</span></dt>
23
+ <dd>Optional - Not implemented</dd>
24
+ <dt>Debug Logging<span class="property-type">string</span></dt>
25
+ <dd>Enables debug logging and creates a file `homebridge-automation-endpoints.json`, which contains all the homebridge devices discovered. It can be used as part of troubleshooting device issues.</dd>
26
+ </dl>
14
27
  </script>
15
28
 
16
29
  <script type="text/javascript">
@@ -36,6 +49,10 @@
36
49
  },
37
50
  required: false
38
51
  },
52
+ debug: {
53
+ value: false,
54
+ required: false
55
+ }
39
56
  },
40
57
  credentials: {
41
58
  password: {
@@ -10,6 +10,7 @@ class HBConfigNode {
10
10
  // Initialize properties
11
11
  this.username = config.username;
12
12
  this.macAddress = config.macAddress || '';
13
+ this.debugLogging = config.debug || false;
13
14
  this.users = {};
14
15
  this.homebridge = null;
15
16
  this.evDevices = [];
@@ -53,7 +54,7 @@ class HBConfigNode {
53
54
  */
54
55
  async handleReady() {
55
56
  const updatedDevices = await this.hapClient.getAllServices();
56
- if (this.debug && updatedDevices && updatedDevices.length && process.uptime() < 300) {
57
+ if (this.debugLogging && updatedDevices && updatedDevices.length && process.uptime() < 300) {
57
58
  try {
58
59
  const storagePath = path.join(process.cwd(), '/homebridge-automation-endpoints.json');
59
60
  this.warn(`Writing Homebridge endpoints to ${storagePath}`);
@@ -53,7 +53,6 @@ class HbControlNode extends hbBaseNode {
53
53
  const result = await this.hbDevice.setCharacteristicsByTypes(filterIfOff(message.payload));
54
54
  results.push(result.values);
55
55
  } catch (error) {
56
- console.log(error)
57
56
  this.error(`Failed to set value for "${JSON.stringify(message.payload)}": ${error.message}`);
58
57
  results.push({ 'Error': `Error: ${error.message}` });
59
58
  fill = 'red';
@@ -51,7 +51,8 @@
51
51
  "id": "7e647d67.f33acc",
52
52
  "type": "hb-conf",
53
53
  "username": "031-45-154",
54
- "macAddress": ""
54
+ "macAddress": "",
55
+ "debug": true
55
56
  },
56
57
  {
57
58
  "id": "df5dd49178c517fa",