homebridge-alexa 0.8.1-beta.1 → 0.8.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.
package/CHANGELOG.md CHANGED
@@ -2,9 +2,17 @@
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.8.2 (2024-12-27)
6
+
7
+ ## [Version 0.8.2](https://github.com/northernman54/homebridge-alexa/compare/v0.8.1...v0.8.2)
8
+
9
+ #### Bug Fix
10
+
11
+ - Doorbell events not being received
12
+
5
13
  ## 0.8.1 (2024-12-24)
6
14
 
7
- ## [Version 0.8.0](https://github.com/northernman54/homebridge-alexa/compare/v0.8.0...v0.8.1)
15
+ ## [Version 0.8.1](https://github.com/northernman54/homebridge-alexa/compare/v0.8.0...v0.8.1)
8
16
 
9
17
  #### Bug Fix
10
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "homebridge-alexa",
3
- "version": "0.8.1-beta.1",
3
+ "version": "0.8.2",
4
4
  "description": "Control your Homebridge devices with Amazon Alexa.",
5
5
  "main": "src/plugin.js",
6
6
  "scripts": {
@@ -73,4 +73,4 @@
73
73
  "src/**"
74
74
  ]
75
75
  }
76
- }
76
+ }
@@ -161,16 +161,25 @@ function handleError(err, options) {
161
161
  }
162
162
 
163
163
  function alexaEvent(message) {
164
- publishMessage(`event/${username}/1`, message);
164
+ var topic = "event/" + username + "/1";
165
+ var publish = function (callback) {
166
+ debug("Sending message", topic, JSON.stringify(message));
167
+ connection.client.publish(topic, JSON.stringify(message), {
168
+ retain: false
169
+ }, callback);
170
+ };
171
+ limiter.submit(publish);
165
172
  }
166
173
 
167
174
  function alexaPriorityEvent(message) {
168
- limiter.submit({ priority: 4 }, publishMessage, `event/${username}/1`, message);
169
- }
170
-
171
- function publishMessage(topic, message, callback) {
172
- debug("Publishing message", topic, JSON.stringify(message));
173
- connection.client.publish(topic, JSON.stringify(message), { retain: false }, callback);
175
+ var topic = "event/" + username + "/1";
176
+ var publish = function (callback) {
177
+ debug("Sending priority message", topic, JSON.stringify(message));
178
+ connection.client.publish(topic, JSON.stringify(message), {
179
+ retain: false
180
+ }, callback);
181
+ };
182
+ limiter.submit({ priority: 4 }, publish);
174
183
  }
175
184
 
176
185
  function createAlexaErrorResponse(message) {
@@ -1,85 +0,0 @@
1
- #!/bin/env node
2
-
3
- /**
4
- * This scripts queries the npm registry to pull out the latest version for a given tag.
5
- */
6
-
7
- const assert = require('node:assert')
8
- const child_process = require('node:child_process')
9
- const fs = require('node:fs')
10
- const process = require('node:process')
11
-
12
- const semver = require('semver')
13
-
14
- const BRANCH_VERSION_PATTERN = /^([A-Z]+)-(\d+\.\d+\.\d+)$/i
15
-
16
- // Load the contents of the package.json file
17
- const packageJSON = JSON.parse(fs.readFileSync('package.json', 'utf8'))
18
-
19
- const refArgument = process.argv[2]
20
- const tagArgument = process.argv[3] || 'latest'
21
-
22
- if (refArgument == null) {
23
- console.error('ref argument is missing')
24
- console.error('Usage: npm-version-script.js <ref> [tag]')
25
- process.exit(1)
26
- }
27
-
28
- /**
29
- * Queries the NPM registry for the latest version for the provided tag.
30
- * @param tag The tag to query for.
31
- * @returns {string} Returns the version.
32
- */
33
- function getTagVersionFromNpm(tag) {
34
- try {
35
- return child_process.execSync(`npm info ${packageJSON.name} version --tag="${tag}"`).toString('utf8').trim()
36
- } catch (e) {
37
- console.error(`Failed to query the npm registry for the latest version for tag: ${tag}`)
38
- // throw e;
39
- return '0.0.0'
40
- }
41
- }
42
-
43
- function desiredTargetVersion(ref) {
44
- // ref is a GitHub action ref string
45
- if (ref.startsWith('refs/pull/')) {
46
- throw new Error('The version script was executed inside a PR!')
47
- }
48
-
49
- assert(ref.startsWith('refs/heads/'))
50
- const branchName = ref.slice('refs/heads/'.length)
51
-
52
- const results = branchName.match(BRANCH_VERSION_PATTERN)
53
- if (results != null) {
54
- if (results[1] !== tagArgument) {
55
- console.warn(`The base branch name (${results[1]}) differs from the tag name ${tagArgument}`)
56
- }
57
-
58
- return results[2]
59
- }
60
-
61
- throw new Error(`Malformed branch name for ref: ${ref}. Can't derive the base version. Use a branch name like: beta-x.x.x or alpha-x.x.x`)
62
- }
63
-
64
- // derive the base version from the branch ref
65
- const baseVersion = desiredTargetVersion(refArgument)
66
-
67
- // query the npm registry for the latest version of the provided tag name
68
- const latestReleasedVersion = getTagVersionFromNpm(tagArgument) // e.g. 0.7.0-beta.12
69
- const latestReleaseBase = semver.inc(latestReleasedVersion, 'patch') // will produce 0.7.0 (removing the preid, needed for the equality check below)
70
-
71
- let publishTag
72
- if (semver.eq(baseVersion, latestReleaseBase)) { // check if we are releasing another version for the latest beta or alpha
73
- publishTag = latestReleasedVersion // set the current latest beta or alpha to be incremented
74
- } else {
75
- publishTag = baseVersion // start of with a new beta or alpha version
76
- }
77
-
78
- // save the package.json
79
- packageJSON.version = publishTag
80
- fs.writeFileSync('package.json', JSON.stringify(packageJSON, null, 2))
81
-
82
- // perform the same change to the package-lock.json
83
- const packageLockJSON = JSON.parse(fs.readFileSync('package-lock.json', 'utf8'))
84
- packageLockJSON.version = publishTag
85
- fs.writeFileSync('package-lock.json', JSON.stringify(packageLockJSON, null, 2))