homebridge-alexa 0.5.62 → 0.5.63-beta.5
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/CHANGELOG.md +26 -0
- package/Installation.md +40 -35
- package/README.md +81 -53
- package/{Troubleshooting.md → Troubleshooting.MD} +34 -33
- package/config.schema.json +17 -3
- package/lib/alexaActions.js +10 -2
- package/lib/alexaLocal.js +54 -41
- package/lib/parse/Accessory.js +7 -5
- package/lib/parse/Homebridges.js +16 -12
- package/package.json +4 -4
- package/plugin.js +37 -24
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. This project uses [Semantic Versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## 0.5.64 (2022-12-19)
|
|
6
|
+
|
|
7
|
+
## [Version 0.5.64](https://github.com/northernman54/homebridge-alexa/compare/v0.5.63...v0.5.64)
|
|
8
|
+
|
|
9
|
+
#### Changes
|
|
10
|
+
|
|
11
|
+
- Added additional debug logging to easily determine child bridge address to aid Homebridge Accessory Dumps
|
|
12
|
+
- Updates to hap-node-client to better support usage of ipv6
|
|
13
|
+
- Update to gh-md-toc ( generates TOC for README )
|
|
14
|
+
- Merge current beta functionality into main code base
|
|
15
|
+
- Remove the fake Alexa Contact sensor from discovery and events
|
|
16
|
+
- Enable the usage of websockets instead of mqtt, to provide improved connectivity in some setups
|
|
17
|
+
- New configuration option `wssTransport` which enables the websocket transport
|
|
18
|
+
- Enable the usage of mqtts instead of mqtt, to provide improved connectivity in some setups
|
|
19
|
+
- New configuration option `mqttsTransport` which enables the mqtts transport
|
|
20
|
+
- Removed the Alexa contact sensor ( which shows the status of the connection to the cloud servers ) from the list of devices passed to Alexa.
|
|
21
|
+
|
|
22
|
+
## 0.5.63 (2022-04-27)
|
|
23
|
+
|
|
24
|
+
## [Version 0.5.63](https://github.com/northernman54/homebridge-alexa/compare/v0.5.61...v0.5.63)
|
|
25
|
+
|
|
26
|
+
#### Changes
|
|
27
|
+
|
|
28
|
+
- Updates to README in regards to switch to subscription based model for the cloud services.
|
|
29
|
+
- Lower default cloud connection keepalive to 5 minutes
|
|
30
|
+
|
|
5
31
|
## 0.5.61 (2022-03-21)
|
|
6
32
|
|
|
7
33
|
## [Version 0.5.61](https://github.com/northernman54/homebridge-alexa/compare/v0.5.56...v0.5.61)
|
package/Installation.md
CHANGED
|
@@ -1,39 +1,42 @@
|
|
|
1
1
|
Installation and Configuration of Homebridge Alexa
|
|
2
|
+
==================================================
|
|
2
3
|
|
|
3
4
|
<!--ts-->
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
5
|
+
* [Installation and Configuration of Homebridge Alexa](#installation-and-configuration-of-homebridge-alexa)
|
|
6
|
+
* [Setup Instructions for users of the Homebridge UI](#setup-instructions-for-users-of-the-homebridge-ui)
|
|
7
|
+
* [Create Homebridge-Alexa Cloud Services Account](#create-homebridge-alexa-cloud-services-account)
|
|
8
|
+
* [Install and Configure the Plugin](#install-and-configure-the-plugin)
|
|
9
|
+
* [Installation in Homebridge UI](#installation-in-homebridge-ui)
|
|
10
|
+
* [Configuration in Homebridge UI](#configuration-in-homebridge-ui)
|
|
11
|
+
* [Enabling and linking the Homebridge Smart Home Skill](#enabling-and-linking-the-homebridge-smart-home-skill)
|
|
12
|
+
* [Viewing Account Status](#viewing-account-status)
|
|
13
|
+
* [Legacy Setup Instructions for users not using the Homebridge UI, includes advanced configuration options](#legacy-setup-instructions-for-users-not-using-the-homebridge-ui-includes-advanced-configuration-options)
|
|
14
|
+
* [Prepare Homebridge for plugin installation](#prepare-homebridge-for-plugin-installation)
|
|
15
|
+
* [Install Plugin](#install-plugin)
|
|
16
|
+
* [Create homebridge-alexa account](#create-homebridge-alexa-account)
|
|
17
|
+
* [HomeBridge-alexa plugin configuration](#homebridge-alexa-plugin-configuration)
|
|
18
|
+
* [Required parameters](#required-parameters)
|
|
19
|
+
* [Optional parameters](#optional-parameters)
|
|
20
|
+
* [pin](#pin)
|
|
21
|
+
* [routines](#routines)
|
|
22
|
+
* [blind](#blind)
|
|
23
|
+
* [door](#door)
|
|
24
|
+
* [debug](#debug)
|
|
25
|
+
* [refresh](#refresh)
|
|
26
|
+
* [filter](#filter)
|
|
27
|
+
* [deviceList & deviceListHandling](#devicelist--devicelisthandling)
|
|
28
|
+
* [combine](#combine)
|
|
29
|
+
* [speakers](#speakers)
|
|
30
|
+
* [Inputs](#inputs)
|
|
31
|
+
* [Apple TV](#apple-tv)
|
|
32
|
+
* [Yamaha Spotify Controls](#yamaha-spotify-controls)
|
|
33
|
+
* [New Parser](#new-parser)
|
|
34
|
+
* [Initial Testing and confirming configuration](#initial-testing-and-confirming-configuration)
|
|
35
|
+
* [Enable Homebridge smarthome skill and link accounts](#enable-homebridge-smarthome-skill-and-link-accounts)
|
|
36
|
+
* [Discover Devices](#discover-devices)
|
|
37
|
+
|
|
38
|
+
<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
|
|
39
|
+
<!-- Added by: sgracey, at: Sat 24 Dec 2022 16:52:03 EST -->
|
|
37
40
|
|
|
38
41
|
<!--te-->
|
|
39
42
|
|
|
@@ -43,6 +46,8 @@ Installation and Configuration of Homebridge Alexa
|
|
|
43
46
|
|
|
44
47
|
This plugin requires the usage of cloud services to link your Amazon Alexa Account to the plugin. Please create an account at https://www.homebridge.ca/. The account details will be needed as part of plugin configuration and for linking the Homebridge smart home skill.
|
|
45
48
|
|
|
49
|
+
Please ensure that you validate the email address you entered. And the username and passwords are case sensitive.
|
|
50
|
+
|
|
46
51
|
## Install and Configure the Plugin
|
|
47
52
|
|
|
48
53
|
### Installation in Homebridge UI
|
|
@@ -59,13 +64,13 @@ Restart homebridge
|
|
|
59
64
|
|
|
60
65
|
## Enabling and linking the Homebridge Smart Home Skill
|
|
61
66
|
|
|
62
|
-
In the Amazon Alexa Application on your smart phone, search for the Homebridge Skill and enable it. When you enable the skill, it will take you to the https://www.homebridge.ca/ website to enable and link the skill to the plugin.
|
|
67
|
+
In the Amazon Alexa Application on your smart phone, search for the Homebridge Skill and enable it. When you enable the skill, it will take you to the https://www.homebridge.ca/ website to enable and link the skill to the plugin. You can now ask Alexa to `discover devices` and it should discover your homebridge devices.
|
|
63
68
|
|
|
64
69
|
### Viewing Account Status
|
|
65
70
|
|
|
66
71
|
On the homebridge.ca website you can view your account status, and identify any setup issues.
|
|
67
72
|
|
|
68
|
-
# Legacy Setup Instructions for users not using the Homebridge UI
|
|
73
|
+
# Legacy Setup Instructions for users not using the Homebridge UI, includes advanced configuration options
|
|
69
74
|
|
|
70
75
|
* If you are looking for a basic setup to get this plugin up and running check out this guide (https://sambrooks.net/controlling-homebridge-using-alexa/). And here is another setup guide (https://www.youtube.com/watch?v=Ylg4yiw8ofM).
|
|
71
76
|
|
package/README.md
CHANGED
|
@@ -10,17 +10,21 @@ Enable Amazon Alexa to control your homebridge smart home devices and accessorie
|
|
|
10
10
|
|
|
11
11
|
# Note to users of the service
|
|
12
12
|
|
|
13
|
-
Everyone, as your probably aware
|
|
13
|
+
Everyone, as your probably aware we have been running this for a number of years as a free service, and with the growth in users of the service and the volume of transactions flowing thru the cloud components we need to change to a subscription based service to continue to offer the service in a sustainable manner.
|
|
14
14
|
|
|
15
|
-
The ongoing costs to run and support the cloud services have grown to the point where it is larger than pocket change, and rather than reducing functionality
|
|
15
|
+
The ongoing costs to run and support the cloud services have grown to the point where it is larger than pocket change, and rather than reducing functionality we have made the hard decision to switch to a subscription based model to continue to offer the current high levels of service.
|
|
16
16
|
|
|
17
|
-
For the subscription model,
|
|
17
|
+
For the subscription model, we have set this up with PayPal to start with, and with a price cheaper than a cup of Starbucks coffee. We thought a coffee a month was a reasonable contribution for the continued delivery of service.
|
|
18
18
|
|
|
19
19
|
For the migration of users to the new model I’m doing this in two phases, first being new users of the service and the second being existing or legacy users of the service.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## New Users
|
|
22
22
|
|
|
23
|
-
For
|
|
23
|
+
For new users of the service, they will receive a trial account, with 7 days of service to test out the service and work thru any issues prior to a subscription being required to continue service. During the trial period users can apply for a subscription at any time, and it will be future dated to start on the trial period end date.
|
|
24
|
+
|
|
25
|
+
## Existing Users ( Prior to March 26th, 2022 )
|
|
26
|
+
|
|
27
|
+
For existing ‘legacy’ users of the service I have initiated the transition into subscriptions for all users, with a subscription being required after a date between May 25th, 2022 and June 25th, 2022. If you login to the homebridge.ca website, you can see your start date. You can signup for subscriptions at any time, and the first payment date will be future dated to the start date.
|
|
24
28
|
|
|
25
29
|
If you have any questions or concerns, please let me know.
|
|
26
30
|
|
|
@@ -41,51 +45,54 @@ Country availability - The plugin is available in these countries, English (AU),
|
|
|
41
45
|
|
|
42
46
|
# Table of Contents
|
|
43
47
|
<!--ts-->
|
|
44
|
-
|
|
45
|
-
* [
|
|
46
|
-
* [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
* [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* [
|
|
65
|
-
* [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
* [
|
|
75
|
-
|
|
76
|
-
* [
|
|
77
|
-
* [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
48
|
+
* [Note to users of the service](#note-to-users-of-the-service)
|
|
49
|
+
* [New Users](#new-users)
|
|
50
|
+
* [Existing Users ( Prior to March 26th, 2022 )](#existing-users--prior-to-march-26th-2022-)
|
|
51
|
+
* [Availability](#availability)
|
|
52
|
+
* [Features](#features)
|
|
53
|
+
* [Table of Contents](#table-of-contents)
|
|
54
|
+
* [Supported devices](#supported-devices)
|
|
55
|
+
* [HomeKit/Homebridge Devices supported](#homekithomebridge-devices-supported)
|
|
56
|
+
* [Native Support](#native-support)
|
|
57
|
+
* [Supported as Other Types](#supported-as-other-types)
|
|
58
|
+
* [Unsupported device types](#unsupported-device-types)
|
|
59
|
+
* [Alexa Voice Commands](#alexa-voice-commands)
|
|
60
|
+
* [Setup](#setup)
|
|
61
|
+
* [Light bulbs / Switches / Dimmer Switches](#light-bulbs--switches--dimmer-switches)
|
|
62
|
+
* [Color lights](#color-lights)
|
|
63
|
+
* [Color temperature](#color-temperature)
|
|
64
|
+
* [Color Temperatures](#color-temperatures)
|
|
65
|
+
* [Garage door, Blinds and Window Coverings](#garage-door-blinds-and-window-coverings)
|
|
66
|
+
* [Garage Door With door = false](#garage-door-with-door--false)
|
|
67
|
+
* [Window coverings / blinds With blind = false](#window-coverings--blinds-with-blind--false)
|
|
68
|
+
* [Garage Door With blind = true ( Not supported in all countries )](#garage-door-with-blind--true--not-supported-in-all-countries-)
|
|
69
|
+
* [Window coverings / blinds With blind = true ( Not supported in all countries )](#window-coverings--blinds-with-blind--true--not-supported-in-all-countries-)
|
|
70
|
+
* [Thermostat's and Heater / Cooler's](#thermostats-and-heater--coolers)
|
|
71
|
+
* [Lock / Unlock Doors](#lock--unlock-doors)
|
|
72
|
+
* [Temperature sensors](#temperature-sensors)
|
|
73
|
+
* [AppleTV ( homebridge-apple-tv or homebridge-apple-tv-remote )](#appletv--homebridge-apple-tv-or-homebridge-apple-tv-remote-)
|
|
74
|
+
* [HomeKit Television](#homekit-television)
|
|
75
|
+
* [HomeKit Television - Tested plugins](#homekit-television---tested-plugins)
|
|
76
|
+
* [Television Inputs and Channels](#television-inputs-and-channels)
|
|
77
|
+
* [Speakers](#speakers)
|
|
78
|
+
* [Bose SoundLink - Change preset](#bose-soundlink---change-preset)
|
|
79
|
+
* [Yamaha Receiver/Spotify control](#yamaha-receiverspotify-control)
|
|
80
|
+
* [Contact and Motion Sensors](#contact-and-motion-sensors)
|
|
81
|
+
* [Door bell devices](#door-bell-devices)
|
|
82
|
+
* [Installation of homebridge-alexa](#installation-of-homebridge-alexa)
|
|
83
|
+
* [Service Availability and Issues](#service-availability-and-issues)
|
|
84
|
+
* [Homebridge cloud service monitoring ( homebridge.ca )](#homebridge-cloud-service-monitoring--homebridgeca-)
|
|
85
|
+
* [Raising Issues and Troubleshooting](#raising-issues-and-troubleshooting)
|
|
86
|
+
* [Troubleshooting](#troubleshooting)
|
|
87
|
+
* [Known Issues](#known-issues)
|
|
88
|
+
* [Discord Channel](#discord-channel)
|
|
89
|
+
* [Debug logs](#debug-logs)
|
|
90
|
+
* [Homebridge Accessory Dump](#homebridge-accessory-dump)
|
|
91
|
+
* [Roadmap](#roadmap)
|
|
92
|
+
* [Credits](#credits)
|
|
93
|
+
|
|
94
|
+
<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
|
|
95
|
+
<!-- Added by: sgracey, at: Sat 24 Dec 2022 16:52:03 EST -->
|
|
89
96
|
|
|
90
97
|
<!--te-->
|
|
91
98
|
|
|
@@ -316,7 +323,7 @@ Installation and configuration instructions are [here](Installation.md).
|
|
|
316
323
|
|
|
317
324
|
* Real time monitoring of the homebridge.ca cloud service is provided by [Uptime Robot](https://stats.uptimerobot.com/2WmEDHyV6).
|
|
318
325
|
|
|
319
|
-
* Cloud service operational event reporting and alerting is sent to the #homebridge-alexa channel in the Homebridge Discord instance, and the uptime robot reports events there in real time. To access the homebridge discord server, here is an <a href="https://discord.gg/
|
|
326
|
+
* Cloud service operational event reporting and alerting is sent to the #homebridge-alexa channel in the Homebridge Discord instance, and the uptime robot reports events there in real time. To access the homebridge discord server, here is an <a href="https://discord.gg/6WBNPUauvA">Invite</a>.
|
|
320
327
|
|
|
321
328
|
## Raising Issues and Troubleshooting
|
|
322
329
|
|
|
@@ -332,14 +339,13 @@ From here you should be able to determine if your plugin is communicating with t
|
|
|
332
339
|
|
|
333
340
|
* I have started recording troubleshooting tips here based on issues seen by the community [Troubleshooting](Troubleshooting.MD).
|
|
334
341
|
* All homebridge PIN's in your setup need to be set to the same value.
|
|
335
|
-
* Whitelisting/blacklisting of accessories is not supported, but this can be achieved at the plugin level by putting the plugins you don't want exposed to Alexa in their own instance of HomeBridge, and for that instance of Alexa, don't include -I command line option. Discovery will fail for that instance, and the accessories will not be exposed.
|
|
336
342
|
* An Alexa device or a software based Alexa is required. Using just the App or Website does not work, and device discovery will fail to find devices. The Reverb app is a software based Alexa that is known to work.
|
|
337
343
|
* The maximum number of supported devices is 300. This is a limitation from the from the Amazon side, and not the plugin.
|
|
338
344
|
* If your Amazon account is not domiciled in the country where your Alexa is located the skill will not work. This is a limitation on the Amazon side and not with the plugin. ie if you are in the UK and use an Amazon.com account, the skill will not work. You need to use an Amazon account domiciled in the UK
|
|
339
345
|
|
|
340
346
|
### Discord Channel
|
|
341
347
|
|
|
342
|
-
I have created a Discord channel on the homebridge discord server to troubleshoot issues not on the troubleshooting page. If you reach out there, I'm usually available. The channel is called #homebridge-alexa
|
|
348
|
+
I have created a Discord channel on the homebridge discord server to troubleshoot issues not on the troubleshooting page. If you reach out there, I'm usually available. The channel is called #homebridge-alexa <a href="https://discord.gg/6WBNPUauvA">Invite</a>
|
|
343
349
|
|
|
344
350
|
### Debug logs
|
|
345
351
|
|
|
@@ -357,6 +363,28 @@ Sometimes during troubleshooting I need a dump of your homebridge accessories. P
|
|
|
357
363
|
curl -X PUT http://127.0.0.1:51826/accessories --header "Content-Type:Application/json" --header "authorization: 031-45-154"
|
|
358
364
|
```
|
|
359
365
|
|
|
366
|
+
If needed during plugin startup with the debug option enabled ( this is available with version 0.5.64 ), the plugin will log the unique command for each homebridge instance in your setup, including child bridges.
|
|
367
|
+
|
|
368
|
+
The entries in the log file look like this for each homebridge instance.
|
|
369
|
+
|
|
370
|
+
```
|
|
371
|
+
alexaActions Homebridge Accessory Information Dump for Hue B509
|
|
372
|
+
alexaActions curl -X PUT http://192.168.1.11:40889/accessories --header "Content-Type:Application/json" --header "authorization: 031-45-154"
|
|
373
|
+
alexaActions
|
|
374
|
+
alexaActions Homebridge Accessory Information Dump for Alexa E33F
|
|
375
|
+
alexaActions curl -X PUT http://192.168.1.11:33019/accessories --header "Content-Type:Application/json" --header "authorization: 031-45-154"
|
|
376
|
+
alexaActions
|
|
377
|
+
alexaActions Homebridge Accessory Information Dump for Tuner 8723
|
|
378
|
+
alexaActions curl -X PUT http://192.168.1.11:45397/accessories --header "Content-Type:Application/json" --header "authorization: 031-45-154"
|
|
379
|
+
alexaActions
|
|
380
|
+
alexaActions Homebridge Accessory Information Dump for Tasmota 5019
|
|
381
|
+
alexaActions curl -X PUT http://192.168.1.11:38859/accessories --header "Content-Type:Application/json" --header "authorization: 031-45-154"
|
|
382
|
+
alexaActions
|
|
383
|
+
alexaActions Homebridge Accessory Information Dump for homebridge-tuya BF07
|
|
384
|
+
alexaActions curl -X PUT http://192.168.1.11:36323/accessories --header "Content-Type:Application/json" --header "authorization: 031-45-154"
|
|
385
|
+
alexaActions
|
|
386
|
+
```
|
|
387
|
+
|
|
360
388
|
# Roadmap
|
|
361
389
|
|
|
362
390
|
See [Roadmap](Roadmap.md)
|
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
**Troubleshooting Tips**
|
|
2
2
|
|
|
3
3
|
<!--ts-->
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<!--
|
|
4
|
+
* [Initial Setup](#initial-setup)
|
|
5
|
+
* [[Alexa] ERROR: ( homebridge-alexa) Login to homebridge.ca failed, please validate your credentials in config.json and restart homebridge.](#alexa-error--homebridge-alexa-login-to-homebridgeca-failed-please-validate-your-credentials-in-configjson-and-restart-homebridge)
|
|
6
|
+
* [- Bad login or password in your config.json for <a href="https://www.homebridge.ca" rel="nofollow">https://www.homebridge.ca</a>](#--bad-login-or-password-in-your-configjson-for-httpswwwhomebridgeca)
|
|
7
|
+
* [[Alexa] ERROR: ( homebridge-alexa) You have an issue with your installation, please review the README.](#alexa-error--homebridge-alexa-you-have-an-issue-with-your-installation-please-review-the-readme)
|
|
8
|
+
* [- Cloud Server DDOS Protection has blocked your IP address](#--cloud-server-ddos-protection-has-blocked-your-ip-address)
|
|
9
|
+
* [- Multiple copies of homebridge-alexa on your network](#--multiple-copies-of-homebridge-alexa-on-your-network)
|
|
10
|
+
* [- VPN Software interfering with homebridge-alexa to homebridge.ca communications](#--vpn-software-interfering-with-homebridge-alexa-to-homebridgeca-communications)
|
|
11
|
+
* [[Alexa] ERROR: ( homebridge-alexa) Stopping Home Skill connection due to excessive reconnects, please review the README.](#alexa-error--homebridge-alexa-stopping-home-skill-connection-due-to-excessive-reconnects-please-review-the-readme)
|
|
12
|
+
* [[Alexa] WARNING: Duplicate device name xxxxx](#alexa-warning-duplicate-device-name-xxxxx)
|
|
13
|
+
* [Initial Setup Messages from DEBUG mode](#initial-setup-messages-from-debug-mode)
|
|
14
|
+
* [alexaHAP HAP Discover failed ... is not running in insecure mode](#alexahap-hap-discover-failed--is-not-running-in-insecure-mode)
|
|
15
|
+
* [HAP Discover failed ..... error code 470](#hap-discover-failed--error-code-470)
|
|
16
|
+
* [Upgraded from old version and am seeing this error message](#upgraded-from-old-version-and-am-seeing-this-error-message)
|
|
17
|
+
* [[Alexa] ERROR: HAP Discovery failed, please review config](#alexa-error-hap-discovery-failed-please-review-config)
|
|
18
|
+
* [alexaLocal ERROR: connect ECONNREFUSED 35.169.132.61:1883 -> ECONNREFUSED](#alexalocal-error-connect-econnrefused-35169132611883----econnrefused)
|
|
19
|
+
* [alexaLocal error { Error: connect ECONNREFUSED 35.169.132.61:8883](#alexalocal-error--error-connect-econnrefused-35169132618883)
|
|
20
|
+
* [Device Discovery](#device-discovery)
|
|
21
|
+
* [Device discovery fails and the plugin logs show no issues.](#device-discovery-fails-and-the-plugin-logs-show-no-issues)
|
|
22
|
+
* [Device discovery fails, and this message is in the logs ERROR: Empty accessory name, parsing failed.](#device-discovery-fails-and-this-message-is-in-the-logs-error-empty-accessory-name-parsing-failed)
|
|
23
|
+
* [Device discovery fails, and this message is in the logs ERROR: Maximum devices/accessories of 300 exceeded.](#device-discovery-fails-and-this-message-is-in-the-logs-error-maximum-devicesaccessories-of-300-exceeded)
|
|
24
|
+
* [Device discovery fails, and this message is in the logs ERROR: Parsing failed, duplicate endpointID.](#device-discovery-fails-and-this-message-is-in-the-logs-error-parsing-failed-duplicate-endpointid)
|
|
25
|
+
* [After restarting homebridge Alexa can't find devices and needs to discover them again. Or you have duplicate devices in Alexa](#after-restarting-homebridge-alexa-cant-find-devices-and-needs-to-discover-them-again--or-you-have-duplicate-devices-in-alexa)
|
|
26
|
+
* [Controlling devices](#controlling-devices)
|
|
27
|
+
* [[Alexa] PowerController TurnOff 192.168.1.226 51826 undefined Error: Homebridge auth failed, invalid PIN](#alexa-powercontroller-turnoff-1921681226-51826-undefined-error-homebridge-auth-failed-invalid-pin)
|
|
28
|
+
* [Event error messages](#event-error-messages)
|
|
29
|
+
* [[Alexa] WARNING: ( homebridge-alexa) Dropped event message, message rate too high.](#alexa-warning--homebridge-alexa-dropped-event-message-message-rate-too-high)
|
|
30
|
+
* [ERROR: Error: getAccessToken No data Error: XXXXXXXXXX](#error--error-getaccesstoken-no-data-error-xxxxxxxxxx)
|
|
31
|
+
* [ERROR: Error: getAccessToken Token not found](#error--error-getaccesstoken-token-not-found)
|
|
32
|
+
* [Unsuccessful event message ( No event gateway token )](#unsuccessful-event-message--no-event-gateway-token-)
|
|
33
|
+
* [Successful event message being sent to Alexa](#successful-event-message-being-sent-to-alexa)
|
|
34
|
+
* [[Alexa] ERROR: Event gateway token refresh error: 400](#alexa-error--event-gateway-token-refresh-error-400)
|
|
35
|
+
|
|
36
|
+
<!-- Created by https://github.com/ekalinin/github-markdown-toc -->
|
|
37
|
+
<!-- Added by: sgracey, at: Sat 24 Dec 2022 16:52:03 EST -->
|
|
37
38
|
|
|
38
39
|
<!--te-->
|
|
39
40
|
|
package/config.schema.json
CHANGED
|
@@ -61,11 +61,23 @@
|
|
|
61
61
|
"keepalive": {
|
|
62
62
|
"title": "Cloud Server Connection Keepalive",
|
|
63
63
|
"type": "integer",
|
|
64
|
-
"placeholder": "
|
|
65
|
-
"description": "Frequency of keepalive messages to cloud server, in minutes. Defaults to
|
|
64
|
+
"placeholder": "5",
|
|
65
|
+
"description": "Frequency of keepalive messages to cloud server, in minutes. Defaults to 5 minutes. Do not change from default unless requested as part of problem investigation.",
|
|
66
66
|
"minimum": 1,
|
|
67
67
|
"maximum": 59
|
|
68
68
|
},
|
|
69
|
+
"wssTransport": {
|
|
70
|
+
"title": "Websocket Cloud Server Connection",
|
|
71
|
+
"type": "boolean",
|
|
72
|
+
"default": false,
|
|
73
|
+
"description": "Enable Websocket based Cloud Server Connection, this is an alternative to the mqtt based transport. Do not change from default unless requested as part of problem investigation."
|
|
74
|
+
},
|
|
75
|
+
"mqttsTransport": {
|
|
76
|
+
"title": "MQTTS Cloud Server Connection",
|
|
77
|
+
"type": "boolean",
|
|
78
|
+
"default": false,
|
|
79
|
+
"description": "Enable MQTTS based Cloud Server Connection, this is an alternative to the mqtt based transport. Do not change from default unless requested as part of problem investigation."
|
|
80
|
+
},
|
|
69
81
|
"filter": {
|
|
70
82
|
"title": "Instance Filter",
|
|
71
83
|
"type": "string",
|
|
@@ -183,7 +195,9 @@
|
|
|
183
195
|
"expandable": true,
|
|
184
196
|
"expanded": false,
|
|
185
197
|
"items": [
|
|
186
|
-
"keepalive"
|
|
198
|
+
"keepalive",
|
|
199
|
+
"wssTransport",
|
|
200
|
+
"mqttsTransport"
|
|
187
201
|
]
|
|
188
202
|
},
|
|
189
203
|
{
|
package/lib/alexaActions.js
CHANGED
|
@@ -49,7 +49,7 @@ function hapDiscovery(options) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function registerEvents(message) {
|
|
52
|
-
debug("registerEvents", message);
|
|
52
|
+
// debug("registerEvents", message);
|
|
53
53
|
|
|
54
54
|
var HBMessage = [];
|
|
55
55
|
|
|
@@ -121,6 +121,14 @@ function alexaDiscovery(message, callback) {
|
|
|
121
121
|
if (process.uptime() > 600) { // Only use console during startup
|
|
122
122
|
debug("alexaDiscovery - returned %s devices", response.event.payload.endpoints.length);
|
|
123
123
|
} else {
|
|
124
|
+
var mdnsCache = homebridge.mdnsCache();
|
|
125
|
+
var output = "";
|
|
126
|
+
for (const instance in mdnsCache) {
|
|
127
|
+
output = output + '\nHomebridge Accessory Information Dump for ' + mdnsCache[instance].name;
|
|
128
|
+
// debug('Homebridge Accessory Instance Dump for', mdnsCache[instance].name);
|
|
129
|
+
output = output + '\ncurl -X PUT ' + mdnsCache[instance].url + '/accessories --header "Content-Type:Application/json" --header "authorization: ' + this.pin + '"\n';
|
|
130
|
+
}
|
|
131
|
+
debug(output);
|
|
124
132
|
this.log("alexaDiscovery - returned %s devices", response.event.payload.endpoints.length);
|
|
125
133
|
}
|
|
126
134
|
if (response.event.payload.endpoints.length > 300) {
|
|
@@ -141,7 +149,7 @@ function alexaDiscovery(message, callback) {
|
|
|
141
149
|
function removeLargeCookieEndpoints(endpoints) {
|
|
142
150
|
var response = [];
|
|
143
151
|
endpoints.forEach((endpoint) => {
|
|
144
|
-
debug("Cookie Object: ", JSON.stringify(endpoint.cookie).length);
|
|
152
|
+
// debug("Cookie Object: ", JSON.stringify(endpoint.cookie).length);
|
|
145
153
|
if (JSON.stringify(endpoint.cookie).length < 5000) {
|
|
146
154
|
response.push(endpoint);
|
|
147
155
|
} else {
|
package/lib/alexaLocal.js
CHANGED
|
@@ -44,55 +44,61 @@ function alexaLocal(options) {
|
|
|
44
44
|
options.alexaService.setCharacteristic(Characteristic.ContactSensorState, Characteristic.ContactSensorState.CONTACT_NOT_DETECTED);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
limiter.on("dropped", function(dropped) {
|
|
47
|
+
limiter.on("dropped", function (dropped) {
|
|
48
48
|
options.log("WARNING: ( homebridge-alexa) Dropped event message, message rate too high.");
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
username = options.username;
|
|
52
|
-
connection.client = mqtt.connect(options);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
debug('connect', "command/" + options.username + "/#");
|
|
51
|
+
username = options.mqttOptions.username;
|
|
52
|
+
connection.client = mqtt.connect(options.mqttURL, options.mqttOptions);
|
|
53
|
+
connection.client.on('connect', function () {
|
|
54
|
+
debug('connect', "command/" + username + "/#");
|
|
56
55
|
if (options.alexaService) {
|
|
57
56
|
options.alexaService.setCharacteristic(Characteristic.ContactSensorState, Characteristic.ContactSensorState.CONTACT_DETECTED);
|
|
58
57
|
}
|
|
59
58
|
connection.client.removeAllListeners('message'); // Clean up event handlers
|
|
60
|
-
connection.client.subscribe("command/" +
|
|
61
|
-
connection.client.publish("presence/" +
|
|
62
|
-
Connected:
|
|
63
|
-
version: packageConfig.version
|
|
59
|
+
connection.client.subscribe("command/" + username + "/#");
|
|
60
|
+
connection.client.publish("presence/" + username + "/1", JSON.stringify({
|
|
61
|
+
Connected: username,
|
|
62
|
+
version: packageConfig.version,
|
|
63
|
+
transport: options.transport,
|
|
64
|
+
keepalive: options.mqttOptions.keepalive,
|
|
65
|
+
routines: options.events
|
|
64
66
|
}));
|
|
65
|
-
connection.client.on('message', function(topic, message) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
response
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
67
|
+
connection.client.on('message', function (topic, message) {
|
|
68
|
+
try {
|
|
69
|
+
var msg = JSON.parse(message.toString());
|
|
70
|
+
|
|
71
|
+
// debug("Count", this.listenerCount(msg.directive.header.namespace.toLowerCase()));
|
|
72
|
+
if (options.eventBus.listenerCount(msg.directive.header.namespace) > 0) {
|
|
73
|
+
debug('Emitting', msg.directive.header.namespace);
|
|
74
|
+
options.eventBus.emit(msg.directive.header.namespace, msg, function (err, response) {
|
|
75
|
+
// TODO: if no message, return error Response
|
|
76
|
+
if (response == null) {
|
|
77
|
+
response = _alexaErrorResponse(msg);
|
|
78
|
+
}
|
|
79
|
+
// debug("Response", JSON.stringify(response));
|
|
80
|
+
connection.client.publish("response/" + username + "/1", JSON.stringify(response));
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
debug('No listener for', msg.directive.header.namespace.toLowerCase());
|
|
84
|
+
var response = _alexaErrorResponse(msg);
|
|
85
|
+
connection.client.publish("response/" + username + "/1", JSON.stringify(response));
|
|
86
|
+
debug("Response", JSON.stringify(response, null, 2));
|
|
87
|
+
}
|
|
88
|
+
} catch (err) {
|
|
89
|
+
options.log.error("ERROR: MQTT Message on topic \"%s\" triggered an internal error\n", topic, err);
|
|
84
90
|
}
|
|
85
91
|
});
|
|
86
92
|
});
|
|
87
93
|
|
|
88
|
-
connection.client.on('offline', function() {
|
|
94
|
+
connection.client.on('offline', function () {
|
|
89
95
|
debug('offline');
|
|
90
96
|
if (options.alexaService) {
|
|
91
97
|
options.alexaService.setCharacteristic(Characteristic.ContactSensorState, Characteristic.ContactSensorState.CONTACT_NOT_DETECTED);
|
|
92
98
|
}
|
|
93
99
|
});
|
|
94
100
|
|
|
95
|
-
connection.client.on('reconnect', function() {
|
|
101
|
+
connection.client.on('reconnect', function () {
|
|
96
102
|
count++;
|
|
97
103
|
debug('reconnect');
|
|
98
104
|
if (options.alexaService) {
|
|
@@ -110,19 +116,26 @@ function alexaLocal(options) {
|
|
|
110
116
|
}
|
|
111
117
|
});
|
|
112
118
|
|
|
113
|
-
connection.client.on('error', function(err) {
|
|
119
|
+
connection.client.on('error', function (err) {
|
|
114
120
|
if (options.alexaService) {
|
|
115
121
|
options.alexaService.setCharacteristic(Characteristic.ContactSensorState, Characteristic.ContactSensorState.CONTACT_NOT_DETECTED);
|
|
116
122
|
}
|
|
117
123
|
switch (err.code) {
|
|
118
124
|
case 5:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
125
|
+
if (process.uptime() < 20) { // If uptime is less than 20 seconds then error is a bad password and not a backend issue
|
|
126
|
+
options.log.error("ERROR: ( homebridge-alexa) Login to homebridge.ca failed, please validate your credentials in config.json and restart homebridge.");
|
|
127
|
+
connection.client.end({
|
|
128
|
+
force: true
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
options.log.error("ERROR: ( homebridge-alexa) Login to homebridge.ca failed, please validate your configuration in config.json and restart homebridge.");
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
case 'ECONNREFUSED':
|
|
135
|
+
options.log.error("ERROR: Cloud service DDOS Protection tripped, please stop homebridge for 5 to 10 minutes and try again.");
|
|
123
136
|
break;
|
|
124
137
|
default:
|
|
125
|
-
debug('ERROR: %s -> ', err.message, err.code);
|
|
138
|
+
debug('ERROR: %s -> %d\n', err.message, err.code, err);
|
|
126
139
|
}
|
|
127
140
|
});
|
|
128
141
|
}
|
|
@@ -137,8 +150,8 @@ function alexaEvent(message) {
|
|
|
137
150
|
}
|
|
138
151
|
*/
|
|
139
152
|
var topic = "event/" + username + "/1";
|
|
140
|
-
var publish = function(callback) {
|
|
141
|
-
debug("Sending message", JSON.stringify(message));
|
|
153
|
+
var publish = function (callback) {
|
|
154
|
+
debug("Sending message", topic, JSON.stringify(message));
|
|
142
155
|
connection.client.publish(topic, JSON.stringify(message), {
|
|
143
156
|
retain: false
|
|
144
157
|
}, callback);
|
|
@@ -149,8 +162,8 @@ function alexaEvent(message) {
|
|
|
149
162
|
|
|
150
163
|
function alexaPriorityEvent(message) {
|
|
151
164
|
var topic = "event/" + username + "/1";
|
|
152
|
-
var publish = function(callback) {
|
|
153
|
-
debug("Sending priority message", JSON.stringify(message));
|
|
165
|
+
var publish = function (callback) {
|
|
166
|
+
debug("Sending priority message", topic, JSON.stringify(message));
|
|
154
167
|
connection.client.publish(topic, JSON.stringify(message), {
|
|
155
168
|
retain: false
|
|
156
169
|
}, callback);
|
package/lib/parse/Accessory.js
CHANGED
|
@@ -21,7 +21,7 @@ function Accessory(devices, context) {
|
|
|
21
21
|
this.playback = false;
|
|
22
22
|
this.television = false;
|
|
23
23
|
this.link = [];
|
|
24
|
-
devices.services.forEach(function(element) {
|
|
24
|
+
devices.services.forEach(function (element) {
|
|
25
25
|
// debug("Service", element);
|
|
26
26
|
switch (element.type.substring(0, 8)) {
|
|
27
27
|
case "0000003E": // Accessory Information
|
|
@@ -56,7 +56,7 @@ function Accessory(devices, context) {
|
|
|
56
56
|
// debug("Services.setup", this.name, this.services.length);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
Accessory.prototype.toList = function(context) {
|
|
59
|
+
Accessory.prototype.toList = function (context) {
|
|
60
60
|
var list = [];
|
|
61
61
|
context.aid = this.aid;
|
|
62
62
|
context.name = this.info.Name;
|
|
@@ -72,7 +72,7 @@ Accessory.prototype.toList = function(context) {
|
|
|
72
72
|
return (list);
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
-
Accessory.prototype.toAlexa = function(context) {
|
|
75
|
+
Accessory.prototype.toAlexa = function (context) {
|
|
76
76
|
var list = [];
|
|
77
77
|
context.aid = this.aid;
|
|
78
78
|
context.name = this.info.Name;
|
|
@@ -116,6 +116,8 @@ Accessory.prototype.toAlexa = function(context) {
|
|
|
116
116
|
var service = this.services[index];
|
|
117
117
|
if ((this.television && service.service === "Speaker") || service.service === "Television" || service.service === "Input Source") {
|
|
118
118
|
// Skip television accessories
|
|
119
|
+
} else if (service.name === "Alexa" && service.service === "Contact Sensor" && service.info.Manufacturer === "homebridge-alexa") {
|
|
120
|
+
// Skip the Alexa contact sensors made by the plugin
|
|
119
121
|
} else {
|
|
120
122
|
var alexa = service.toAlexa(context);
|
|
121
123
|
if (alexa) {
|
|
@@ -128,7 +130,7 @@ Accessory.prototype.toAlexa = function(context) {
|
|
|
128
130
|
return (list);
|
|
129
131
|
};
|
|
130
132
|
|
|
131
|
-
Accessory.prototype.toCookie = function(characteristic, context) {
|
|
133
|
+
Accessory.prototype.toCookie = function (characteristic, context) {
|
|
132
134
|
var list;
|
|
133
135
|
context.aid = this.aid;
|
|
134
136
|
context.name = this.info.Name;
|
|
@@ -146,7 +148,7 @@ Accessory.prototype.toCookie = function(characteristic, context) {
|
|
|
146
148
|
|
|
147
149
|
function information(characteristics) {
|
|
148
150
|
var result = {};
|
|
149
|
-
characteristics.forEach(function(characteristic) {
|
|
151
|
+
characteristics.forEach(function (characteristic) {
|
|
150
152
|
if (characteristic.description) {
|
|
151
153
|
var key = characteristic.description.replace(/ /g, '').replace(/\./g, '_');
|
|
152
154
|
result[key] = characteristic.value;
|
package/lib/parse/Homebridges.js
CHANGED
|
@@ -14,7 +14,7 @@ module.exports = {
|
|
|
14
14
|
function Homebridges(devices, context) {
|
|
15
15
|
// debug("Homebridges", devices);
|
|
16
16
|
this.homebridges = [];
|
|
17
|
-
devices.forEach(function(element) {
|
|
17
|
+
devices.forEach(function (element) {
|
|
18
18
|
var homebridge = new Homebridge(element, context);
|
|
19
19
|
this.homebridges.push(homebridge);
|
|
20
20
|
}.bind(this));
|
|
@@ -27,7 +27,7 @@ function Homebridges(devices, context) {
|
|
|
27
27
|
* @return {type} description
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
-
Homebridges.prototype.toList = function(opt) {
|
|
30
|
+
Homebridges.prototype.toList = function (opt) {
|
|
31
31
|
var list = [];
|
|
32
32
|
for (var index in this.homebridges) {
|
|
33
33
|
var homebridge = this.homebridges[index];
|
|
@@ -40,7 +40,7 @@ Homebridges.prototype.toList = function(opt) {
|
|
|
40
40
|
return (list);
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
Homebridges.prototype.toAlexa = function(opt, message) {
|
|
43
|
+
Homebridges.prototype.toAlexa = function (opt, message) {
|
|
44
44
|
var list = [];
|
|
45
45
|
for (var index in this.homebridges) {
|
|
46
46
|
var homebridge = this.homebridges[index];
|
|
@@ -79,10 +79,10 @@ Homebridges.prototype.toAlexa = function(opt, message) {
|
|
|
79
79
|
return (response);
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
-
Homebridges.prototype.toEvents = function(endpoint) {
|
|
82
|
+
Homebridges.prototype.toEvents = function (endpoint) {
|
|
83
83
|
// debug("toEvents");
|
|
84
84
|
var list = [];
|
|
85
|
-
this.homebridges.forEach(function(homebridge) {
|
|
85
|
+
this.homebridges.forEach(function (homebridge) {
|
|
86
86
|
// debug("accessories", homebridge.accessories.length);
|
|
87
87
|
for (var index in homebridge.accessories) {
|
|
88
88
|
var accessory = homebridge.accessories[index];
|
|
@@ -91,12 +91,16 @@ Homebridges.prototype.toEvents = function(endpoint) {
|
|
|
91
91
|
for (var index in accessory.services) {
|
|
92
92
|
var service = accessory.services[index];
|
|
93
93
|
// debug("characteristics", service.characteristics.length);
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
if (service.name === "Alexa" && service.service === "Contact Sensor" && service.info.Manufacturer === "homebridge-alexa") {
|
|
95
|
+
// Skip the Alexa contact sensors made by the plugin
|
|
96
|
+
} else {
|
|
97
|
+
for (var index in service.characteristics) {
|
|
98
|
+
var hapEvents = service.characteristics[index].hapEvents;
|
|
99
|
+
if (Object.keys(hapEvents).length > 0) {
|
|
100
|
+
list = Object.assign(list, hapEvents);
|
|
101
|
+
// debug("hapEvents", hapEvents, Object.keys(hapEvents).length);
|
|
102
|
+
// debug("List", list);
|
|
103
|
+
}
|
|
100
104
|
}
|
|
101
105
|
}
|
|
102
106
|
}
|
|
@@ -119,7 +123,7 @@ Homebridges.prototype.toEvents = function(endpoint) {
|
|
|
119
123
|
};
|
|
120
124
|
*/
|
|
121
125
|
|
|
122
|
-
Homebridges.prototype.findDevice = function(node) {
|
|
126
|
+
Homebridges.prototype.findDevice = function (node) {
|
|
123
127
|
var list = [];
|
|
124
128
|
for (var index in this.homebridges) {
|
|
125
129
|
var homebridge = this.homebridges[index];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "homebridge-alexa",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.63-beta.5",
|
|
4
4
|
"description": "Control your Homebridge devices with Amazon Alexa.",
|
|
5
5
|
"main": "plugin.js",
|
|
6
6
|
"scripts": {
|
|
@@ -33,15 +33,15 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@oznu/hap-client": "^1.8.1",
|
|
36
|
-
"documentation": "^
|
|
36
|
+
"documentation": "^14.0.1",
|
|
37
37
|
"nodemon": "^2.0.4"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"bottleneck": ">=2.19.5",
|
|
41
41
|
"debug": ">=4.3.3",
|
|
42
|
-
"hap-node-client": ">=0.1.
|
|
42
|
+
"hap-node-client": ">=0.1.29",
|
|
43
43
|
"is-my-json-valid": ">=2.20.6",
|
|
44
|
-
"mqtt": "4.
|
|
44
|
+
"mqtt": "4.3.7"
|
|
45
45
|
},
|
|
46
46
|
"author": "NorthernMan54",
|
|
47
47
|
"license": "Apache-2.0",
|
package/plugin.js
CHANGED
|
@@ -12,7 +12,7 @@ let Service, Characteristic;
|
|
|
12
12
|
var options = {};
|
|
13
13
|
var alexaService;
|
|
14
14
|
|
|
15
|
-
module.exports = function(homebridge) {
|
|
15
|
+
module.exports = function (homebridge) {
|
|
16
16
|
Service = homebridge.hap.Service;
|
|
17
17
|
Characteristic = homebridge.hap.Characteristic;
|
|
18
18
|
|
|
@@ -40,14 +40,20 @@ function alexaHome(log, config, api) {
|
|
|
40
40
|
this.deviceList = config['deviceList'] || []; // Use ea
|
|
41
41
|
this.door = config['door'] || false; // Use mode controller for Garage Doors
|
|
42
42
|
this.name = config['name'] || "homebridgeAlexa";
|
|
43
|
-
|
|
43
|
+
this.wssTransport = config['wssTransport'] || false; // Default to existing Transport
|
|
44
|
+
this.mqttsTransport = config['mqttsTransport'] || false; // Default to existing Transport
|
|
45
|
+
var mqttKeepalive = config['keepalive'] || 5; // MQTT Connection Keepalive
|
|
46
|
+
|
|
47
|
+
if (mqttKeepalive < 60) {
|
|
48
|
+
this.keepalive = mqttKeepalive * 60;
|
|
49
|
+
} else {
|
|
50
|
+
this.keepalive = mqttKeepalive;
|
|
51
|
+
}
|
|
44
52
|
|
|
45
|
-
if(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.keepalive = mqttKeepalive;
|
|
50
|
-
}
|
|
53
|
+
if (this.wssTransport && this.mqttsTransport) {
|
|
54
|
+
this.log.error("ERROR: wssTransport and mqttsTransport configured, defaulting to mqttsTransport.");
|
|
55
|
+
this.wssTransport = false;
|
|
56
|
+
}
|
|
51
57
|
|
|
52
58
|
// Enable config based DEBUG logging enable
|
|
53
59
|
this.debug = config['debug'] || false;
|
|
@@ -85,7 +91,7 @@ function alexaHome(log, config, api) {
|
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
alexaHome.prototype = {
|
|
88
|
-
accessories: function(callback) {
|
|
94
|
+
accessories: function (callback) {
|
|
89
95
|
// this.log("Accessories");
|
|
90
96
|
var accessories = [];
|
|
91
97
|
accessories.push(new AlexaService(this.name, this.log));
|
|
@@ -93,25 +99,26 @@ alexaHome.prototype = {
|
|
|
93
99
|
}
|
|
94
100
|
};
|
|
95
101
|
|
|
96
|
-
alexaHome.prototype.didFinishLaunching = function() {
|
|
97
|
-
var host = 'alexa.homebridge.ca';
|
|
102
|
+
alexaHome.prototype.didFinishLaunching = function () {
|
|
103
|
+
var host = (this.wssTransport ? 'www.homebridge.ca' : 'alexa.homebridge.ca');
|
|
104
|
+
var reconnectPeriod = 65000; // Increased reconnect period to allow DDOS protection to reset
|
|
98
105
|
if (this.beta) {
|
|
99
|
-
host = '
|
|
106
|
+
host = 'clone.homebridge.ca';
|
|
100
107
|
}
|
|
101
108
|
options = {
|
|
102
109
|
// Shared Options
|
|
103
110
|
log: this.log,
|
|
104
111
|
debug: this.debug,
|
|
105
112
|
// MQTT Options
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
mqttURL: (this.wssTransport ? "wss://" + host + "/ws" : (this.mqttsTransport ? "mqtts://" + host + ":8883/" : "mqtt://" + host + ":1883/")),
|
|
114
|
+
transport: (this.wssTransport ? "wss" : (this.mqttsTransport ? "mqtts" : "mqtt")),
|
|
115
|
+
mqttOptions: {
|
|
116
|
+
username: this.username,
|
|
117
|
+
password: this.password,
|
|
118
|
+
reconnectPeriod: reconnectPeriod, // Increased reconnect period to allow DDOS protection to reset
|
|
119
|
+
keepalive: (this.wssTransport ? 55 : this.keepalive), // Keep alive not required when using WSS Transport
|
|
120
|
+
rejectUnauthorized: false
|
|
121
|
+
},
|
|
115
122
|
// HAP Node Client options
|
|
116
123
|
pin: this.pin,
|
|
117
124
|
refresh: this.refresh,
|
|
@@ -144,8 +151,14 @@ alexaHome.prototype.didFinishLaunching = function() {
|
|
|
144
151
|
|
|
145
152
|
// Alexa mesages
|
|
146
153
|
|
|
147
|
-
this.eventBus.on('System', function(message) {
|
|
148
|
-
this.log.error("ERROR:
|
|
154
|
+
this.eventBus.on('System', function (message) {
|
|
155
|
+
this.log.error("ERROR:", message.directive.header.message);
|
|
156
|
+
}.bind(this));
|
|
157
|
+
this.eventBus.on('Warning', function (message) {
|
|
158
|
+
this.log.warn("Warning:", message.directive.header.message);
|
|
159
|
+
}.bind(this));
|
|
160
|
+
this.eventBus.on('Information', function (message) {
|
|
161
|
+
this.log("Info:", message.directive.header.message);
|
|
149
162
|
}.bind(this));
|
|
150
163
|
this.eventBus.on('Alexa', alexaActions.alexaMessage.bind(this));
|
|
151
164
|
this.eventBus.on('Alexa.Discovery', alexaActions.alexaDiscovery.bind(this));
|
|
@@ -177,7 +190,7 @@ function AlexaService(name, log) {
|
|
|
177
190
|
}
|
|
178
191
|
|
|
179
192
|
AlexaService.prototype = {
|
|
180
|
-
getServices: function() {
|
|
193
|
+
getServices: function () {
|
|
181
194
|
// this.log("getServices", this.name);
|
|
182
195
|
// Information Service
|
|
183
196
|
var informationService = new Service.AccessoryInformation();
|