homebridge-rtl 0.0.28 → 0.0.32
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 +41 -3
- package/package.json +1 -1
- package/sensor.js +47 -5
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Contributor added sensors:
|
|
|
14
14
|
* [Mighty Mule Driveway alarm](https://www.amazon.com/Mighty-Mule-Wireless-Driveway-FM231/dp/B003765W0W) see [instructions here](MIGHTY-MULE-DRIVEWAY-ALARM-INSTRUCTIONS.md)
|
|
15
15
|
|
|
16
16
|
## Features
|
|
17
|
-
* Supported sensors include Motion, Temperature and Humidity
|
|
17
|
+
* Supported sensors include Motion, Contact, Temperature and Humidity
|
|
18
18
|
* Also shows "not responding" if the sensor stops sending data
|
|
19
19
|
* For temperature and humidity sensors, has ability to create alarms if the current value exceeds a alarm value
|
|
20
20
|
|
|
@@ -32,7 +32,7 @@ I have tested this on both a Mac and a RPI3
|
|
|
32
32
|
* `platform`: "rtl_433"
|
|
33
33
|
* `name`: "Front Porch" - Name of device for display in the Home App
|
|
34
34
|
* `id`: id number of device - To find the ID of your device, run homebridge in DEBUG mode, and it will log the message received from all rtl_433 devices. See below for examples
|
|
35
|
-
* `type`: Type of sensor device. Supported sensors are `motion`, `temperature`, `humidity`
|
|
35
|
+
* `type`: Type of sensor device. Supported sensors are `motion`, `temperature`, `humidity`, and `contact`
|
|
36
36
|
* `alarm`: Optional, Create a fake contact sensor called name + Alarm. Value is temperature in Celsius that if exceeded will trigger contact sensor.
|
|
37
37
|
* `humidity`: Optional, For devices of type `temperature` that emits also humidity set to `true` and humidity will shows in HomeKit/Eve app in the sensor.
|
|
38
38
|
|
|
@@ -46,7 +46,18 @@ Example configuration:
|
|
|
46
46
|
"id": "1e3e8",
|
|
47
47
|
"name": "Front Porch",
|
|
48
48
|
"type": "motion"
|
|
49
|
-
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "92",
|
|
52
|
+
"name": "Outside temperature",
|
|
53
|
+
"type": "temperature"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"id": "834551",
|
|
57
|
+
"name": "Front Door Sensor",
|
|
58
|
+
"type": "contact"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
50
61
|
}]
|
|
51
62
|
```
|
|
52
63
|
|
|
@@ -58,6 +69,10 @@ Example configuration:
|
|
|
58
69
|
Message {"time" : "2019-04-03 09:43:05", "model" : "Skylink HA-434TL motion sensor", "motion" : "false", "id" : "1e3e8", "raw" : "5e3e8"}
|
|
59
70
|
|
|
60
71
|
id is 1e3e8
|
|
72
|
+
|
|
73
|
+
Message {"time" : "2022-03-23 20:11:54.643434", "protocol" : 68, "model" : "Kerui-Security", "id" : 840811, "cmd" : 10, "motion" : 1, "state" : "motion" }
|
|
74
|
+
|
|
75
|
+
id is 840811
|
|
61
76
|
```
|
|
62
77
|
|
|
63
78
|
* Temperature sensor log entries
|
|
@@ -85,6 +100,29 @@ Message {"time" : "2020-03-14 14:40:41", "model" : "Acurite tower sensor", "id"
|
|
|
85
100
|
id is 15424
|
|
86
101
|
```
|
|
87
102
|
|
|
103
|
+
```
|
|
104
|
+
Message {"time" : "2022-03-23 21:28:05.748872", "protocol" : 38, "model" : "Generic-Temperature", "id" : 92, "battery_ok" : 1, "temperature_C" : 6.100 }
|
|
105
|
+
|
|
106
|
+
id is 92 the channel 1 for tiny AVIDSEN Weather station
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
Message {"time" : "2022-03-29 21:32:16.707696", "protocol" : 19, "model" : "Nexus-TH", "id" : 36, "channel" : 1, "battery_ok" : 1, "temperature_C" : 11.800, "humidity" : 77 }
|
|
111
|
+
Message {"time" : "2022-03-29 21:32:35.938421", "protocol" : 19, "model" : "Nexus-TH", "id" : 31, "channel" : 2, "battery_ok" : 1, "temperature_C" : 12.800, "humidity" : 66 }
|
|
112
|
+
Message {"time" : "2022-03-29 21:32:47.165018", "protocol" : 19, "model" : "Nexus-TH", "id" : 198, "channel" : 3, "battery_ok" : 1, "temperature_C" : 20.900, "humidity" : 45 }
|
|
113
|
+
|
|
114
|
+
id are 36, 31 and 198 (Bresser Temeo Hygro Quadro)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
* Contact Sensor log entries (Door or Window Open/Close)
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
Message {"time" : "2022-03-23 20:12:15.579712", "protocol" : 68, "model" : "Kerui-Security", "id" : 843552, "cmd" : 14, "opened" : 1, "state" : "open" }
|
|
121
|
+
Message {"time" : "2022-03-23 20:12:18.993887", "protocol" : 68, "model" : "Kerui-Security", "id" : 843552, "cmd" : 7, "opened" : 0, "state" : "close" }
|
|
122
|
+
|
|
123
|
+
id is 843552
|
|
124
|
+
```
|
|
125
|
+
|
|
88
126
|
## Credits
|
|
89
127
|
* merbanan - RTL_433 Sensor decoder
|
|
90
128
|
* simont77 - History Service
|
package/package.json
CHANGED
package/sensor.js
CHANGED
|
@@ -55,9 +55,11 @@ function rtl433Server() {
|
|
|
55
55
|
var readline = require('readline');
|
|
56
56
|
var previousMessage;
|
|
57
57
|
this.log("Spawning rtl_433");
|
|
58
|
+
// if you start rtl_433 outside homebride to get log: rtl_433 -v -F json -C si -M protocol > /tmp/rtl433.json
|
|
59
|
+
//var proc = childProcess.spawn('/usr/bin/truncate -s 0 /tmp/rtl433.json;/usr/bin/tail', ['-F','/tmp/rtl433.json'], {
|
|
58
60
|
var proc = childProcess.spawn('pkill rtl_433;/usr/local/bin/rtl_433', ['-q', '-F', 'json', '-C', 'si'], {
|
|
59
61
|
shell: true
|
|
60
|
-
|
|
62
|
+
});
|
|
61
63
|
readline.createInterface({
|
|
62
64
|
input: proc.stdout,
|
|
63
65
|
terminal: false
|
|
@@ -205,8 +207,10 @@ Rtl433Accessory.prototype = {
|
|
|
205
207
|
break;
|
|
206
208
|
case "motion":
|
|
207
209
|
// {"time" : "2018-09-30 19:20:26", "model" : "Skylink HA-434TL motion sensor", "motion" : "true", "id" : "1e3e8", "raw" : "be3e8"}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
+
// {"time" : "2022-03-17 21:58:46.319049", "protocol" : 68, "model" : "Kerui-Security", "id" : 840811, "cmd" : 10, "motion" : 1, "state" : "motion" }
|
|
211
|
+
// debug("update motion this--->",this);
|
|
212
|
+
|
|
213
|
+
var value = (data.motion === "true" || data.motion === 1 ? true : false ) ;
|
|
210
214
|
if (this.sensorService.getCharacteristic(Characteristic.MotionDetected).value !== value) {
|
|
211
215
|
this.sensorService.getCharacteristic(CustomCharacteristic.LastActivation)
|
|
212
216
|
.updateValue(moment().unix() - this.loggingService.getInitialTime());
|
|
@@ -236,6 +240,24 @@ Rtl433Accessory.prototype = {
|
|
|
236
240
|
}
|
|
237
241
|
|
|
238
242
|
break;
|
|
243
|
+
case "contact":
|
|
244
|
+
// {"time" : "2022-03-17 23:04:08.430623", "protocol" : 68, "model" : "Kerui-Security", "id" : 297536, "cmd" : 14, "opened" : 1, "state" : "open" }
|
|
245
|
+
// {"time" : "2022-03-17 23:04:19.447761", "protocol" : 68, "model" : "Kerui-Security", "id" : 297536, "cmd" : 7, "opened" : 0, "state" : "close" }
|
|
246
|
+
// debug("update door this--->",this);
|
|
247
|
+
// console.log("update door this--->",this);
|
|
248
|
+
|
|
249
|
+
this.sensorService
|
|
250
|
+
.setCharacteristic(Characteristic.ContactSensorState, ( data.opened === 1 ? Characteristic.ContactSensorState.CONTACT_NOT_DETECTED : Characteristic.ContactSensorState.CONTACT_DETECTED ));
|
|
251
|
+
|
|
252
|
+
//this.timeout = setTimeout(deviceTimeout.bind(this), this.deviceTimeout * 60 * 1000);
|
|
253
|
+
clearTimeout(this.timeout);
|
|
254
|
+
|
|
255
|
+
if (data.battery !== undefined || data.battery_ok != undefined) {
|
|
256
|
+
this.sensorService
|
|
257
|
+
.setCharacteristic(Characteristic.StatusLowBattery, (data.battery === "OK" || data.battery_ok === 1 ? Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL : Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW));
|
|
258
|
+
}
|
|
259
|
+
break;
|
|
260
|
+
|
|
239
261
|
default:
|
|
240
262
|
this.log.error("No events defined for sensor type %s", this.type);
|
|
241
263
|
}
|
|
@@ -313,6 +335,8 @@ Rtl433Accessory.prototype = {
|
|
|
313
335
|
case "motion":
|
|
314
336
|
this.sensorService = new Service.MotionSensor(this.name);
|
|
315
337
|
|
|
338
|
+
this.sensorService.addCharacteristic(CustomCharacteristic.LastActivation);
|
|
339
|
+
|
|
316
340
|
this.timeoutCharacteristic = Characteristic.MotionDetected;
|
|
317
341
|
this.timeout = setTimeout(deviceTimeout.bind(this), this.deviceTimeout * 60 * 1000); // 5 minutes
|
|
318
342
|
|
|
@@ -324,6 +348,21 @@ Rtl433Accessory.prototype = {
|
|
|
324
348
|
informationService
|
|
325
349
|
.setCharacteristic(Characteristic.Model, "Motion Sensor");
|
|
326
350
|
break;
|
|
351
|
+
case "contact":
|
|
352
|
+
// debug("get door this--->",this);
|
|
353
|
+
// console.log("get door this--->",this);
|
|
354
|
+
|
|
355
|
+
this.sensorService = new Service.ContactSensor(this.name);
|
|
356
|
+
this.sensorService.addCharacteristic(CustomCharacteristic.LastActivation);
|
|
357
|
+
|
|
358
|
+
//this.timeoutCharacteristic = Characteristic.ContactSensorState;
|
|
359
|
+
//this.timeout = setTimeout(deviceTimeout.bind(this), this.deviceTimeout * 60 * 1000); // 5 minutes
|
|
360
|
+
|
|
361
|
+
this.sensorService.log = this.log;
|
|
362
|
+
informationService
|
|
363
|
+
.setCharacteristic(Characteristic.Model, "Contact Sensor");
|
|
364
|
+
break;
|
|
365
|
+
|
|
327
366
|
default:
|
|
328
367
|
this.log.error("No events defined for sensor type %s", this.type);
|
|
329
368
|
}
|
|
@@ -338,8 +377,10 @@ Rtl433Accessory.prototype = {
|
|
|
338
377
|
|
|
339
378
|
function deviceTimeout() {
|
|
340
379
|
this.log("Timeout", this.name);
|
|
341
|
-
|
|
342
|
-
|
|
380
|
+
|
|
381
|
+
if (this.sensorService !== undefined && this.timeoutCharacteristic !== undefined )
|
|
382
|
+
this.sensorService
|
|
383
|
+
.getCharacteristic(this.timeoutCharacteristic).updateValue(new Error("No response"));
|
|
343
384
|
}
|
|
344
385
|
|
|
345
386
|
function roundInt(string) {
|
|
@@ -386,3 +427,4 @@ function duplicateMessage(last, current) {
|
|
|
386
427
|
}
|
|
387
428
|
return false;
|
|
388
429
|
}
|
|
430
|
+
|