Release v5.7.3

This commit is contained in:
Tom Sightler
2024-11-23 21:19:30 -05:00
parent 5059fee8d2
commit 4accb8a7d2
5 changed files with 46 additions and 40 deletions

View File

@@ -41,7 +41,7 @@ else
# If debug is not explicitly defined, use default
if [ ! -v DEBUG ]; then
export DEBUG="ring*"
export DEBUG="ring-*"
fi
fi

View File

@@ -8,34 +8,20 @@ import chalk from 'chalk'
import isOnline from 'is-online'
import debugModule from 'debug'
const debug = debugModule('ring-mqtt')
const debugApi = debugModule('ring-rapi')
export default new class Main {
constructor() {
// Hack to suppress spurious various messages from client libraries
const processStderrWrite = process.stderr.write;
process.stderr.write = function(chunk) {
const message = chunk.toString()
if (message.match ('^.*ring-')) {
return processStderrWrite.call(process.stderr, chunk)
console.warn = (data) => {
if (data.includes('PHONE_REGISTRATION_ERROR') ||
data.startsWith('Retry...') ||
data.includes('Message dropped as it could not be decrypted:')
) {
return
}
if (message.match('^.*ring.*is offline or on cellular backup. Waiting for status to change')) {
debug(chalk.yellow(message.match(/Ring.*?(?=\s*$)/)[0]))
return true
}
if (message.trim().toLowerCase().startsWith('ring ')) {
debugApi(message.split(/ring\s+/i)[1])
return true
}
return true
console.error(data);
}
// Start event listeners
// Start event listeners
utils.event.on('generated_token', (generatedToken) => {
this.init(generatedToken)
})

View File

@@ -155,17 +155,12 @@ export default new class RingMqtt {
debug(' '+chalk.green(location.name)+chalk.cyan(` (${location.id})`))
})
debug(' '.repeat(90))
debug(chalk.yellowBright('IMPORTANT: ')+chalk.white('If *ANY* alarm or smart lighting hubs at these locations are *OFFLINE* '))
debug(chalk.white(' the device discovery process below will hang and no devices will be '))
debug(chalk.white(' published! '))
debug(chalk.yellowBright('IMPORTANT: ')+chalk.white('If any alarm or smart lighting hubs for a location are in any state other '))
debug(chalk.white(' than *ONLINE*, including *OFFLINE* or *CELL BACKUP*, device discovery will '))
debug(chalk.white(' hang and no devices will be published until the hub returns to *ONLINE* state. '))
debug(' '.repeat(90))
debug(chalk.white(' If the message "Device Discovery Complete!" is not logged below, please'))
debug(chalk.white(' carefully check the Ring app for any hubs or smart lighting devices '))
debug(chalk.white(' that are in offline state and either remove them from the location or '))
debug(chalk.white(' bring them back online prior to restarting ring-mqtt. '))
debug(' '.repeat(90))
debug(chalk.white(' If desired, the "location_ids" config option can be used to restrict '))
debug(chalk.white(' discovery to specific locations. See the documentation for details. '))
debug(chalk.white(' If desired, the "location_ids" config option can be used to restrict '))
debug(chalk.white(' discovery to specific locations. See the documentation for details. '))
debug(chalk.green('-'.repeat(90)))
debug(chalk.white('Starting Device Discovery...'))
@@ -190,7 +185,32 @@ export default new class RingMqtt {
}
// Get all location devices and, if camera support is enabled, cameras, chimes and intercoms
const devices = await location.getDevices()
let suppressInterval = 0
const logInterval = setInterval(() => {
// Only output every 300 seconds after first log
if (suppressInterval % 30 === 0 && location.offlineAssets.length > 0) {
debug(`Location ${chalk.green(location.name)} is waiting for the following hubs to be fully online:`)
location.offlineAssets.forEach(offlineAssetUuid => {
const asset = location.assets && location.assets.find(asset => asset.uuid === offlineAssetUuid);
let assetName = asset.kind.startsWith('base_station')
? 'Alarm Base Station'
: asset.kind.startsWith('beams_bridge')
? 'Smart Lighting Bridge'
: asset.kind
if (asset) {
debug(` ${assetName} ${chalk.cyan('('+asset.uuid+')')} status: ${chalk.red(asset.status)}`)
}
})
}
suppressInterval++
}, 10000)
let devices
try {
devices = await location.getDevices();
} finally {
clearInterval(logInterval);
}
if (utils.config().enable_cameras) {
cameras = location.cameras

10
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "ring-mqtt",
"version": "5.7.3-dev",
"version": "5.7.3",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "ring-mqtt",
"version": "5.7.3-dev",
"version": "5.7.3",
"license": "MIT",
"dependencies": {
"@homebridge/camera-utils": "^2.2.7",
@@ -693,9 +693,9 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "22.9.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.2.tgz",
"integrity": "sha512-wwuxAVEbsRvDD9x7buvAl7DyQ7Oj+va/d/Veug7higYzp9MF0CINbfWTBgDFMpcVwcdUiYuNmX2KfnvY3N70mw==",
"version": "22.9.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.3.tgz",
"integrity": "sha512-F3u1fs/fce3FFk+DAxbxc78DF8x0cY09RRL8GnXLmkJ1jvx3TtPdWoTT5/NiYfI5ASqXBmfqJi9dZ3gxMx4lzw==",
"license": "MIT",
"dependencies": {
"undici-types": "~6.19.8"

View File

@@ -1,6 +1,6 @@
{
"name": "ring-mqtt",
"version": "5.7.3-dev",
"version": "5.7.3",
"type": "module",
"description": "Ring Devices via MQTT",
"main": "ring-mqtt.js",