'
retResult += name + ' | '
String attrUnit = getUnitFromState(key)
if (attrUnit == null) attrUnit = ""
def curVal = device.currentValue(key,true)
if (curVal != null) {
if (convert == "int") {
retResult += safeToInt(curVal).toString() + " " + attrUnit
}
else if (convert == "double") {
retResult += safeToDouble(curVal).toString() + " " + attrUnit
}
else
retResult += curVal.toString() + " " + attrUnit
}
else {
retResult += "n/a"
}
retResult += ' |
'
return retResult
}
String getUnitFromState(String attrName){
return device.currentState(attrName)?.unit
}
void updateAttr(String aKey, aValue, String aUnit = "") {
sendEvent(name:aKey, value:aValue, unit:aUnit)
}
def deviceNotification(text) {
if (settings?.logEnable) log.debug "deviceNotification: ${text}"
}
def logDebug(msg) {
if (settings?.logEnable) {
log.debug "${device.displayName} " + msg
}
}
def logInfo(msg) {
if (settings?.txtEnable) {
log.info "${device.displayName} " + msg
}
}
def logWarn(msg) {
if (settings?.logEnable) {
log.warn "${device.displayName} " + msg
}
}
def pulseConfiguration( pulses ) {
List