mirror of
https://github.com/tsightler/ring-mqtt.git
synced 2025-10-16 13:50:54 +08:00
Release v5.0.0
This commit is contained in:
@@ -14,31 +14,31 @@ class BinarySensor extends RingSocketDevice {
|
|||||||
this.entityName = 'contact'
|
this.entityName = 'contact'
|
||||||
this.deviceData.mdl = 'Contact Sensor'
|
this.deviceData.mdl = 'Contact Sensor'
|
||||||
device_class = (this.device.data.subCategoryId == 2) ? 'window' : 'door'
|
device_class = (this.device.data.subCategoryId == 2) ? 'window' : 'door'
|
||||||
bypass_modes = [ 'never', 'faulted', 'always' ]
|
bypass_modes = [ 'Never', 'Faulted', 'Always' ]
|
||||||
break;
|
break;
|
||||||
case RingDeviceType.MotionSensor:
|
case RingDeviceType.MotionSensor:
|
||||||
this.entityName = 'motion'
|
this.entityName = 'motion'
|
||||||
this.deviceData.mdl = 'Motion Sensor',
|
this.deviceData.mdl = 'Motion Sensor',
|
||||||
device_class = 'motion'
|
device_class = 'motion'
|
||||||
bypass_modes = [ 'never', 'always' ]
|
bypass_modes = [ 'Never', 'Always' ]
|
||||||
break;
|
break;
|
||||||
case RingDeviceType.RetrofitZone:
|
case RingDeviceType.RetrofitZone:
|
||||||
this.entityName = 'zone'
|
this.entityName = 'zone'
|
||||||
this.deviceData.mdl = 'Retrofit Zone'
|
this.deviceData.mdl = 'Retrofit Zone'
|
||||||
device_class = 'safety'
|
device_class = 'safety'
|
||||||
bypass_modes = [ 'never', 'faulted', 'always' ]
|
bypass_modes = [ 'Never', 'Faulted', 'Always' ]
|
||||||
break;
|
break;
|
||||||
case RingDeviceType.TiltSensor:
|
case RingDeviceType.TiltSensor:
|
||||||
this.entityName = 'tilt'
|
this.entityName = 'tilt'
|
||||||
this.deviceData.mdl = 'Tilt Sensor'
|
this.deviceData.mdl = 'Tilt Sensor'
|
||||||
device_class = 'garage_door'
|
device_class = 'garage_door'
|
||||||
bypass_modes = [ 'never', 'faulted', 'always' ]
|
bypass_modes = [ 'Never', 'Faulted', 'Always' ]
|
||||||
break;
|
break;
|
||||||
case RingDeviceType.GlassbreakSensor:
|
case RingDeviceType.GlassbreakSensor:
|
||||||
this.entityName = 'glassbreak'
|
this.entityName = 'glassbreak'
|
||||||
this.deviceData.mdl = 'Glassbreak Sensor'
|
this.deviceData.mdl = 'Glassbreak Sensor'
|
||||||
device_class = 'safety'
|
device_class = 'safety'
|
||||||
bypass_modes = [ 'never', 'always' ]
|
bypass_modes = [ 'Never', 'Always' ]
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (this.device.name.toLowerCase().includes('motion')) {
|
if (this.device.name.toLowerCase().includes('motion')) {
|
||||||
@@ -63,7 +63,7 @@ class BinarySensor extends RingSocketDevice {
|
|||||||
const savedState = this.getSavedState()
|
const savedState = this.getSavedState()
|
||||||
|
|
||||||
this.data = {
|
this.data = {
|
||||||
bypass_mode: savedState?.bypass_mode ? savedState.bypass_mode: 'Never',
|
bypass_mode: savedState?.bypass_mode ? savedState.bypass_mode[0].toUpperCase() + savedState.bypass_mode.slice(1) : 'Never',
|
||||||
published_bypass_mode: false
|
published_bypass_mode: false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,11 +115,13 @@ class BinarySensor extends RingSocketDevice {
|
|||||||
|
|
||||||
// Set Stream Select Option
|
// Set Stream Select Option
|
||||||
async setBypassMode(message) {
|
async setBypassMode(message) {
|
||||||
if (this.entity.bypass_mode.options.includes(message)) {
|
const mode = message[0].toUpperCase() + message.slide(1)
|
||||||
|
if (this.entity.bypass_mode.options.includes(mode)) {
|
||||||
this.debug(`Received set bypass mode to ${message}`)
|
this.debug(`Received set bypass mode to ${message}`)
|
||||||
this.data.bypass_mode = message
|
this.data.bypass_mode = mode
|
||||||
this.publishBypassModeState()
|
this.publishBypassModeState()
|
||||||
this.updateDeviceState()
|
this.updateDeviceState()
|
||||||
|
this.debug(`Bypass mode has been set to ${mode}`)
|
||||||
} else {
|
} else {
|
||||||
this.debug(`Received invalid bypass mode for this sensor: ${message}`)
|
this.debug(`Received invalid bypass mode for this sensor: ${message}`)
|
||||||
}
|
}
|
||||||
|
@@ -31,8 +31,8 @@ class Camera extends RingPolledDevice {
|
|||||||
} : {},
|
} : {},
|
||||||
snapshot: {
|
snapshot: {
|
||||||
mode: savedState?.snapshot?.mode
|
mode: savedState?.snapshot?.mode
|
||||||
? savedState.snapshot.mode
|
? savedState.snapshot.mode[0].toUpperCase() + savedState.snapshot.mode.slice(1)
|
||||||
: 'auto',
|
: 'Auto',
|
||||||
motion: false,
|
motion: false,
|
||||||
interval: false,
|
interval: false,
|
||||||
autoInterval: savedState?.snapshot?.autoInterval
|
autoInterval: savedState?.snapshot?.autoInterval
|
||||||
@@ -146,7 +146,7 @@ class Camera extends RingPolledDevice {
|
|||||||
},
|
},
|
||||||
snapshot_mode: {
|
snapshot_mode: {
|
||||||
component: 'select',
|
component: 'select',
|
||||||
options: [ 'auto', 'disabled', 'motion', 'interval', 'all' ]
|
options: [ 'Auto', 'Disabled', 'Motion', 'Interval', 'All' ]
|
||||||
},
|
},
|
||||||
snapshot_interval: {
|
snapshot_interval: {
|
||||||
component: 'number',
|
component: 'number',
|
||||||
@@ -894,22 +894,23 @@ class Camera extends RingPolledDevice {
|
|||||||
|
|
||||||
setSnapshotMode(message) {
|
setSnapshotMode(message) {
|
||||||
this.debug(`Received set snapshot mode to ${message}`)
|
this.debug(`Received set snapshot mode to ${message}`)
|
||||||
switch(message.toLowerCase()) {
|
const mode = message[0].toUpperCase() + message.slide(1)
|
||||||
case 'auto':
|
switch(mode) {
|
||||||
|
case 'Auto':
|
||||||
this.data.snapshot.autoInterval = true
|
this.data.snapshot.autoInterval = true
|
||||||
case 'disabled':
|
case 'Disabled':
|
||||||
case 'motion':
|
case 'Motion':
|
||||||
case 'interval':
|
case 'Interval':
|
||||||
case 'all':
|
case 'All':
|
||||||
this.data.snapshot.mode = message
|
this.data.snapshot.mode = mode
|
||||||
this.updateSnapshotMode()
|
this.updateSnapshotMode()
|
||||||
this.publishSnapshotMode()
|
this.publishSnapshotMode()
|
||||||
if (message === 'auto') {
|
if (message === 'Auto') {
|
||||||
clearInterval(this.data.snapshot.intervalTimerId)
|
clearInterval(this.data.snapshot.intervalTimerId)
|
||||||
this.scheduleSnapshotRefresh()
|
this.scheduleSnapshotRefresh()
|
||||||
this.publishSnapshotInterval()
|
this.publishSnapshotInterval()
|
||||||
}
|
}
|
||||||
this.debug(`Snapshot mode as been set to ${message}`)
|
this.debug(`Snapshot mode has been set to ${mode}`)
|
||||||
this.updateDeviceState()
|
this.updateDeviceState()
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@@ -155,7 +155,7 @@ class SecurityPanel extends RingSocketDevice {
|
|||||||
// Loop through all bypass eligible devices and bypass based on settings/state
|
// Loop through all bypass eligible devices and bypass based on settings/state
|
||||||
for (const device of bypassDevices) {
|
for (const device of bypassDevices) {
|
||||||
const bypassMode = savedStates[device.id]?.bypass_mode
|
const bypassMode = savedStates[device.id]?.bypass_mode
|
||||||
if (bypassMode === 'Always' || bypassMode === 'Faulted' && device.data.faulted) {
|
if (bypassMode === 'Always' || (bypassMode === 'Faulted' && device.data.faulted)) {
|
||||||
bypassDeviceIds.push(device.id)
|
bypassDeviceIds.push(device.id)
|
||||||
bypassDeviceNames.push(`${device.name} [${bypassMode}]`)
|
bypassDeviceNames.push(`${device.name} [${bypassMode}]`)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user