homebridge-ratgdo 2.1.1 → 2.1.3
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 +24 -3
- package/config.schema.json +3 -28
- package/dist/ratgdo-options.d.ts +0 -1
- package/dist/ratgdo-options.js.map +1 -1
- package/dist/ratgdo-platform.d.ts +1 -2
- package/dist/ratgdo-platform.js +132 -137
- package/dist/ratgdo-platform.js.map +1 -1
- package/dist/settings.d.ts +0 -1
- package/dist/settings.js +0 -2
- package/dist/settings.js.map +1 -1
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
## Why use this plugin for Ratgdo support in HomeKit?
|
|
20
20
|
In a nutshell, the aim of this plugin for things to *just work* with minimal required configuration by users. The goal is to provide as close to a streamlined experience as you would expect from a first-party or native HomeKit solution. For the adventurous, those additional granular options are, of course, available to support more esoteric use cases or other unique needs.
|
|
21
21
|
|
|
22
|
-
What does *just work* mean in practice? It means that this plugin will discover all your Ratgdo devices
|
|
22
|
+
What does *just work* mean in practice? It means that this plugin will discover all your Ratgdo devices that are running the Ratgdo ESPHome firmware without the need for additional configuration.
|
|
23
23
|
|
|
24
24
|
**I rely on this plugin every day and actively maintain and support it.**
|
|
25
25
|
|
|
@@ -35,14 +35,35 @@ In the interest of the community seeking a solution outside of myQ, I've develop
|
|
|
35
35
|
* Automation switch and dimmer support, allowing you to set the garage door to any position.
|
|
36
36
|
* A rich webUI for configuration.
|
|
37
37
|
|
|
38
|
-
##
|
|
38
|
+
## Installation
|
|
39
|
+
### Getting Started
|
|
39
40
|
To get started with `homebridge-ratgdo`:
|
|
40
41
|
|
|
41
|
-
* Install `homebridge-ratgdo` using the Homebridge webUI. Make sure you make `homebridge-ratgdo` a child bridge for the best
|
|
42
|
+
* Install `homebridge-ratgdo` using the Homebridge webUI. Make sure you make `homebridge-ratgdo` a child bridge for the best experience.
|
|
42
43
|
* Install the [ESPHome Ratgdo firmware](https://ratgdo.github.io/esphome-ratgdo/). You'll need to use Chrome for this as Safari doesn't support installing firmware through a USB serial port.
|
|
43
44
|
* Fully open and close the garage door one time. ESPHome Ratgdo will use this to determine how long it takes to open and close your garage door to enable precise control of the position of the garage door opener.
|
|
44
45
|
* That's it. Ensure `homebridge-ratgdo` is running and it will autodiscover your Ratgdo devices and make them available in HomeKit.
|
|
45
46
|
|
|
47
|
+
> [!TIP]
|
|
48
|
+
> If you would like to tailor your experience a bit further, you can choose to use the [hombridge-ratgdo ESPHome YAML configuration file](https://github.com/hjdhjd/homebridge-ratgdo/blob/main/homebridge-ratgdo.yaml) and use it to create a more customized Ratgdo ESPHome firmware. Using this firmware allows you to do the following things for those using Ratgdo hardware revision 2.5 or beyond:
|
|
49
|
+
>
|
|
50
|
+
> * The ability to customize the name (and friendly name) of the Ratgdo device. Though cosmetic, it can be helpful when you have multiple Ratgdo devices.
|
|
51
|
+
> * Use SNTP to set the time on the Ratgdo device. Not strictly necessary, but good hygeine.
|
|
52
|
+
> * Allows you to configure the timezone either yourself or automatically. The timezone will be autoconfigured using the World Time API geoIP by default.
|
|
53
|
+
> * Set the interval to check for updates from the Ratgdo repository to every 6 hours instead of the Ratgdo default of every second.
|
|
54
|
+
>
|
|
55
|
+
> **Using this YAML is completely optional and largely for cosmetic purposes. There are no functional differences between using this custom YAML configuration and the default Ratgdp ESPHome one.**
|
|
56
|
+
|
|
57
|
+
## Documentation
|
|
58
|
+
* Getting Started
|
|
59
|
+
* [Installation](#installation): installing this plugin, including system requirements.
|
|
60
|
+
* [Plugin Configuration](#getting-started): how to quickly get up and running.
|
|
61
|
+
* [Changelog](https://github.com/hjdhjd/homebridge-ratgdo/blob/main/docs/Changelog.md): changes and release history of this plugin.
|
|
62
|
+
|
|
63
|
+
* Additional Topics
|
|
64
|
+
* [Feature Options](https://github.com/hjdhjd/homebridge-ratgdo/blob/main/docs/FeatureOptions.md): options to allow you further tailor to your needs, particularly for those who want to have enhanced automation support.
|
|
65
|
+
* [MQTT](https://github.com/hjdhjd/homebridge-ratgdo/blob/main/docs/MQTT.md): how to configure MQTT support.
|
|
66
|
+
|
|
46
67
|
## Plugin Development Dashboard
|
|
47
68
|
This is mostly of interest to the true developer nerds amongst us.
|
|
48
69
|
|
package/config.schema.json
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
"pluginType": "platform",
|
|
4
4
|
"singular": true,
|
|
5
5
|
"customUi": true,
|
|
6
|
-
"headerDisplay": "[homebridge-ratgdo](https://github.com/hjdhjd/homebridge-ratgdo) provides HomeKit support to Chamberlain and Liftmaster garage door openers that use the Ratgdo hardware control board without using myQ.
|
|
7
|
-
"footerDisplay": "See the [homebridge-ratgdo developer page](https://github.com/hjdhjd/homebridge-ratgdo) for detailed documentation, including [feature options](https://github.com/hjdhjd/homebridge-ratgdo#feature-options).
|
|
6
|
+
"headerDisplay": "[homebridge-ratgdo](https://github.com/hjdhjd/homebridge-ratgdo) provides HomeKit support to Chamberlain and Liftmaster garage door openers that use the Ratgdo hardware control board without using myQ.",
|
|
7
|
+
"footerDisplay": "See the [homebridge-ratgdo developer page](https://github.com/hjdhjd/homebridge-ratgdo) for detailed documentation, including [feature options](https://github.com/hjdhjd/homebridge-ratgdo#feature-options).",
|
|
8
8
|
"schema": {
|
|
9
9
|
"type": "object",
|
|
10
10
|
"properties": {
|
|
@@ -52,16 +52,6 @@
|
|
|
52
52
|
"description": "Enter only one option per entry. See the plugin documentation for the complete list of available options or use the feature options webUI tab above.",
|
|
53
53
|
"placeholder": "e.g. Disable.Device"
|
|
54
54
|
}
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
"port": {
|
|
58
|
-
"title": "MQTT Broker Port",
|
|
59
|
-
"type": "number",
|
|
60
|
-
"placeholder": "e.g. 18830",
|
|
61
|
-
"minimum": 1024,
|
|
62
|
-
"maximum": 65535,
|
|
63
|
-
"required": false,
|
|
64
|
-
"description": "Set the port to use for the builtin MQTT broker. Ensure you set the Ratgdo hardware control board to use the same MQTT server port. Default: 18830"
|
|
65
55
|
}
|
|
66
56
|
}
|
|
67
57
|
},
|
|
@@ -69,22 +59,7 @@
|
|
|
69
59
|
"layout": [
|
|
70
60
|
{
|
|
71
61
|
"type": "section",
|
|
72
|
-
"title": "
|
|
73
|
-
"expandable": true,
|
|
74
|
-
"expanded": false,
|
|
75
|
-
"items": [
|
|
76
|
-
{
|
|
77
|
-
"description": "Ensure your Ratgdo hardware control board is configured to use the IP address of your Homebridge server for the MQTT server IP",
|
|
78
|
-
"items": [
|
|
79
|
-
"port"
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
]
|
|
83
|
-
},
|
|
84
|
-
|
|
85
|
-
{
|
|
86
|
-
"type": "section",
|
|
87
|
-
"title": "Plugin Feature Options",
|
|
62
|
+
"title": "Plugin Feature Options (Optional)",
|
|
88
63
|
"expandable": true,
|
|
89
64
|
"expanded": false,
|
|
90
65
|
"items": [
|
package/dist/ratgdo-options.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ratgdo-options.js","sourceRoot":"","sources":["../src/ratgdo-options.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ratgdo-options.js","sourceRoot":"","sources":["../src/ratgdo-options.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAY1D,6BAA6B;AAC7B,MAAM,CAAC,MAAM,uBAAuB,GAAG;IAErC,EAAE,WAAW,EAAE,yBAAyB,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAE,KAAK,CAAE,EAAE;IAC/E,EAAE,WAAW,EAAE,yBAAyB,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAE,QAAQ,CAAE,EAAE;IAClF,EAAE,WAAW,EAAE,+BAA+B,EAAE,IAAI,EAAE,OAAO,E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AC;AAC1B,CAAC;AAED,0EAA0E;AAC1E,SAAS,kBAAkB,CAAC,WAA+B,EAAE,OAAkC;IAE7F,qDAAqD;IACrD,IAAG,WAAW,KAAK,SAAS,EAAE,CAAC;QAE7B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,qCAAqC;IACrC,MAAM,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAE5C,oDAAoD;IACpD,IAAG,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC;QAEjD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,oBAAoB;IACpB,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,cAAc,CAAC,WAA+B;IAE5D,OAAO,kBAAkB,CAAC,WAAW,EAAE,CAAC,KAAa,EAAE,EAAE;QAEvD,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,eAAe,CAAC,WAA+B;IAE7D,OAAO,kBAAkB,CAAC,WAAW,EAAE,CAAC,KAAa,EAAE,EAAE;QAEvD,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -5,7 +5,6 @@ import { RatgdoMqtt } from "./ratgdo-mqtt.js";
|
|
|
5
5
|
export declare class RatgdoPlatform implements DynamicPlatformPlugin {
|
|
6
6
|
private readonly accessories;
|
|
7
7
|
readonly api: API;
|
|
8
|
-
private mqttNameMac;
|
|
9
8
|
private espHomeEvents;
|
|
10
9
|
private featureOptionDefaults;
|
|
11
10
|
config: RatgdoOptions;
|
|
@@ -16,10 +15,10 @@ export declare class RatgdoPlatform implements DynamicPlatformPlugin {
|
|
|
16
15
|
readonly hap: HAP;
|
|
17
16
|
readonly log: Logging;
|
|
18
17
|
readonly mqtt: RatgdoMqtt | null;
|
|
19
|
-
private unsupportedDevices;
|
|
20
18
|
constructor(log: Logging, config: PlatformConfig, api: API);
|
|
21
19
|
configureAccessory(accessory: PlatformAccessory): void;
|
|
22
20
|
private configureRatgdo;
|
|
21
|
+
private discoverRatgdoDevice;
|
|
23
22
|
private configureGdo;
|
|
24
23
|
featureOptionDefault(option: string): boolean;
|
|
25
24
|
debug(message: string, ...parameters: unknown[]): void;
|
package/dist/ratgdo-platform.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bonjour } from "bonjour-service";
|
|
2
|
-
import { PLATFORM_NAME, PLUGIN_NAME,
|
|
2
|
+
import { PLATFORM_NAME, PLUGIN_NAME, RATGDO_AUTODISCOVERY_INTERVAL, RATGDO_HEARTBEAT_DURATION, RATGDO_HEARTBEAT_INTERVAL, RATGDO_MQTT_TOPIC } from "./settings.js";
|
|
3
3
|
import { featureOptionCategories, featureOptions, isOptionEnabled } from "./ratgdo-options.js";
|
|
4
4
|
import EventSource from "eventsource";
|
|
5
5
|
import { RatgdoAccessory } from "./ratgdo-device.js";
|
|
@@ -10,7 +10,6 @@ import util from "node:util";
|
|
|
10
10
|
export class RatgdoPlatform {
|
|
11
11
|
accessories;
|
|
12
12
|
api;
|
|
13
|
-
mqttNameMac;
|
|
14
13
|
espHomeEvents;
|
|
15
14
|
featureOptionDefaults;
|
|
16
15
|
config;
|
|
@@ -19,20 +18,17 @@ export class RatgdoPlatform {
|
|
|
19
18
|
hap;
|
|
20
19
|
log;
|
|
21
20
|
mqtt;
|
|
22
|
-
unsupportedDevices;
|
|
23
21
|
constructor(log, config, api) {
|
|
24
22
|
this.accessories = [];
|
|
25
23
|
this.api = api;
|
|
26
24
|
this.configOptions = [];
|
|
27
25
|
this.configuredDevices = {};
|
|
28
|
-
this.mqttNameMac = {};
|
|
29
26
|
this.espHomeEvents = {};
|
|
30
27
|
this.featureOptionDefaults = {};
|
|
31
28
|
this.hap = api.hap;
|
|
32
29
|
this.log = log;
|
|
33
30
|
this.log.debug = this.debug.bind(this);
|
|
34
31
|
this.mqtt = null;
|
|
35
|
-
this.unsupportedDevices = {};
|
|
36
32
|
// Build our list of default values for our feature options.
|
|
37
33
|
for (const category of featureOptionCategories) {
|
|
38
34
|
for (const options of featureOptions[category.name]) {
|
|
@@ -47,8 +43,7 @@ export class RatgdoPlatform {
|
|
|
47
43
|
debug: config.debug === true,
|
|
48
44
|
mqttTopic: config.mqttTopic ?? RATGDO_MQTT_TOPIC,
|
|
49
45
|
mqttUrl: config.mqttUrl,
|
|
50
|
-
options: config.options
|
|
51
|
-
port: "port" in config ? parseInt(config.port) : RATGDO_API_PORT
|
|
46
|
+
options: config.options
|
|
52
47
|
};
|
|
53
48
|
// If we have feature options, put them into their own array, upper-cased for future reference.
|
|
54
49
|
if (this.config.options) {
|
|
@@ -64,8 +59,8 @@ export class RatgdoPlatform {
|
|
|
64
59
|
// Fire up the Ratgdo API once Homebridge has loaded all the cached accessories it knows about and called configureAccessory() on each.
|
|
65
60
|
api.on("didFinishLaunching" /* APIEvent.DID_FINISH_LAUNCHING */, () => this.configureRatgdo());
|
|
66
61
|
}
|
|
67
|
-
// This gets called when homebridge restores cached accessories at startup. We intentionally avoid doing anything significant here, and save all that logic for
|
|
68
|
-
//
|
|
62
|
+
// This gets called when homebridge restores cached accessories at startup. We intentionally avoid doing anything significant here, and save all that logic for device
|
|
63
|
+
// discovery.
|
|
69
64
|
configureAccessory(accessory) {
|
|
70
65
|
// Add this to the accessory array so we can track it.
|
|
71
66
|
this.accessories.push(accessory);
|
|
@@ -75,138 +70,138 @@ export class RatgdoPlatform {
|
|
|
75
70
|
// Instantiate our mDNS stack.
|
|
76
71
|
const mdns = new Bonjour();
|
|
77
72
|
// Make sure we cleanup our mDNS client on shutdown.
|
|
78
|
-
this.api.on("shutdown" /* APIEvent.SHUTDOWN */, () =>
|
|
79
|
-
mdns.destroy();
|
|
80
|
-
});
|
|
81
|
-
// Process the discovery of an ESPHome device.
|
|
82
|
-
const discoverDevice = (service) => {
|
|
83
|
-
// We're only interested in Ratgdo devices with valid IP addresses. Otherwise, we're done.
|
|
84
|
-
if ((service.txt.project_name !== "ratgdo.esphome") || !service.addresses) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
// We grab the first address provided for the ESPHome device.
|
|
88
|
-
const address = service.addresses[0];
|
|
89
|
-
// Grab the MAC address. We uppercase it and put it in the familiar colon notation first.
|
|
90
|
-
const mac = service.txt.mac.toUpperCase().replace(/(.{2})(?=.)/g, "$1:");
|
|
91
|
-
// Configure the device.
|
|
92
|
-
const ratgdoAccessory = this.configureGdo(address, mac, service.txt.friendly_name, service.txt.version);
|
|
93
|
-
// If we've already configured this one, we're done.
|
|
94
|
-
if (!ratgdoAccessory) {
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
// Node 18 requires this because it doesn't default to keeping the underlying socket alive by default. We need this to ensure that socket keepalives are enabled so
|
|
98
|
-
// that we can reconnect gracefully when connection issues occur. I'll remove this once Homebridge shifts to Node 20 as the lowest LTS version supported.
|
|
99
|
-
http.globalAgent = new http.Agent({ keepAlive: true, timeout: 5000 });
|
|
100
|
-
try {
|
|
101
|
-
// Connect to the Ratgdo ESPHome events API.
|
|
102
|
-
this.espHomeEvents[mac] = new EventSource("http://" + address + "/events");
|
|
103
|
-
// Handle errors in the events API.
|
|
104
|
-
this.espHomeEvents[mac].addEventListener("error", (payload) => {
|
|
105
|
-
let errorMessage;
|
|
106
|
-
switch (payload.message) {
|
|
107
|
-
case payload.message?.startsWith("connect ECONNREFUSED "):
|
|
108
|
-
errorMessage = "Connection to the Ratgdo controller refused";
|
|
109
|
-
break;
|
|
110
|
-
case payload.message?.startsWith("connect ETIMEDOUT "):
|
|
111
|
-
errorMessage = "Connection to the Ratgdo controller has timed out";
|
|
112
|
-
break;
|
|
113
|
-
case "read ECONNRESET":
|
|
114
|
-
errorMessage = "Connection to the Ratgdo controller has been reset";
|
|
115
|
-
break;
|
|
116
|
-
case "read ETIMEDOUT":
|
|
117
|
-
errorMessage = "Connection to the Ratgdo controller has timed out while listening for events";
|
|
118
|
-
break;
|
|
119
|
-
case "unknown error.":
|
|
120
|
-
case undefined:
|
|
121
|
-
errorMessage = "An unknown error on the Ratgdo controller has occurred. This will happen occasionally and can generally be ignored";
|
|
122
|
-
break;
|
|
123
|
-
default:
|
|
124
|
-
errorMessage = "Unrecognized error: " + util.inspect(payload, { sorted: true });
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
ratgdoAccessory.log.error("%s.", errorMessage);
|
|
128
|
-
});
|
|
129
|
-
// Inform the user when we've successfully connected.
|
|
130
|
-
this.espHomeEvents[mac].addEventListener("open", () => {
|
|
131
|
-
ratgdoAccessory.updateState("availability", "online");
|
|
132
|
-
});
|
|
133
|
-
// Capture state updates from the controller.
|
|
134
|
-
this.espHomeEvents[mac].addEventListener("state", (message) => {
|
|
135
|
-
let event;
|
|
136
|
-
ratgdoAccessory.log.debug("State event received: ", util.inspect(message.data, { sorted: true }));
|
|
137
|
-
// Ratgdo occasionally sends empty status updates - we ignore them.
|
|
138
|
-
if (!message.data.length) {
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
try {
|
|
142
|
-
event = JSON.parse(message.data);
|
|
143
|
-
}
|
|
144
|
-
catch (error) {
|
|
145
|
-
ratgdoAccessory.log.error("Unable to parse state message: \"%s\". Invalid JSON.", message.data);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
let state;
|
|
149
|
-
switch (event.id) {
|
|
150
|
-
case "binary_sensor-motion":
|
|
151
|
-
ratgdoAccessory.updateState("motion", (event.state === "OFF") ? "clear" : "detected");
|
|
152
|
-
break;
|
|
153
|
-
case "binary_sensor-obstruction":
|
|
154
|
-
ratgdoAccessory.updateState("obstruction", (event.state === "OFF") ? "clear" : "obstructed");
|
|
155
|
-
break;
|
|
156
|
-
case "cover-door":
|
|
157
|
-
switch (event.current_operation) {
|
|
158
|
-
case "CLOSING":
|
|
159
|
-
case "OPENING":
|
|
160
|
-
state = event.current_operation.toLowerCase();
|
|
161
|
-
break;
|
|
162
|
-
case "IDLE":
|
|
163
|
-
// We're stopped, rather than open, if the door is in a position greater than 0.
|
|
164
|
-
state = ((event.state === "OPEN") && (event.position !== undefined) && (event.position > 0) && (event.position < 1)) ? "stopped" :
|
|
165
|
-
event.state.toLowerCase();
|
|
166
|
-
break;
|
|
167
|
-
default:
|
|
168
|
-
ratgdoAccessory.log.error("Unknown door operation detected: %s.", event.current_operation);
|
|
169
|
-
return;
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
ratgdoAccessory.updateState("door", state, (event.position !== undefined) ? event.position * 100 : undefined);
|
|
173
|
-
break;
|
|
174
|
-
case "light-light":
|
|
175
|
-
ratgdoAccessory.updateState("light", event.state === "OFF" ? "off" : "on");
|
|
176
|
-
break;
|
|
177
|
-
case "lock-lock_remotes":
|
|
178
|
-
ratgdoAccessory.updateState("lock", event.state === "LOCKED" ? "locked" : "unlocked");
|
|
179
|
-
break;
|
|
180
|
-
default:
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
// Heartbeat the Ratgdo controller at regular intervals. We need to do this because the ESPHome firmware for Ratgdo has a failsafe that will autoreboot the
|
|
185
|
-
// Ratgdo every 15 minutes if it doesn't receive a native API connection. Fortunately, the failsafe only looks for an open connection to the API, allowing us the
|
|
186
|
-
// opportunity to heartbeat it with a connection we periodically reopen.
|
|
187
|
-
const heartbeat = () => {
|
|
188
|
-
// Connect to the Ratgdo, and setup our heartbeat to close after a configured duration.
|
|
189
|
-
const socket = net.createConnection({ host: address, port: 6053 }, () => setTimeout(() => {
|
|
190
|
-
socket.destroy();
|
|
191
|
-
}, RATGDO_HEARTBEAT_DURATION * 1000));
|
|
192
|
-
// Handle heartbeat errors.
|
|
193
|
-
socket.on("error", (err) => ratgdoAccessory.log.debug("Heartbeat error: %s.", util.inspect(err, { sorted: true })));
|
|
194
|
-
// Perpetually restart our heartbeat when it ends.
|
|
195
|
-
socket.on("close", () => setTimeout(() => heartbeat(), RATGDO_HEARTBEAT_INTERVAL * 1000));
|
|
196
|
-
};
|
|
197
|
-
heartbeat();
|
|
198
|
-
}
|
|
199
|
-
catch (error) {
|
|
200
|
-
if (error instanceof Error) {
|
|
201
|
-
ratgdoAccessory.log.error("Ratgdo API error: %s", error.message);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
};
|
|
73
|
+
this.api.on("shutdown" /* APIEvent.SHUTDOWN */, () => mdns.destroy());
|
|
205
74
|
// Start ESPHome device discovery.
|
|
206
|
-
const mdnsBrowser = mdns.find({ type: "esphomelib" },
|
|
75
|
+
const mdnsBrowser = mdns.find({ type: "esphomelib" }, this.discoverRatgdoDevice.bind(this));
|
|
76
|
+
// Trigger an initial update of our discovery.
|
|
77
|
+
mdnsBrowser.update();
|
|
207
78
|
// Refresh device discovery regular intervals.
|
|
208
79
|
setInterval(() => mdnsBrowser.update(), RATGDO_AUTODISCOVERY_INTERVAL * 1000);
|
|
209
80
|
}
|
|
81
|
+
// Ratgdo ESPHome device discovery.
|
|
82
|
+
discoverRatgdoDevice(service) {
|
|
83
|
+
// We're only interested in Ratgdo devices with valid IP addresses. Otherwise, we're done.
|
|
84
|
+
if ((service.txt.project_name !== "ratgdo.esphome") || !service.addresses) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// We grab the first address provided for the ESPHome device.
|
|
88
|
+
const address = service.addresses[0];
|
|
89
|
+
// Grab the MAC address. We uppercase it and put it in the familiar colon notation first.
|
|
90
|
+
const mac = service.txt.mac.toUpperCase().replace(/(.{2})(?=.)/g, "$1:");
|
|
91
|
+
// Configure the device.
|
|
92
|
+
const ratgdoAccessory = this.configureGdo(address, mac, service.txt.friendly_name, service.txt.version);
|
|
93
|
+
// If we've already configured this one, we're done.
|
|
94
|
+
if (!ratgdoAccessory) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
// Node 18 requires this because it doesn't default to keeping the underlying socket alive by default. We need this to ensure that socket keepalives are enabled so
|
|
98
|
+
// that we can reconnect gracefully when connection issues occur. I'll remove this once Homebridge shifts to Node 20 as the lowest LTS version supported.
|
|
99
|
+
http.globalAgent = new http.Agent({ keepAlive: true, timeout: 5000 });
|
|
100
|
+
try {
|
|
101
|
+
// Connect to the Ratgdo ESPHome events API.
|
|
102
|
+
this.espHomeEvents[mac] = new EventSource("http://" + address + "/events");
|
|
103
|
+
// Handle errors in the events API.
|
|
104
|
+
this.espHomeEvents[mac].addEventListener("error", (payload) => {
|
|
105
|
+
let errorMessage;
|
|
106
|
+
switch (payload.message) {
|
|
107
|
+
case payload.message?.startsWith("connect ECONNREFUSED "):
|
|
108
|
+
errorMessage = "Connection to the Ratgdo controller refused";
|
|
109
|
+
break;
|
|
110
|
+
case payload.message?.startsWith("connect ETIMEDOUT "):
|
|
111
|
+
errorMessage = "Connection to the Ratgdo controller has timed out";
|
|
112
|
+
break;
|
|
113
|
+
case "read ECONNRESET":
|
|
114
|
+
errorMessage = "Connection to the Ratgdo controller has been reset";
|
|
115
|
+
break;
|
|
116
|
+
case "read ETIMEDOUT":
|
|
117
|
+
errorMessage = "Connection to the Ratgdo controller has timed out while listening for events";
|
|
118
|
+
break;
|
|
119
|
+
case "unknown error.":
|
|
120
|
+
case undefined:
|
|
121
|
+
errorMessage = "An unknown error on the Ratgdo controller has occurred. This will happen occasionally and can generally be ignored";
|
|
122
|
+
break;
|
|
123
|
+
default:
|
|
124
|
+
errorMessage = "Unrecognized error: " + util.inspect(payload, { sorted: true });
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
ratgdoAccessory.log.error("%s.", errorMessage);
|
|
128
|
+
});
|
|
129
|
+
// Inform the user when we've successfully connected.
|
|
130
|
+
this.espHomeEvents[mac].addEventListener("open", () => {
|
|
131
|
+
ratgdoAccessory.updateState("availability", "online");
|
|
132
|
+
});
|
|
133
|
+
// Capture state updates from the controller.
|
|
134
|
+
this.espHomeEvents[mac].addEventListener("state", (message) => {
|
|
135
|
+
let event;
|
|
136
|
+
ratgdoAccessory.log.debug("State event received: ", util.inspect(message.data, { sorted: true }));
|
|
137
|
+
// Ratgdo occasionally sends empty status updates - we ignore them.
|
|
138
|
+
if (!message.data.length) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
event = JSON.parse(message.data);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
ratgdoAccessory.log.error("Unable to parse state message: \"%s\". Invalid JSON.", message.data);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
let state;
|
|
149
|
+
switch (event.id) {
|
|
150
|
+
case "binary_sensor-motion":
|
|
151
|
+
ratgdoAccessory.updateState("motion", (event.state === "OFF") ? "clear" : "detected");
|
|
152
|
+
break;
|
|
153
|
+
case "binary_sensor-obstruction":
|
|
154
|
+
ratgdoAccessory.updateState("obstruction", (event.state === "OFF") ? "clear" : "obstructed");
|
|
155
|
+
break;
|
|
156
|
+
case "cover-door":
|
|
157
|
+
switch (event.current_operation) {
|
|
158
|
+
case "CLOSING":
|
|
159
|
+
case "OPENING":
|
|
160
|
+
state = event.current_operation.toLowerCase();
|
|
161
|
+
break;
|
|
162
|
+
case "IDLE":
|
|
163
|
+
// We're stopped, rather than open, if the door is in a position greater than 0.
|
|
164
|
+
state = ((event.state === "OPEN") && (event.position !== undefined) && (event.position > 0) && (event.position < 1)) ? "stopped" :
|
|
165
|
+
event.state.toLowerCase();
|
|
166
|
+
break;
|
|
167
|
+
default:
|
|
168
|
+
ratgdoAccessory.log.error("Unknown door operation detected: %s.", event.current_operation);
|
|
169
|
+
return;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
ratgdoAccessory.updateState("door", state, (event.position !== undefined) ? event.position * 100 : undefined);
|
|
173
|
+
break;
|
|
174
|
+
case "light-light":
|
|
175
|
+
ratgdoAccessory.updateState("light", event.state === "OFF" ? "off" : "on");
|
|
176
|
+
break;
|
|
177
|
+
case "lock-lock_remotes":
|
|
178
|
+
ratgdoAccessory.updateState("lock", event.state === "LOCKED" ? "locked" : "unlocked");
|
|
179
|
+
break;
|
|
180
|
+
default:
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
// Heartbeat the Ratgdo controller at regular intervals. We need to do this because the ESPHome firmware for Ratgdo has a failsafe that will autoreboot the
|
|
185
|
+
// Ratgdo every 15 minutes if it doesn't receive a native API connection. Fortunately, the failsafe only looks for an open connection to the API, allowing us the
|
|
186
|
+
// opportunity to heartbeat it with a connection we periodically reopen.
|
|
187
|
+
const heartbeat = () => {
|
|
188
|
+
// Connect to the Ratgdo, and setup our heartbeat to close after a configured duration.
|
|
189
|
+
const socket = net.createConnection({ host: address, port: 6053 }, () => setTimeout(() => {
|
|
190
|
+
socket.destroy();
|
|
191
|
+
}, RATGDO_HEARTBEAT_DURATION * 1000));
|
|
192
|
+
// Handle heartbeat errors.
|
|
193
|
+
socket.on("error", (err) => ratgdoAccessory.log.debug("Heartbeat error: %s.", util.inspect(err, { sorted: true })));
|
|
194
|
+
// Perpetually restart our heartbeat when it ends.
|
|
195
|
+
socket.on("close", () => setTimeout(() => heartbeat(), RATGDO_HEARTBEAT_INTERVAL * 1000));
|
|
196
|
+
};
|
|
197
|
+
heartbeat();
|
|
198
|
+
}
|
|
199
|
+
catch (error) {
|
|
200
|
+
if (error instanceof Error) {
|
|
201
|
+
ratgdoAccessory.log.error("Ratgdo API error: %s", error.message);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
210
205
|
// Configure a discovered garage door opener.
|
|
211
206
|
configureGdo(address, mac, name, firmwareVersion) {
|
|
212
207
|
// Generate this device's unique identifier.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ratgdo-platform.js","sourceRoot":"","sources":["../src/ratgdo-platform.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAW,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,aAAa,EA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B;QAEpD,IAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAErB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;CACF"}
|
package/dist/settings.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare const PLATFORM_NAME = "Ratgdo";
|
|
2
2
|
export declare const PLUGIN_NAME = "homebridge-ratgdo";
|
|
3
|
-
export declare const RATGDO_API_PORT = 18830;
|
|
4
3
|
export declare const RATGDO_AUTODISCOVERY_INTERVAL = 60;
|
|
5
4
|
export declare const RATGDO_HEARTBEAT_DURATION = 120;
|
|
6
5
|
export declare const RATGDO_HEARTBEAT_INTERVAL = 300;
|
package/dist/settings.js
CHANGED
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
export const PLATFORM_NAME = "Ratgdo";
|
|
7
7
|
// The name of our plugin.
|
|
8
8
|
export const PLUGIN_NAME = "homebridge-ratgdo";
|
|
9
|
-
// The default port to use for our builtin MQTT broker. This is intentionally not the default MQTT port number (1883) in case a user is already running a local broker.
|
|
10
|
-
export const RATGDO_API_PORT = 18830;
|
|
11
9
|
// Interval, in seconds, to initiate mDNS discovery requests for new Ratgdo devices.
|
|
12
10
|
export const RATGDO_AUTODISCOVERY_INTERVAL = 60;
|
|
13
11
|
// Duration, in seconds, for a single heartbeat to ensure the Ratgdo doesn't autoreboot.
|
package/dist/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,mCAAmC;AACnC,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAEtC,0BAA0B;AAC1B,MAAM,CAAC,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAE/C,
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,mCAAmC;AACnC,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAEtC,0BAA0B;AAC1B,MAAM,CAAC,MAAM,WAAW,GAAG,mBAAmB,CAAC;AAE/C,oFAAoF;AACpF,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAEhD,wFAAwF;AACxF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C,wFAAwF;AACxF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C,kDAAkD;AAClD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAExC,oGAAoG;AACpG,MAAM,CAAC,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAEjD,gGAAgG;AAChG,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAE1C,4FAA4F;AAC5F,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,CAAC;AAE7C,wKAAwK;AACxK,4FAA4F;AAC5F,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-ratgdo",
|
|
3
3
|
"displayName": "Homebridge Ratgdo",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.3",
|
|
5
5
|
"description": "HomeKit integration for LiftMaster and Chamberlain garage door openers, without requiring myQ.",
|
|
6
6
|
"license": "ISC",
|
|
7
7
|
"repository": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"main": "dist/index.js",
|
|
20
20
|
"scripts": {
|
|
21
|
-
"lint": "eslint src/**.ts",
|
|
21
|
+
"lint": "eslint \"src/**.ts\"",
|
|
22
22
|
"watch": "npm run build && npm link && nodemon",
|
|
23
23
|
"build": "rimraf ./dist && tsc",
|
|
24
24
|
"prepublishOnly": "npm run lint && npm run build"
|
|
@@ -27,23 +27,22 @@
|
|
|
27
27
|
"homebridge-plugin"
|
|
28
28
|
],
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@stylistic/eslint-plugin": "^1.
|
|
30
|
+
"@stylistic/eslint-plugin": "^1.8.0",
|
|
31
31
|
"@types/eventsource": "^1.1.15",
|
|
32
|
-
"@types/node": "^20.12.
|
|
33
|
-
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
|
34
|
-
"@typescript-eslint/parser": "^7.7.1",
|
|
32
|
+
"@types/node": "^20.12.8",
|
|
35
33
|
"eslint": "^8.5.7",
|
|
36
34
|
"homebridge": "^1.8.1",
|
|
37
35
|
"nodemon": "^3.1.0",
|
|
38
36
|
"rimraf": "^5.0.5",
|
|
39
37
|
"ts-node": "^10.9.2",
|
|
40
|
-
"typescript": "^5.4.5"
|
|
38
|
+
"typescript": "^5.4.5",
|
|
39
|
+
"typescript-eslint": "^7.8.0"
|
|
41
40
|
},
|
|
42
41
|
"dependencies": {
|
|
43
42
|
"@adobe/fetch": "^4.1.2",
|
|
44
43
|
"@homebridge/plugin-ui-utils": "^1.0.3",
|
|
45
44
|
"bonjour-service": "^1.2.1",
|
|
46
45
|
"eventsource": "^2.0.2",
|
|
47
|
-
"mqtt": "^5.5.
|
|
46
|
+
"mqtt": "^5.5.5"
|
|
48
47
|
}
|
|
49
48
|
}
|