mirror of
https://github.com/tsightler/ring-mqtt.git
synced 2025-09-26 21:01:12 +08:00
26 lines
792 B
JavaScript
26 lines
792 B
JavaScript
import RingSocketDevice from './base-socket-device.js'
|
|
|
|
export default class PanicButton extends RingSocketDevice {
|
|
constructor(deviceInfo) {
|
|
super(deviceInfo, 'alarm')
|
|
this.deviceData.mdl = 'Panic Button'
|
|
|
|
|
|
// Listen to raw data updates for all devices and log any events
|
|
this.device.location.onDataUpdate.subscribe(async (message) => {
|
|
if (!this.isOnline()) { return }
|
|
|
|
if (message.datatype === 'DeviceInfoDocType' &&
|
|
message.body?.[0]?.general?.v2?.zid === this.deviceId
|
|
) {
|
|
this.debug(JSON.stringify(message), 'data')
|
|
}
|
|
})
|
|
|
|
}
|
|
|
|
publishState() {
|
|
// This device only has attributes and attribute based entities
|
|
this.publishAttributes()
|
|
}
|
|
} |