async publishData(data) {
        const isPublish = data === undefined ? true : false
        this.publishPolledState(isPublish)

        if (isPublish) { 
            this.publishDingStates()
            if (this.data.snapshot.motion || this.data.snapshot.interval) {
                this.data.snapshot.currentImage ? this.publishSnapshot() : this.refreshSnapshot()
                if (this.data.snapshot.interval) {
                    this.publishSnapshotInterval(isPublish)
                }
            }
            this.publishAttributes()
        }

        // Check for subscription to ding and motion events and attempt to resubscribe
        if (!this.device.data.subscribed === true) {
            debug('Camera Id '+this.deviceId+' lost subscription to ding events, attempting to resubscribe...')
            this.device.subscribeToDingEvents().catch(e => { 
                debug('Failed to resubscribe camera Id ' +this.deviceId+' to ding events. Will retry in 60 seconds.') 
                debug(e)
            })
        }
        if (!this.device.data.subscribed_motions === true) {
            debug('Camera Id '+this.deviceId+' lost subscription to motion events, attempting to resubscribe...')
            this.device.subscribeToMotionEvents().catch(e => {
                debug('Failed to resubscribe camera Id '+this.deviceId+' to motion events.  Will retry in 60 seconds.')
                debug(e)
            })
        }
    }
// Publish camera capabilities and state and subscribe to events
Publish camera capabilities and state and subscribe to events
Publish camera capabilities and state and subscribe to events
async publishData(data) {
        const isPublish = data === undefined ? true : false
        this.publishPolledState(isPublish)
        if (isPublish) { 
            this.publishDingStates()
            if (this.data.snapshot.motion || this.data.snapshot.interval) {
                this.data.snapshot.currentImage ? this.publishSnapshot() : this.refreshSnapshot()
                if (this.data.snapshot.interval) {
                    this.publishSnapshotInterval(isPublish)
                }
            }
            this.publishAttributes()
        }
        if (!this.device.data.subscribed === true) {
            debug('Camera Id '+this.deviceId+' lost subscription to ding events, attempting to resubscribe...')
            this.device.subscribeToDingEvents().catch(e => { 
                debug('Failed to resubscribe camera Id ' +this.deviceId+' to ding events. Will retry in 60 seconds.') 
                debug(e)
            })
        }
        if (!this.device.data.subscribed_motions === true) {
            debug('Camera Id '+this.deviceId+' lost subscription to motion events, attempting to resubscribe...')
            this.device.subscribeToMotionEvents().catch(e => {
                debug('Failed to resubscribe camera Id '+this.deviceId+' to motion events.  Will retry in 60 seconds.')
                debug(e)
            })
        }
    }
async publishData ( data ) { const isPublish = data === undefined ? true : false this . publishPolledState ( isPublish ) if ( isPublish ) { this . publishDingStates ( ) if ( this . data . snapshot . motion || this . data . snapshot . interval ) { this . data . snapshot . currentImage ? this . publishSnapshot ( ) : this . refreshSnapshot ( ) if ( this . data . snapshot . interval ) { this . publishSnapshotInterval ( isPublish ) } } this . publishAttributes ( ) } if ( ! this . device . data . subscribed === true ) { debug ( 'Camera Id ' + this . deviceId + ' lost subscription to ding events, attempting to resubscribe...' ) this . device . subscribeToDingEvents ( ) . catch ( e => { debug ( 'Failed to resubscribe camera Id ' + this . deviceId + ' to ding events. Will retry in 60 seconds.' ) debug ( e ) } ) } if ( ! this . device . data . subscribed_motions === true ) { debug ( 'Camera Id ' + this . deviceId + ' lost subscription to motion events, attempting to resubscribe...' ) this . device . subscribeToMotionEvents ( ) . catch ( e => { debug ( 'Failed to resubscribe camera Id ' + this . deviceId + ' to motion events.  Will retry in 60 seconds.' ) debug ( e ) } ) } }
Publish camera capabilities and state and subscribe to events
Publish camera capabilities and state and subscribe to events
// Check for subscription to ding and motion events and attempt to resubscribe