mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-08 05:31:56 +00:00
DVCSMP-2585 Fix NullPointerException when pairing because color is unset
Also tweak default config values in config value range checking (affects initial pairing of device)
This commit is contained in:
@@ -1,33 +1,32 @@
|
|||||||
# Express Controls EZMultiPli
|
# Express Controls EZMultiPli
|
||||||
|
|
||||||
Cloud Execution
|
|
||||||
|
|
||||||
Works with:
|
Works with:
|
||||||
|
|
||||||
* [Express Controls EZMultiPli](https://www.smartthings.com/works-with-smartthings/)
|
* [Express Controls EZMultiPli](https://www.smartthings.com/works-with-smartthings/)
|
||||||
|
|
||||||
## Table of contents
|
## Table of contents
|
||||||
|
|
||||||
* [Release Notes](#releasenotes)
|
* [Release Notes](#release-notes)
|
||||||
* [Capabilities](#capabilities)
|
* [Capabilities](#capabilities)
|
||||||
* [Troubleshooting](#troubleshooting)
|
* [Troubleshooting](#troubleshooting)
|
||||||
|
|
||||||
## Release Notes
|
## Release Notes
|
||||||
|
|
||||||
* 2017-04-10 - DrZwave (with help from Donald Kirker) - changed fingerprint to the new format, lowered the OnTime and other parameters to be "more in line with ST user expectations", get the luminance in LUX so it reports in lux all the time.
|
* **2017-04-19** - _dkirker_ - Update default config values in config value range check functions, use lux if lum option is null, fix NullPointerException on initial pairing when color data has not been set (and set the default color data!)
|
||||||
* 2016-10-06 - erocm1231 - Added "updated" method to run when configuration options are changed. Depending on model of unit, luminance is being reported as a relative percentace or as a lux value. Added the option to configure this in the handler.
|
* **2017-04-10** - _DrZwave_ (with help from Donald Kirker) - changed fingerprint to the new format, lowered the OnTime and other parameters to be "more in line with ST user expectations", get the luminance in LUX so it reports in lux all the time.
|
||||||
* 2016-01-28 - erocm1231 - Changed the configuration method to use scaledConfiguration so that it properly formatted negative numbers. Also, added configurationGet and a configurationReport method so that config values can be verified.
|
* **2016-10-06** - _erocm1231_ - Added "updated" method to run when configuration options are changed. Depending on model of unit, luminance is being reported as a relative percentace or as a lux value. Added the option to configure this in the handler.
|
||||||
* 2015-12-04 - erocm1231 - added range value to preferences as suggested by @Dela-Rick.
|
* **2016-01-28** - _erocm1231_ - Changed the configuration method to use scaledConfiguration so that it properly formatted negative numbers. Also, added configurationGet and a configurationReport method so that config values can be verified.
|
||||||
* 2015-11-26 - erocm1231 - Fixed null condition error when adding as a new device.
|
* **2015-12-04** - _erocm1231_ - added range value to preferences as suggested by @Dela-Rick.
|
||||||
* 2015-11-24 - erocm1231 - Added refresh command. Made a few changes to how the handler maps colors to the LEDs. Fixed the device not having its on/off status updated when colors are changed.
|
* **2015-11-26** - _erocm1231_ - Fixed null condition error when adding as a new device.
|
||||||
* 2015-11-23 - erocm1231 - Changed the look to match SmartThings v2 devices.
|
* **2015-11-24** - _erocm1231_ - Added refresh command. Made a few changes to how the handler maps colors to the LEDs. Fixed the device not having its on/off status updated when colors are changed.
|
||||||
* 2015-11-21 - erocm1231 - Made code much more efficient. Also made it compatible when setColor is passed a hex value. Mapping of special colors: Soft White - Default - Yellow, White - Concentrate - White, Daylight - Energize - Teal, Warm White - Relax - Yellow
|
* **2015-11-23** - _erocm1231_ - Changed the look to match SmartThings v2 devices.
|
||||||
* 2015-11-19 - erocm1231 - Fixed a couple incorrect colors, changed setColor to be more compatible with other apps
|
* **2015-11-21** - _erocm1231_ - Made code much more efficient. Also made it compatible when setColor is passed a hex value. Mapping of special colors: Soft White - Default - Yellow, White - Concentrate - White, Daylight - Energize - Teal, Warm White - Relax - Yellow
|
||||||
* 2015-11-18 - erocm1231 - Added to setColor for compatibility with Smart Lighting
|
* **2015-11-19** - _erocm1231_ - Fixed a couple incorrect colors, changed setColor to be more compatible with other apps
|
||||||
* v0.1.0 - DrZWave - chose better icons, Got color LED to work - first fully functional version
|
* **2015-11-18** - _erocm1231_ - Added to setColor for compatibility with Smart Lighting
|
||||||
* v0.0.9 - jrs - got the temp and luminance to work. Motion works. Debugging the color wheel.
|
* **v0.1.0** - _DrZWave_ - chose better icons, Got color LED to work - first fully functional version
|
||||||
* v0.0.8 - DrZWave 2/25/2015 - change the color control to be tiles since there are only 8 colors.
|
* **v0.0.9** - _jrs_ - got the temp and luminance to work. Motion works. Debugging the color wheel.
|
||||||
* v0.0.7 - jrs - 02/23/2015 - Jim Sulin
|
* **v0.0.8** - _DrZWave_ 2/25/2015 - change the color control to be tiles since there are only 8 colors.
|
||||||
|
* **v0.0.7** - _jrs_ - 02/23/2015 - Jim Sulin
|
||||||
|
|
||||||
## Capabilities
|
## Capabilities
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,6 @@ metadata {
|
|||||||
|
|
||||||
} // end metadata
|
} // end metadata
|
||||||
|
|
||||||
|
|
||||||
// Parse incoming device messages from device to generate events
|
// Parse incoming device messages from device to generate events
|
||||||
def parse(String description){
|
def parse(String description){
|
||||||
//log.debug "==> New Zwave Event: ${description}"
|
//log.debug "==> New Zwave Event: ${description}"
|
||||||
@@ -124,7 +123,7 @@ def parse(String description){
|
|||||||
|
|
||||||
def statusTextmsg = ""
|
def statusTextmsg = ""
|
||||||
if (device.currentState('temperature') != null && device.currentState('illuminance') != null) {
|
if (device.currentState('temperature') != null && device.currentState('illuminance') != null) {
|
||||||
statusTextmsg = "${device.currentState('temperature').value} ° - ${device.currentState('illuminance').value} ${(lum == "" || lum == null || lum == 1) ? "%" : "LUX"}"
|
statusTextmsg = "${device.currentState('temperature').value} ° - ${device.currentState('illuminance').value} ${(lum == 1) ? "%" : "LUX"}"
|
||||||
sendEvent("name":"statusText", "value":statusTextmsg, displayed:false)
|
sendEvent("name":"statusText", "value":statusTextmsg, displayed:false)
|
||||||
}
|
}
|
||||||
if (result != [null] && result != []) log.debug "Parse returned ${result}"
|
if (result != [null] && result != []) log.debug "Parse returned ${result}"
|
||||||
@@ -147,7 +146,7 @@ def zwaveEvent(physicalgraph.zwave.commands.sensormultilevelv5.SensorMultilevelR
|
|||||||
break;
|
break;
|
||||||
case 0x03 : // SENSOR_TYPE_LUMINANCE_VERSION_1
|
case 0x03 : // SENSOR_TYPE_LUMINANCE_VERSION_1
|
||||||
map.value = cmd.scaledSensorValue.toInteger().toString()
|
map.value = cmd.scaledSensorValue.toInteger().toString()
|
||||||
if(lum == "" || lum == null || lum == 1) map.unit = "%"
|
if(lum == 1) map.unit = "%"
|
||||||
else map.unit = "lux"
|
else map.unit = "lux"
|
||||||
map.name = "illuminance"
|
map.name = "illuminance"
|
||||||
log.debug "Luminance report"
|
log.debug "Luminance report"
|
||||||
@@ -182,7 +181,8 @@ def zwaveEvent(physicalgraph.zwave.commands.notificationv3.NotificationReport cm
|
|||||||
}
|
}
|
||||||
|
|
||||||
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
|
def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
|
||||||
if (cmd.value == 0 && device.latestState("color").value != "#ffffff") {
|
// The EZMultiPli sets the color back to #ffffff on "off" or at init, so update the ST device to reflect this.
|
||||||
|
if (device.latestState("color") == null || (cmd.value == 0 && device.latestState("color").value != "#ffffff")) {
|
||||||
sendEvent(name: "color", value: "#ffffff", displayed: true)
|
sendEvent(name: "color", value: "#ffffff", displayed: true)
|
||||||
}
|
}
|
||||||
[name: "switch", value: cmd.value ? "on" : "off", type: "digital"]
|
[name: "switch", value: cmd.value ? "on" : "off", type: "digital"]
|
||||||
@@ -275,12 +275,12 @@ def zwaveEvent(physicalgraph.zwave.Command cmd) {
|
|||||||
// ensure we are passing acceptable param values for LiteMin & TempMin configs
|
// ensure we are passing acceptable param values for LiteMin & TempMin configs
|
||||||
def checkLiteTempInput(value) {
|
def checkLiteTempInput(value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
value=60
|
value=6
|
||||||
}
|
}
|
||||||
def liteTempVal = value.toInteger()
|
def liteTempVal = value.toInteger()
|
||||||
switch (liteTempVal) {
|
switch (liteTempVal) {
|
||||||
case { it < 0 }:
|
case { it < 0 }:
|
||||||
return 60 // bad value, set to default
|
return 6 // bad value, set to default
|
||||||
break
|
break
|
||||||
case { it > 127 }:
|
case { it > 127 }:
|
||||||
return 127 // bad value, greater then MAX, set to MAX
|
return 127 // bad value, greater then MAX, set to MAX
|
||||||
@@ -293,12 +293,12 @@ def checkLiteTempInput(value) {
|
|||||||
// ensure we are passing acceptable param value for OnTime config
|
// ensure we are passing acceptable param value for OnTime config
|
||||||
def checkOnTimeInput(value) {
|
def checkOnTimeInput(value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
value=10
|
value=2
|
||||||
}
|
}
|
||||||
def onTimeVal = value.toInteger()
|
def onTimeVal = value.toInteger()
|
||||||
switch (onTimeVal) {
|
switch (onTimeVal) {
|
||||||
case { it < 0 }:
|
case { it < 0 }:
|
||||||
return 10 // bad value set to default
|
return 2 // bad value set to default
|
||||||
break
|
break
|
||||||
case { it > 127 }:
|
case { it > 127 }:
|
||||||
return 127 // bad value, greater then MAX, set to MAX
|
return 127 // bad value, greater then MAX, set to MAX
|
||||||
|
|||||||
Reference in New Issue
Block a user