homebridge-gpio-electic-rim-lock 1.0.4 → 2.0.2

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.
@@ -0,0 +1,26 @@
1
+ name: Publish to NPM
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+
10
+ steps:
11
+ - name: Checkout
12
+ uses: actions/checkout@v2
13
+
14
+ - name: Setup Node
15
+ uses: actions/setup-node@v2
16
+ with:
17
+ node-version: '18'
18
+ registry-url: 'https://registry.npmjs.org'
19
+
20
+ - name: Install dependencies
21
+ run: npm install --ignore-scripts
22
+
23
+ - name: Publish package
24
+ run: npm publish
25
+ env:
26
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/README.md CHANGED
@@ -9,43 +9,45 @@ This plugin assumes that you are using a Raspberry Pi to directly control your e
9
9
 
10
10
  ## Installation
11
11
 
12
- Install this plugin using:
12
+ ### Via Homebridge UI (Recommended)
13
+
14
+ 1. Open the Homebridge UI
15
+ 2. Navigate to Plugins
16
+ 3. Search for "homebridge-gpio-electic-rim-lock"
17
+ 4. Click Install
18
+
19
+ ### Via npm
13
20
  ```
14
21
  sudo npm install -g homebridge-gpio-electic-rim-lock --unsafe-perm
15
22
  ```
16
-
23
+ Restart Homebridge after installing.
17
24
 
18
25
  ## Configuration
19
26
 
20
- You will need to add the following accessory configuration to the Homebridge [config.json](https://github.com/nfarina/homebridge/blob/master/config-sample.json).
27
+ ### Via Homebridge UI
28
+
29
+ The plugin provides a full configuration UI. Navigate to Plugins → Settings for Homebridge Gpio Electic Rim Lock.
21
30
 
22
- Configuration sample:
31
+ ### Manual Configuration
23
32
 
33
+ Add the following accessory configuration to the Homebridge [config.json](https://github.com/nfarina/homebridge/blob/master/config-sample.json):
24
34
  ```JSON
25
- {
26
- "bridge": {
27
- "name": "Raspberry Pi 2",
28
- "username": "CC:22:3D:E3:CE:32",
29
- "port": 51826,
30
- "pin": "031-45-154"
31
- },
32
35
 
36
+ {
33
37
  "accessories": [
34
38
  {
35
- "accessory": "Tiro",
36
- "name": "Door",
37
- "pin": 12,
38
- "duration": 500
39
+ "accessory": "Tiro",
40
+ "name": "Door",
41
+ "pin": 12,
42
+ "duration": 500
39
43
  }
40
- ],
41
-
42
- "platforms": []
44
+ ]
43
45
  }
44
46
 
45
47
  ```
46
48
 
47
49
  Fields:
48
50
 
49
- * name - Can be anything (required).
51
+ * name - The door name visible in HomeKit, can be anything (required).
50
52
  * pin - The physical GPIO pin number that controls the relay (required).
51
- * duratin - Number of milliseconds to trigger the relay. Defaults to 1000 millseconds (1 second) if not specified.
53
+ * duratin - Number of milliseconds to trigger the relay. Defaults to 500 millseconds (0,5 second) if not specified.
@@ -0,0 +1,44 @@
1
+ {
2
+ "pluginAlias": "Tiro",config.schema.json
3
+ "pluginType": "accessory",
4
+ "singular": false,
5
+
6
+ "headerDisplay": "Homebridge plugin to open electric rim locks via Raspberry Pi GPIO pins.",
7
+ "footerDisplay": "For documentation, see the [plugin homepage](https://github.com/roberto-montanari/homebridge-gpio-electic-rim-lock) on GitHub.",
8
+
9
+ "schema": {
10
+ "type": "object",
11
+ "required": [
12
+ "name",
13
+ "pin",
14
+ "duration"
15
+ ],
16
+ "properties": {
17
+
18
+ "name": {
19
+ "title": "Door name",
20
+ "type": "string",
21
+ "description": "Door name visible in HomeKit",
22
+ "minLength": 1
23
+ },
24
+
25
+ "pin": {
26
+ "title": "GPIO pin number",
27
+ "type": "integer",
28
+ "description": "The physical GPIO pin number that controls the relay",
29
+ "enum": [
30
+ 11, 12, 13, 15
31
+ ]
32
+ },
33
+
34
+ "duration": {
35
+ "title": "Pulse duration (ms)",
36
+ "type": "integer",
37
+ "description": "Number of milliseconds to trigger the relay",
38
+ "default": 500,
39
+ "minimum": 500,
40
+ "maximum": 2000
41
+ }
42
+ }
43
+ }
44
+ }
package/index.js CHANGED
@@ -25,7 +25,7 @@ function ElecticRimLockAccessory(log, config) {
25
25
  this.lastLockTargetState = 1;
26
26
 
27
27
  if (!this.pin) throw new Error("You must provide a config value for pin.");
28
- if (this.duration == null || this.duration % 1 != 0) this.duration = 1000;
28
+ if (this.duration == null || this.duration % 1 != 0) this.duration = 500;
29
29
  this.log("Tiro GPIO version: " + this.version);
30
30
  this.log("Switch pin: " + this.pin);
31
31
  this.log("Active time: " + this.duration + " ms");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-gpio-electic-rim-lock",
3
- "version": "1.0.4",
3
+ "version": "2.0.2",
4
4
  "description": "Homebridge plugin to open electric rim locks via Raspberry Pi GPIO pins",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "homepage": "https://github.com/roberto-montanari/homebridge-gpio-electic-rim-lock#readme",
24
24
  "engines": {
25
25
  "node": ">=0.12.0",
26
- "homebridge": ">=0.2.0"
26
+ "homebridge": ">=0.2.0 || ^2.0.0"
27
27
  },
28
28
  "dependencies": {
29
29
  "rpio": ">=0.9.12"