mirror of
https://github.com/tsightler/ring-mqtt.git
synced 2025-10-17 06:10:41 +08:00
Update ring-alarm-mqtt to ring-mqtt
Replace legacy ring-alarm-mqtt with ring-mqtt codebase.
This commit is contained in:
24
lib/utils.js
Normal file
24
lib/utils.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const debug = require('debug')('ring-mqtt')
|
||||
const colors = require('colors/safe')
|
||||
const RingApi = require ('ring-client-api').RingApi
|
||||
const mqttApi = require ('mqtt')
|
||||
|
||||
class Utils
|
||||
{
|
||||
|
||||
// Simple sleep function for various required delays
|
||||
sleep(sec) {
|
||||
return new Promise(res => setTimeout(res, sec*1000))
|
||||
}
|
||||
|
||||
// Check if location has alarm panel (could be only camera/lights)
|
||||
hasAlarm(devices) {
|
||||
if (devices.filter(device => device.data.deviceType === 'security-panel')) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = new Utils()
|
Reference in New Issue
Block a user