mirror of
https://github.com/tsightler/ring-mqtt.git
synced 2025-09-26 21:01:12 +08:00
Release v5.7.3
This commit is contained in:
@@ -41,7 +41,7 @@ else
|
|||||||
|
|
||||||
# If debug is not explicitly defined, use default
|
# If debug is not explicitly defined, use default
|
||||||
if [ ! -v DEBUG ]; then
|
if [ ! -v DEBUG ]; then
|
||||||
export DEBUG="ring*"
|
export DEBUG="ring-*"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
30
lib/main.js
30
lib/main.js
@@ -8,34 +8,20 @@ import chalk from 'chalk'
|
|||||||
import isOnline from 'is-online'
|
import isOnline from 'is-online'
|
||||||
import debugModule from 'debug'
|
import debugModule from 'debug'
|
||||||
const debug = debugModule('ring-mqtt')
|
const debug = debugModule('ring-mqtt')
|
||||||
const debugApi = debugModule('ring-rapi')
|
|
||||||
|
|
||||||
export default new class Main {
|
export default new class Main {
|
||||||
constructor() {
|
constructor() {
|
||||||
// Hack to suppress spurious various messages from client libraries
|
console.warn = (data) => {
|
||||||
const processStderrWrite = process.stderr.write;
|
if (data.includes('PHONE_REGISTRATION_ERROR') ||
|
||||||
|
data.startsWith('Retry...') ||
|
||||||
process.stderr.write = function(chunk) {
|
data.includes('Message dropped as it could not be decrypted:')
|
||||||
const message = chunk.toString()
|
) {
|
||||||
|
return
|
||||||
if (message.match ('^.*ring-')) {
|
|
||||||
return processStderrWrite.call(process.stderr, chunk)
|
|
||||||
}
|
}
|
||||||
|
console.error(data);
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start event listeners
|
// Start event listeners
|
||||||
utils.event.on('generated_token', (generatedToken) => {
|
utils.event.on('generated_token', (generatedToken) => {
|
||||||
this.init(generatedToken)
|
this.init(generatedToken)
|
||||||
})
|
})
|
||||||
|
42
lib/ring.js
42
lib/ring.js
@@ -155,17 +155,12 @@ export default new class RingMqtt {
|
|||||||
debug(' '+chalk.green(location.name)+chalk.cyan(` (${location.id})`))
|
debug(' '+chalk.green(location.name)+chalk.cyan(` (${location.id})`))
|
||||||
})
|
})
|
||||||
debug(' '.repeat(90))
|
debug(' '.repeat(90))
|
||||||
debug(chalk.yellowBright('IMPORTANT: ')+chalk.white('If *ANY* alarm or smart lighting hubs at these locations are *OFFLINE* '))
|
debug(chalk.yellowBright('IMPORTANT: ')+chalk.white('If any alarm or smart lighting hubs for a location are in any state other '))
|
||||||
debug(chalk.white(' the device discovery process below will hang and no devices will be '))
|
debug(chalk.white(' than *ONLINE*, including *OFFLINE* or *CELL BACKUP*, device discovery will '))
|
||||||
debug(chalk.white(' published! '))
|
debug(chalk.white(' hang and no devices will be published until the hub returns to *ONLINE* state. '))
|
||||||
debug(' '.repeat(90))
|
debug(' '.repeat(90))
|
||||||
debug(chalk.white(' If the message "Device Discovery Complete!" is not logged below, please'))
|
debug(chalk.white(' If desired, the "location_ids" config option can be used to restrict '))
|
||||||
debug(chalk.white(' carefully check the Ring app for any hubs or smart lighting devices '))
|
debug(chalk.white(' discovery to specific locations. See the documentation for details. '))
|
||||||
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.green('-'.repeat(90)))
|
debug(chalk.green('-'.repeat(90)))
|
||||||
debug(chalk.white('Starting Device Discovery...'))
|
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
|
// 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) {
|
if (utils.config().enable_cameras) {
|
||||||
cameras = location.cameras
|
cameras = location.cameras
|
||||||
|
10
package-lock.json
generated
10
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "ring-mqtt",
|
"name": "ring-mqtt",
|
||||||
"version": "5.7.3-dev",
|
"version": "5.7.3",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "ring-mqtt",
|
"name": "ring-mqtt",
|
||||||
"version": "5.7.3-dev",
|
"version": "5.7.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@homebridge/camera-utils": "^2.2.7",
|
"@homebridge/camera-utils": "^2.2.7",
|
||||||
@@ -693,9 +693,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "22.9.2",
|
"version": "22.9.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.2.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.9.3.tgz",
|
||||||
"integrity": "sha512-wwuxAVEbsRvDD9x7buvAl7DyQ7Oj+va/d/Veug7higYzp9MF0CINbfWTBgDFMpcVwcdUiYuNmX2KfnvY3N70mw==",
|
"integrity": "sha512-F3u1fs/fce3FFk+DAxbxc78DF8x0cY09RRL8GnXLmkJ1jvx3TtPdWoTT5/NiYfI5ASqXBmfqJi9dZ3gxMx4lzw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~6.19.8"
|
"undici-types": "~6.19.8"
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ring-mqtt",
|
"name": "ring-mqtt",
|
||||||
"version": "5.7.3-dev",
|
"version": "5.7.3",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"description": "Ring Devices via MQTT",
|
"description": "Ring Devices via MQTT",
|
||||||
"main": "ring-mqtt.js",
|
"main": "ring-mqtt.js",
|
||||||
|
Reference in New Issue
Block a user