The errors were driving me nuts, so I asked Chat GPT for a fix. It gave me the below edits to the parent driver, which I've implemented. I'll post back to advise if it works.
Find this section in the parent driver:
// LM (Multi Sensor)
if ( reply[0] != null && getChildDevice(reply[0]['id']) != null && reply[0]['type'] == 'LM' ) {
childDevice=getChildDevice(reply[0]['id'])
Inside that section, there are three sensor blocks: humidity, temperature, and lux.
1. Replace the entire // humidity: block
Find:
// humidity: humidity:20 %
if ( reply[0]['statuses']['humidity'] != null ) {
if (logTrace) log.trace "humidity: "+reply[0]['statuses']['humidity']
tmp=reply[0]['statuses']['humidity'].toString()
(a,b) = reply[0]['statuses']['humidity'].toString().split(' ')
if ( a.toInteger() >= 0 && b == "%" ) {
childDevice.sendEvent(name: "humidity", value: a.toInteger(), unit: '% RH', descriptionText: "${childDevice.displayName} humidity is "+ a + "%")
alert_value = reply\[0\]\['name'\] + "humidity =" + a
message = reply\[0\]\['name'\] + " humidity " + a + "%"
sendEnabledEvents(alert_value, message, "LM")
}
}
Replace it with:
// humidity: humidity:20 %
if (reply[0]['statuses']['humidity'] != null) {
if (logTrace) log.trace "humidity: " + reply[0]['statuses']['humidity']
def humidityParts = reply[0]['statuses']['humidity'].toString().split(' ')
if (humidityParts.size() >= 2) {
a = humidityParts\[0\]
b = humidityParts\[1\]
if (a.isInteger() && a.toInteger() >= 0 && b == "%") {
childDevice.sendEvent(name: "humidity", value: a.toInteger(), unit: '% RH', descriptionText: "${childDevice.displayName} humidity is " + a + "%")
alert_value = reply\[0\]\['name'\] + "humidity =" + a
message = reply\[0\]\['name'\] + " humidity " + a + "%"
sendEnabledEvents(alert_value, message, "LM")
}
}
}
2. Replace the entire // lux: block
Find:
// lux: lux:0 lx
if ( reply[0]['statuses']['lux'] != null ) {
if (logTrace) log.trace "lux: "+reply[0]['statuses']['lux']
(a,b) = reply[0]['statuses']['lux'].toString().split(' ')
if ( a.toInteger() >= 0 && b == 'lx' ) {
childDevice.sendEvent(name: "illuminance", value: a, unit: 'lx', descriptionText: "${childDevice.displayName} lux is "+ a)
alert_value = reply\[0\]\['name'\] + "lux =" + a
message = reply\[0\]\['name'\] + " lux " + a
sendEnabledEvents(alert_value, message, "LM")
}
}
Replace it with:
// lux: lux:0 lx
if (reply[0]['statuses']['lux'] != null) {
if (logTrace) log.trace "lux: " + reply[0]['statuses']['lux']
def luxParts = reply[0]['statuses']['lux'].toString().split(' ')
if (luxParts.size() >= 2) {
a = luxParts\[0\]
b = luxParts\[1\]
if (a.isInteger() && a.toInteger() >= 0 && b == 'lx') {
childDevice.sendEvent(name: "illuminance", value: a.toInteger(), unit: 'lx', descriptionText: "${childDevice.displayName} lux is " + a)
alert_value = reply\[0\]\['name'\] + "lux =" + a
message = reply\[0\]\['name'\] + " lux " + a
sendEnabledEvents(alert_value, message, "LM")
}
}
}
Do not change the temperature block. The two confirmed unsafe array assignments are the humidity and lux ones.