async publishAttributes() {
        const deviceHealth = await this.device.getHealth()
        
        if (deviceHealth) {
            const attributes = {}
            if (this.device.hasBattery) {
                attributes.batteryLevel = deviceHealth.battery_percentage
            }
            attributes.firmwareStatus = deviceHealth.firmware
            attributes.lastUpdate = deviceHealth.updated_at.slice(0,-6)+"Z"
            if (deviceHealth.hasOwnProperty('network_connection') && deviceHealth.network_connection === 'ethernet') {
                attributes.wiredNetwork = this.device.data.alerts.connection
            } else {
                attributes.wirelessNetwork = deviceHealth.wifi_name
                attributes.wirelessSignal = deviceHealth.latest_signal_strength
            }            
            this.publishMqtt(this.entity.info.state_topic, JSON.stringify(attributes), true)
            this.publishAttributeEntities(attributes)
        }
    }
// Publish device data to info topic
Publish device data to info topic
Publish device data to info topic
async publishAttributes() {
        const deviceHealth = await this.device.getHealth()
        if (deviceHealth) {
            const attributes = {}
            if (this.device.hasBattery) {
                attributes.batteryLevel = deviceHealth.battery_percentage
            }
            attributes.firmwareStatus = deviceHealth.firmware
            attributes.lastUpdate = deviceHealth.updated_at.slice(0,-6)+"Z"
            if (deviceHealth.hasOwnProperty('network_connection') && deviceHealth.network_connection === 'ethernet') {
                attributes.wiredNetwork = this.device.data.alerts.connection
            } else {
                attributes.wirelessNetwork = deviceHealth.wifi_name
                attributes.wirelessSignal = deviceHealth.latest_signal_strength
            }            
            this.publishMqtt(this.entity.info.state_topic, JSON.stringify(attributes), true)
            this.publishAttributeEntities(attributes)
        }
    }
async publishAttributes ( ) { const deviceHealth = await this . device . getHealth ( ) if ( deviceHealth ) { const attributes = { } if ( this . device . hasBattery ) { attributes . batteryLevel = deviceHealth . battery_percentage } attributes . firmwareStatus = deviceHealth . firmware attributes . lastUpdate = deviceHealth . updated_at . slice ( 0 , - 6 ) + "Z" if ( deviceHealth . hasOwnProperty ( 'network_connection' ) && deviceHealth . network_connection === 'ethernet' ) { attributes . wiredNetwork = this . device . data . alerts . connection } else { attributes . wirelessNetwork = deviceHealth . wifi_name attributes . wirelessSignal = deviceHealth . latest_signal_strength } this . publishMqtt ( this . entity . info . state_topic , JSON . stringify ( attributes ) , true ) this . publishAttributeEntities ( attributes ) } }
Publish device data to info topic
Publish device data to info topic