/*
* Z-Wave Universal Smoke/CO Detector
* - Universal Smoke / CO Driver
* - Built for First Alert ZCombo-G
*
* For Support, Information, and Updates:
* https://community.hubitat.com/t/z-wave-universal-smoke-co-detector/127180
* https://github.com/jtp10181/Hubitat/tree/main/Drivers/
*
Changelog:
## [1.0.0] - 2023-11-01 (@jtp10181)
- Initial Release
* Copyright 2023 Jeff Page
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import groovy.transform.Field
@Field static final String VERSION = "1.0.0"
@Field static final String DRIVER = "Smoke-CO"
@Field static final String COMM_LINK = "https://community.hubitat.com/t/z-wave-universal-smoke-co-detector/127180"
@Field static final Map deviceModelNames = ["0138:0001:0003":"ZCombo-G"]
metadata {
definition (
name: "Z-Wave Universal Smoke/CO Detector",
namespace: "jtp10181",
author: "Jeff Page (@jtp10181)",
importUrl: "https://raw.githubusercontent.com/jtp10181/Hubitat/main/Drivers/generic/zwave-smoke-co-detector.groovy"
) {
capability "Sensor"
capability "Battery"
capability "SmokeDetector"
capability "CarbonMonoxideDetector"
command "fullConfigure"
command "forceRefresh"
command "resetWarnings"
command "setParameter",[[name:"parameterNumber*",type:"NUMBER", description:"Parameter Number"],
[name:"value*",type:"NUMBER", description:"Parameter Value"],
[name:"size",type:"NUMBER", description:"Parameter Size"]]
//DEBUGGING
//command "debugShowVars"
attribute "syncStatus", "string"
attribute "warnings", "number"
fingerprint mfr:"0138", prod:"0001", deviceId:"0003", inClusters:"0x5E,0x85,0x8E,0x59,0x55,0x86,0x72,0x5A,0x73,0x80,0x9F,0x71,0x84,0x70,0x6C" //First Alert ZCombo-G
}
preferences {
configParams.each { param ->
if (!param.hidden) {
Integer paramVal = getParamValue(param)
if (param.options) {
input "configParam${param.num}", "enum",
title: fmtTitle("${param.title}"),
description: fmtDesc("• Parameter #${param.num}, Selected: ${paramVal}" + (param?.description ? "
• ${param?.description}" : '')),
defaultValue: paramVal,
options: param.options,
required: false
}
else if (param.range) {
input "configParam${param.num}", "number",
title: fmtTitle("${param.title}"),
description: fmtDesc("• Parameter #${param.num}, Range: ${(param.range).toString()}, DEFAULT: ${param.defaultVal}" + (param?.description ? "
• ${param?.description}" : '')),
defaultValue: paramVal,
range: param.range,
required: false
}
}
}
// for(int i in 2..maxAssocGroups) {
// input "assocDNI$i", "string",
// title: fmtTitle("Device Associations - Group $i"),
// description: fmtDesc("Supports up to ${maxAssocNodes} Hex Device IDs separated by commas. Check device documentation for more info. Save as blank or 0 to clear."),
// required: false
// }
}
}
void debugShowVars() {
log.warn "settings ${settings.hashCode()} ${settings}"
log.warn "paramsList ${paramsList.hashCode()} ${paramsList}"
log.warn "paramsMap ${paramsMap.hashCode()} ${paramsMap}"
}
//Association Settings
@Field static final int maxAssocGroups = 1
@Field static final int maxAssocNodes = 1
/*** Static Lists and Settings ***/
@Field static final Map NOTIFICATION_TYPE = [
0x01:"Smoke Alarm",
0x02:"CO Alarm",
]
@Field static final Map ALARM_EVENTS = [
0x00:"State idle",
0x01:"Detected (location provided)",
0x02:"Detected",
0x03:"Alarm test",
0x06:"Alarm silenced",
0x04:"Replacement required",
0x05:"Replacement required, End-of-life",
0x07:"Maintenance required, planned periodic inspection",
0x08:"Maintenance required, dust in device",
0x09:"Unknown event/state"
]
@Field static final Map SYSTEM_EVENTS = [
0x00:"State idle",
0x01:"System hardware failure",
0x03:"System hardware failure (manufacturer proprietary)",
0x02:"System software failure",
0x04:"System software failure (manufacturer proprietary)",
0x05:"Heartbeat",
0x06:"Tampering, product cover removed",
0x07:"Emergency shutoff",
0x09:"Digital input high state",
0x0A:"Digital input low state",
0x0B:"Digital input open",
0xFE:"Unknown event/state"
]
//Main Parameters Listing
@Field static Map paramsMap =
[
superTimeout: [ num: 1,
title: "Supervision report timeout",
size: 2, defaultVal: 1500,
range: 500..5000,
hidden: true
],
superRetry: [ num: 2,
title: "Supervision retry count",
size: 2, defaultVal: 2,
range: 0..5,
hidden: true
],
superWait: [ num: 3,
title: "Supervision wait time",
size: 2, defaultVal: 4,
range: 1..60,
hidden: true
]
]
/* ZCombo-G
CommandClassReport - class:0x55, version:2
CommandClassReport - class:0x59, version:1
CommandClassReport - class:0x5A, version:1
CommandClassReport - class:0x5E, version:2
CommandClassReport - class:0x6C, version:1
CommandClassReport - class:0x70, version:1
CommandClassReport - class:0x71, version:8
CommandClassReport - class:0x72, version:2
CommandClassReport - class:0x73, version:1
CommandClassReport - class:0x80, version:1
CommandClassReport - class:0x84, version:2
CommandClassReport - class:0x85, version:2
CommandClassReport - class:0x86, version:3
CommandClassReport - class:0x8E, version:3
CommandClassReport - class:0x9F, version:1
*/
//Set Command Class Versions
@Field static final Map commandClassVersions = [
0x6C: 1, // supervision
0x70: 1, // configuration
0x86: 2, // version
0x71: 8 // notification
]
/*******************************************************************
***** Core Functions
********************************************************************/
void installed() {
logWarn "installed..."
}
void fullConfigure() {
logWarn "configure..."
if (!pendingChanges || state.resyncAll == null) {
logForceWakeupMessage "Full Re-Configure"
state.resyncAll = true
} else {
logForceWakeupMessage "Pending Configuration Changes"
}
updateSyncingStatus(1)
}
void updated() {
logDebug "updated..."
checkLogLevel()
if (!firmwareVersion) {
state.resyncAll = true
state.pendingRefresh = true
logForceWakeupMessage "Full Re-Configure and Refresh"
}
if (pendingChanges) {
logForceWakeupMessage "Pending Configuration Changes"
}
else if (!state.resyncAll && !state.pendingRefresh) {
state.remove("INFO")
}
updateSyncingStatus(1)
}
void forceRefresh() {
logDebug "refresh..."
state.pendingRefresh = true
logForceWakeupMessage "Sensor Info Refresh"
}
/*******************************************************************
***** Driver Commands
********************************************************************/
/*** Capabilities ***/
/*** Custom Commands ***/
String setParameter(paramNum, value, size = null) {
Map param = getParam(paramNum)
if (param && !size) { size = param.size }
if (paramNum == null || value == null || size == null) {
logWarn "Incomplete parameter list supplied..."
logWarn "Syntax: setParameter(paramNum, value, size)"
return
}
logDebug "setParameter ( number: $paramNum, value: $value, size: $size )" + (param ? " [${param.name}]" : "")
return secureCmd(configSetCmd([num: paramNum, size: size], value as Integer))
}
void resetWarnings() {
logDebug "reset..."
device.deleteCurrentState("warnings")
sendEventLog(name:"warnings", value:0, desc:"Reset Warnings Counter")
}
/*******************************************************************
***** Z-Wave Reports
********************************************************************/
void parse(String description) {
zwaveParse(description)
}
void zwaveEvent(hubitat.zwave.commands.supervisionv1.SupervisionGet cmd, ep=0) {
zwaveSupervision(cmd,ep)
}
void zwaveEvent(hubitat.zwave.commands.configurationv1.ConfigurationReport cmd) {
logTrace "${cmd}"
updateSyncingStatus()
Map param = getParam(cmd.parameterNumber)
Integer val = cmd.scaledConfigurationValue
if (param) {
//Convert scaled signed integer to unsigned
Long sizeFactor = Math.pow(256,param.size).round()
if (val < 0) { val += sizeFactor }
logDebug "${param.name} (#${param.num}) = ${val.toString()}"
setParamStoredValue(param.num, val)
}
else {
logDebug "Parameter #${cmd.parameterNumber} = ${val.toString()}"
}
}
void zwaveEvent(hubitat.zwave.commands.associationv2.AssociationReport cmd) {
logTrace "${cmd}"
updateSyncingStatus()
Integer grp = cmd.groupingIdentifier
if (grp == 1) {
logDebug "Lifeline Association: ${cmd.nodeId}"
state.group1Assoc = (cmd.nodeId == [zwaveHubNodeId]) ? true : false
}
else {
logDebug "Unhandled Group: $cmd"
}
}
void zwaveEvent(hubitat.zwave.commands.batteryv1.BatteryReport cmd, ep=0) {
logTrace "${cmd} (ep ${ep})"
Integer batLvl = cmd.batteryLevel
if (batLvl == 0xFF) {
batLvl = 1
logWarn "LOW BATTERY WARNING"
}
batLvl = validateRange(batLvl, 100, 1, 100)
String descText = "battery level is ${batLvl}%"
sendEventLog(name:"battery", value:batLvl, unit:"%", desc:descText, isStateChange:true)
}
void zwaveEvent(hubitat.zwave.commands.wakeupv2.WakeUpIntervalReport cmd) {
logTrace "${cmd}"
BigDecimal wakeHrs = safeToDec(cmd.seconds/3600,0,2)
logDebug "WakeUp Interval is $cmd.seconds seconds ($wakeHrs hours)"
device.updateDataValue("zwWakeupInterval", "${cmd.seconds}")
}
void zwaveEvent(hubitat.zwave.commands.wakeupv2.WakeUpNotification cmd, ep=0) {
logTrace "${cmd} (ep ${ep})"
logDebug "WakeUp Notification Received"
refreshSyncStatus()
List cmds = ["delay 0"]
cmds << batteryGetCmd()
//Refresh all if requested
if (state.pendingRefresh) { cmds += getRefreshCmds() }
//Any configuration needed
cmds += getConfigureCmds()
//This needs a longer delay
cmds << "delay 1400" << wakeUpNoMoreInfoCmd()
//Clear pending status
state.resyncAll = false
state.pendingRefresh = false
state.remove("INFO")
sendCommands(cmds, 600)
}
void zwaveEvent(hubitat.zwave.commands.notificationv8.NotificationReport cmd, ep=0) {
logTrace "${cmd} (ep ${ep})"
switch (cmd.notificationType) {
case 0x01: //Smoke Alarm
sendAlarmEvents("smoke", cmd.event as Integer)
break
case 0x02: //CO Alarm
sendAlarmEvents("carbonMonoxide", cmd.event as Integer)
break
case 0x09: //System
sendSystemEvents(cmd.event as Integer)
break
default:
logDebug "Unhandled NotificationReport: ${cmd}"
}
}
/*******************************************************************
***** Event Senders
********************************************************************/
//evt = [name, value, type, unit, desc, isStateChange]
void sendEventLog(Map evt, Integer ep=0) {
//Set description if not passed in
evt.descriptionText = evt.desc ?: "${evt.name} set to ${evt.value}${evt.unit ?: ''}"
//Main Device Events
if (device.currentValue(evt.name).toString() != evt.value.toString() || evt.isStateChange) {
logInfo "${evt.descriptionText}"
} else {
logDebug "${evt.descriptionText} [NOT CHANGED]"
}
//Always send event to update last activity
sendEvent(evt)
}
void sendAlarmEvents(String name, Integer event, Integer ep=0) {
String eventVal
switch (event) {
case 0x00:
eventVal = "clear"
break
case [0x01, 0x02]:
eventVal = "detected"
break
case 0x03:
eventVal = "tested"
break
default:
logWarn "${name} event: ${ALARM_EVENTS[event]}"
sendEventLog(name:"warnings", value:(device.currentValue("warnings")?:0)+1, desc:"${name} event: ${ALARM_EVENTS[event]}", isStateChange:true, ep)
}
if (eventVal) {
sendEventLog(name: name, value: eventVal, ep)
}
}
void sendSystemEvents(Integer event, Integer ep=0) {
switch (event) {
case 0x00: break //Idle State - ignored
case 0x05:
logDebug "Heartbeat event received"
refreshSyncStatus()
break
default:
logWarn "System event: ${SYSTEM_EVENTS[event]}"
sendEventLog(name:"warnings", value:(device.currentValue("warnings")?:0)+1, desc:"System event: ${SYSTEM_EVENTS[event]}", isStateChange:true, ep)
}
}
/*******************************************************************
***** Execute / Build Commands
********************************************************************/
List getConfigureCmds() {
logDebug "getConfigureCmds..."
List cmds = []
if (state.resyncAll || !firmwareVersion || !state.deviceModel) {
cmds << versionGetCmd()
}
if (state.resyncAll) {
clearVariables()
cmds << wakeUpIntervalSetCmd(4200) //Refuses to change from 4200
cmds << wakeUpIntervalGetCmd()
}
cmds += getConfigureAssocsCmds()
configParams.each { param ->
Integer paramVal = getParamValueAdj(param)
Integer storedVal = getParamStoredValue(param.num)
if ((paramVal != null) && (state.resyncAll || (storedVal != paramVal))) {
logDebug "Changing ${param.name} (#${param.num}) from ${storedVal} to ${paramVal}"
cmds += configSetGetCmd(param, paramVal)
}
}
state.resyncAll = false
if (cmds) updateSyncingStatus(6)
return cmds ?: []
}
List getRefreshCmds() {
List cmds = []
cmds << versionGetCmd()
cmds << wakeUpIntervalGetCmd()
cmds << notificationGetCmd(0x01, 0x00)
cmds << notificationGetCmd(0x02, 0x00)
return cmds ?: []
}
List getConfigureAssocsCmds() {
List cmds = []
if (!state.group1Assoc || state.resyncAll) {
if (state.group1Assoc == false) {
logDebug "Adding missing lifeline association..."
}
cmds << associationSetCmd(1, [zwaveHubNodeId])
cmds << associationGetCmd(1)
}
return cmds
}
private logForceWakeupMessage(msg) {
String helpText = "Check the manual for how to wake up the device."
logWarn "${msg} will execute the next time the device wakes up. ${helpText}"
state.INFO = "*** ${msg} *** Waiting for device to wake up. ${helpText}"
}
/*******************************************************************
***** Required for Library
********************************************************************/
//These have to be added in after the fact or groovy complains
void fixParamsMap() {
paramsMap['settings'] = [fixed: true]
}
Integer getParamValueAdj(Map param) {
return getParamValue(param)
}
//#include jtp10181.zwaveDriverLibrary
/*******************************************************************
*******************************************************************
***** Z-Wave Driver Library by Jeff Page (@jtp10181)
*******************************************************************
********************************************************************
Changelog:
2023-05-10 - First version used in drivers
2023-05-12 - Adjustments to community links
2023-05-14 - Updates for power metering
2023-05-18 - Adding requirement for getParamValueAdj in driver
2023-05-24 - Fix for possible RuntimeException error due to bad cron string
2023-10-25 - Less savings to the configVals data, and some new functions
2023-10-26 - Added some battery shortcut functions
********************************************************************/
library (
author: "Jeff Page (@jtp10181)",
category: "zwave",
description: "Z-Wave Driver Library",
name: "zwaveDriverLibrary",
namespace: "jtp10181",
documentationLink: ""
)
/*******************************************************************
***** Z-Wave Reports (COMMON)
********************************************************************/
//Include these in Driver
//void parse(String description) {zwaveParse(description)}
//void zwaveEvent(hubitat.zwave.commands.multichannelv3.MultiChannelCmdEncap cmd) {zwaveMultiChannel(cmd)}
//void zwaveEvent(hubitat.zwave.commands.supervisionv1.SupervisionGet cmd, ep=0) {zwaveSupervision(cmd,ep)}
void zwaveParse(String description) {
hubitat.zwave.Command cmd = zwave.parse(description, commandClassVersions)
if (cmd) {
logTrace "parse: ${description} --PARSED-- ${cmd}"
zwaveEvent(cmd)
} else {
logWarn "Unable to parse: ${description}"
}
//Update Last Activity
updateLastCheckIn()
}
//Decodes Multichannel Encapsulated Commands
void zwaveMultiChannel(hubitat.zwave.commands.multichannelv3.MultiChannelCmdEncap cmd) {
hubitat.zwave.Command encapsulatedCmd = cmd.encapsulatedCommand(commandClassVersions)
logTrace "${cmd} --ENCAP-- ${encapsulatedCmd}"
if (encapsulatedCmd) {
zwaveEvent(encapsulatedCmd, cmd.sourceEndPoint as Integer)
} else {
logWarn "Unable to extract encapsulated cmd from $cmd"
}
}
//Decodes Supervision Encapsulated Commands (and replies to device)
void zwaveSupervision(hubitat.zwave.commands.supervisionv1.SupervisionGet cmd, ep=0) {
hubitat.zwave.Command encapsulatedCmd = cmd.encapsulatedCommand(commandClassVersions)
logTrace "${cmd} --ENCAP-- ${encapsulatedCmd}"
if (encapsulatedCmd) {
zwaveEvent(encapsulatedCmd, ep)
} else {
logWarn "Unable to extract encapsulated cmd from $cmd"
}
//Delay 500ms needed for ZCombo-G for it to see the replies
sendCommands(["delay 500", secureCmd(zwave.supervisionV1.supervisionReport(sessionID: cmd.sessionID, reserved: 0, moreStatusUpdates: false, status: 0xFF, duration: 0), ep)], 0)
}
void zwaveEvent(hubitat.zwave.commands.versionv2.VersionReport cmd) {
logTrace "${cmd}"
String fullVersion = String.format("%d.%02d",cmd.firmware0Version,cmd.firmware0SubVersion)
String zwaveVersion = String.format("%d.%02d",cmd.zWaveProtocolVersion,cmd.zWaveProtocolSubVersion)
device.updateDataValue("firmwareVersion", fullVersion)
device.updateDataValue("protocolVersion", zwaveVersion)
device.updateDataValue("hardwareVersion", "${cmd.hardwareVersion}")
logDebug "Received Version Report - Firmware: ${fullVersion}"
setDevModel(new BigDecimal(fullVersion))
}
void zwaveEvent(hubitat.zwave.Command cmd, ep=0) {
logDebug "Unhandled zwaveEvent: $cmd (ep ${ep})"
}
/*******************************************************************
***** Z-Wave Command Shortcuts
********************************************************************/
//These send commands to the device either a list or a single command
void sendCommands(List cmds, Long delay=200) {
sendHubCommand(new hubitat.device.HubMultiAction(delayBetween(cmds, delay), hubitat.device.Protocol.ZWAVE))
}
//Single Command
void sendCommands(String cmd) {
sendHubCommand(new hubitat.device.HubAction(cmd, hubitat.device.Protocol.ZWAVE))
}
//Consolidated zwave command functions so other code is easier to read
String associationSetCmd(Integer group, List nodes) {
return secureCmd(zwave.associationV2.associationSet(groupingIdentifier: group, nodeId: nodes))
}
String associationRemoveCmd(Integer group, List nodes) {
return secureCmd(zwave.associationV2.associationRemove(groupingIdentifier: group, nodeId: nodes))
}
String associationGetCmd(Integer group) {
return secureCmd(zwave.associationV2.associationGet(groupingIdentifier: group))
}
String mcAssociationGetCmd(Integer group) {
return secureCmd(zwave.multiChannelAssociationV3.multiChannelAssociationGet(groupingIdentifier: group))
}
String versionGetCmd() {
return secureCmd(zwave.versionV2.versionGet())
}
String switchBinarySetCmd(Integer value, Integer ep=0) {
return secureCmd(zwave.switchBinaryV1.switchBinarySet(switchValue: value), ep)
}
String switchBinaryGetCmd(Integer ep=0) {
return secureCmd(zwave.switchBinaryV1.switchBinaryGet(), ep)
}
String switchMultilevelSetCmd(Integer value, Integer duration, Integer ep=0) {
return secureCmd(zwave.switchMultilevelV4.switchMultilevelSet(dimmingDuration: duration, value: value), ep)
}
String switchMultilevelGetCmd(Integer ep=0) {
return secureCmd(zwave.switchMultilevelV4.switchMultilevelGet(), ep)
}
String switchMultilevelStartLvChCmd(Boolean upDown, Integer duration, Integer ep=0) {
//upDown: false=up, true=down
return secureCmd(zwave.switchMultilevelV4.switchMultilevelStartLevelChange(upDown: upDown, ignoreStartLevel:1, dimmingDuration: duration), ep)
}
String switchMultilevelStopLvChCmd(Integer ep=0) {
return secureCmd(zwave.switchMultilevelV4.switchMultilevelStopLevelChange(), ep)
}
String meterGetCmd(meter, Integer ep=0) {
return secureCmd(zwave.meterV3.meterGet(scale: meter.scale), ep)
}
String meterResetCmd(Integer ep=0) {
return secureCmd(zwave.meterV3.meterReset(), ep)
}
String wakeUpIntervalGetCmd() {
return secureCmd(zwave.wakeUpV2.wakeUpIntervalGet())
}
String wakeUpIntervalSetCmd(val) {
return secureCmd(zwave.wakeUpV2.wakeUpIntervalSet(seconds:val, nodeid:zwaveHubNodeId))
}
String wakeUpNoMoreInfoCmd() {
return secureCmd(zwave.wakeUpV2.wakeUpNoMoreInformation())
}
String batteryGetCmd() {
return secureCmd(zwave.batteryV1.batteryGet())
}
String sensorMultilevelGetCmd(sensorType) {
Integer scale = (temperatureScale == "F" ? 1 : 0)
return secureCmd(zwave.sensorMultilevelV11.sensorMultilevelGet(scale: scale, sensorType: sensorType))
}
String notificationGetCmd(notificationType, eventType, Integer ep=0) {
return secureCmd(zwave.notificationV3.notificationGet(notificationType: notificationType, v1AlarmType:0, event: eventType), ep)
}
String configSetCmd(Map param, Integer value) {
//Convert from unsigned to signed for scaledConfigurationValue
Long sizeFactor = Math.pow(256,param.size).round()
if (value >= sizeFactor/2) { value -= sizeFactor }
return secureCmd(zwave.configurationV1.configurationSet(parameterNumber: param.num, size: param.size, scaledConfigurationValue: value))
}
String configGetCmd(Map param) {
return secureCmd(zwave.configurationV1.configurationGet(parameterNumber: param.num))
}
List configSetGetCmd(Map param, Integer value) {
List cmds = []
cmds << configSetCmd(param, value)
cmds << configGetCmd(param)
return cmds
}
/*******************************************************************
***** Z-Wave Encapsulation
********************************************************************/
//Secure and MultiChannel Encapsulate
String secureCmd(String cmd) {
return zwaveSecureEncap(cmd)
}
String secureCmd(hubitat.zwave.Command cmd, ep=0) {
return zwaveSecureEncap(multiChannelEncap(cmd, ep))
}
//MultiChannel Encapsulate if needed
//This is called from secureCmd or supervisionEncap, do not call directly
String multiChannelEncap(hubitat.zwave.Command cmd, ep) {
//logTrace "multiChannelEncap: ${cmd} (ep ${ep})"
if (ep > 0) {
cmd = zwave.multiChannelV3.multiChannelCmdEncap(destinationEndPoint:ep).encapsulate(cmd)
}
return cmd.format()
}
/*******************************************************************
***** Common Functions
********************************************************************/
/*** Parameter Store Map Functions ***/
@Field static Map configsList = new java.util.concurrent.ConcurrentHashMap()
Integer getParamStoredValue(Integer paramNum) {
//Using Data (Map) instead of State Variables
Map configsMap = getParamStoredMap()
return safeToInt(configsMap[paramNum], null)
}
void setParamStoredValue(Integer paramNum, Integer value) {
//Using Data (Map) instead of State Variables
TreeMap configsMap = getParamStoredMap()
configsMap[paramNum] = value
configsList[device.id][paramNum] = value
//device.updateDataValue("configVals", configsMap.inspect())
}
Map getParamStoredMap() {
TreeMap configsMap = configsList[device.id]
if (configsMap == null) {
configsMap = [:]
if (device.getDataValue("configVals")) {
try {
configsMap = evaluate(device.getDataValue("configVals"))
}
catch(Exception e) {
logWarn("Clearing Invalid configVals: ${e}")
device.removeDataValue("configVals")
}
}
configsList[device.id] = configsMap
}
return configsMap
}
//Parameter List Functions
//This will rebuild the list for the current model and firmware only as needed
//paramsList Structure: MODEL:[FIRMWARE:PARAM_MAPS]
//PARAM_MAPS [num, name, title, description, size, defaultVal, options, firmVer]
@Field static Map> paramsList = new java.util.concurrent.ConcurrentHashMap()
void updateParamsList() {
logDebug "Update Params List"
String devModel = state.deviceModel
Short modelNum = deviceModelShort
Short modelSeries = Math.floor(modelNum/10)
BigDecimal firmware = firmwareVersion
List