From 28d2580d4b3c8f9de37d7b139e7bfd6a9a497a97 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kacprowicz Date: Wed, 7 Aug 2019 15:47:23 +0200 Subject: [PATCH 1/5] Enabled Fibaro Temperature Sensor (for FGT) to go offline when it's not available. --- .../fibaro-heat-controller.groovy | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy b/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy index 03630f02333..4247477e3ff 100644 --- a/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy +++ b/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy @@ -171,9 +171,15 @@ def zwaveEvent(physicalgraph.zwave.commands.sensormultilevelv5.SensorMultilevelR } def zwaveEvent(physicalgraph.zwave.commands.configurationv2.ConfigurationReport cmd) { - if (cmd.parameterNumber == 3 && cmd.scaledConfigurationValue == 1) { - if(!childDevices) { - addChild() + if (cmd.parameterNumber == 3) { + if (cmd.scaledConfigurationValue == 1) { + if (!childDevices) { + addChild() + } else { + changeTemperatureSensorStatus("online") + } + } else if (cmd.scaledConfigurationValue == 0 && childDevices) { + changeTemperatureSensorStatus("offline") } } } @@ -328,4 +334,9 @@ private getMaxHeatingSetpointTemperature() { private getMinHeatingSetpointTemperature() { temperatureScale == 'C' ? 10 : 50 +} + +private changeTemperatureSensorStatus(status) { + def map = [name: "healthStatus", value: status] + sendEventToChild(map) } \ No newline at end of file From 8d270354b1cab47f21b542de72593f10eecfb9d4 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kacprowicz Date: Fri, 9 Aug 2019 13:47:20 +0200 Subject: [PATCH 2/5] Few improvements to make sure that child device will go offline. --- .../fibaro-heat-controller.groovy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy b/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy index 4247477e3ff..0ad1e9a0c43 100644 --- a/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy +++ b/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy @@ -174,6 +174,7 @@ def zwaveEvent(physicalgraph.zwave.commands.configurationv2.ConfigurationReport if (cmd.parameterNumber == 3) { if (cmd.scaledConfigurationValue == 1) { if (!childDevices) { + state.isChildOnline = true addChild() } else { changeTemperatureSensorStatus("online") @@ -305,7 +306,8 @@ def switchMode() { def sendEventToChild(event) { String childDni = "${device.deviceNetworkId}:2" def child = childDevices.find { it.deviceNetworkId == childDni } - child?.sendEvent(event) + if (state.isChildOnline) + child?.sendEvent(event) } private refreshChild() { @@ -337,6 +339,7 @@ private getMinHeatingSetpointTemperature() { } private changeTemperatureSensorStatus(status) { - def map = [name: "healthStatus", value: status] + state.isChildOnline = (status == "online") + def map = [name: "DeviceWatch-DeviceStatus", value: status] sendEventToChild(map) } \ No newline at end of file From 12cc517ea65eb1b8e373d98b9b88d2faa0e948df Mon Sep 17 00:00:00 2001 From: Przemyslaw Kacprowicz Date: Fri, 6 Sep 2019 12:16:42 +0200 Subject: [PATCH 3/5] Moved child configuration to be defined in parent device handler. Extended child temperature sensor checkInterval to meet true values. --- .../child-temperature-sensor.groovy | 2 +- .../fibaro-heat-controller.src/fibaro-heat-controller.groovy | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/devicetypes/smartthings/child-temperature-sensor.src/child-temperature-sensor.groovy b/devicetypes/smartthings/child-temperature-sensor.src/child-temperature-sensor.groovy index d470ff50208..aedc2a906a2 100644 --- a/devicetypes/smartthings/child-temperature-sensor.src/child-temperature-sensor.groovy +++ b/devicetypes/smartthings/child-temperature-sensor.src/child-temperature-sensor.groovy @@ -47,7 +47,7 @@ def updated() { } def configure() { - sendEvent(name: "checkInterval", value: 2 * 60 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID, offlinePingable: "1"]) + parent.configureChild() refresh() } diff --git a/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy b/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy index 0ad1e9a0c43..a1d9fd473cc 100644 --- a/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy +++ b/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy @@ -310,6 +310,10 @@ def sendEventToChild(event) { child?.sendEvent(event) } +def configureChild() { + sendEventToChild(createEvent([name: "checkInterval", value: 6 * 60 * 60 + 36, displayed: false])) +} + private refreshChild() { def cmds = [ secureEncap(zwave.batteryV1.batteryGet(), 2), From 29f34228af61d0c1f3076557a5698197c84eeba6 Mon Sep 17 00:00:00 2001 From: Przemyslaw Kacprowicz Date: Fri, 6 Sep 2019 12:21:27 +0200 Subject: [PATCH 4/5] Changed child device handler name - to allow cert team to test it without tweaking DTHes by themselves. Will revert this when ready to go. --- .../child-temperature-sensor.groovy | 2 +- .../fibaro-heat-controller.src/fibaro-heat-controller.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/devicetypes/smartthings/child-temperature-sensor.src/child-temperature-sensor.groovy b/devicetypes/smartthings/child-temperature-sensor.src/child-temperature-sensor.groovy index aedc2a906a2..cf92d9f3d24 100644 --- a/devicetypes/smartthings/child-temperature-sensor.src/child-temperature-sensor.groovy +++ b/devicetypes/smartthings/child-temperature-sensor.src/child-temperature-sensor.groovy @@ -13,7 +13,7 @@ * */ metadata { - definition(name: "Child Temperature Sensor", namespace: "smartthings", author: "SmartThings", mnmn: "SmartThings", vid: "generic-temperature-measurement", ocfDeviceType: "oic.d.thermostat") { + definition(name: "Child Temperature Sensorr", namespace: "smartthings", author: "SmartThings", mnmn: "SmartThings", vid: "generic-temperature-measurement", ocfDeviceType: "oic.d.thermostat") { capability "Temperature Measurement" capability "Battery" capability "Health Check" diff --git a/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy b/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy index a1d9fd473cc..b745539e505 100644 --- a/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy +++ b/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy @@ -331,7 +331,7 @@ def addChild() { String componentLabel = "Fibaro Temperature Sensor" String ch = "ch2" - addChildDevice("Child Temperature Sensor", childDni, device.hub.id,[completedSetup: true, label: componentLabel, isComponent: false, componentName: ch, componentLabel: componentLabel]) + addChildDevice("Child Temperature Sensorr", childDni, device.hub.id,[completedSetup: true, label: componentLabel, isComponent: false, componentName: ch, componentLabel: componentLabel]) } private getMaxHeatingSetpointTemperature() { From 4f923990766c572e95532dfa37878e0589cdb4fc Mon Sep 17 00:00:00 2001 From: Przemyslaw Kacprowicz Date: Wed, 11 Sep 2019 10:19:08 +0200 Subject: [PATCH 5/5] Brought back normal Device Type names. --- .../child-temperature-sensor.groovy | 2 +- .../fibaro-heat-controller.src/fibaro-heat-controller.groovy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/devicetypes/smartthings/child-temperature-sensor.src/child-temperature-sensor.groovy b/devicetypes/smartthings/child-temperature-sensor.src/child-temperature-sensor.groovy index cf92d9f3d24..aedc2a906a2 100644 --- a/devicetypes/smartthings/child-temperature-sensor.src/child-temperature-sensor.groovy +++ b/devicetypes/smartthings/child-temperature-sensor.src/child-temperature-sensor.groovy @@ -13,7 +13,7 @@ * */ metadata { - definition(name: "Child Temperature Sensorr", namespace: "smartthings", author: "SmartThings", mnmn: "SmartThings", vid: "generic-temperature-measurement", ocfDeviceType: "oic.d.thermostat") { + definition(name: "Child Temperature Sensor", namespace: "smartthings", author: "SmartThings", mnmn: "SmartThings", vid: "generic-temperature-measurement", ocfDeviceType: "oic.d.thermostat") { capability "Temperature Measurement" capability "Battery" capability "Health Check" diff --git a/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy b/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy index b745539e505..a1d9fd473cc 100644 --- a/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy +++ b/devicetypes/smartthings/fibaro-heat-controller.src/fibaro-heat-controller.groovy @@ -331,7 +331,7 @@ def addChild() { String componentLabel = "Fibaro Temperature Sensor" String ch = "ch2" - addChildDevice("Child Temperature Sensorr", childDni, device.hub.id,[completedSetup: true, label: componentLabel, isComponent: false, componentName: ch, componentLabel: componentLabel]) + addChildDevice("Child Temperature Sensor", childDni, device.hub.id,[completedSetup: true, label: componentLabel, isComponent: false, componentName: ch, componentLabel: componentLabel]) } private getMaxHeatingSetpointTemperature() {