Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,16 @@ 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) {
state.isChildOnline = true
addChild()
} else {
changeTemperatureSensorStatus("online")
}
} else if (cmd.scaledConfigurationValue == 0 && childDevices) {
changeTemperatureSensorStatus("offline")
}
}
}
Expand Down Expand Up @@ -299,7 +306,12 @@ 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

were you having a problem with this being sent too often?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of, but it's more like, after I've received Multilevel Report from endpoint 2, I was sending an event to child, and it was bringing it back online every time, meaning that sending "offline" event haven't done a trick. So this flag is a workaround to store real child status in parent device and prevent sending 'fake' events to additional temperature sensor.

}

def configureChild() {
sendEventToChild(createEvent([name: "checkInterval", value: 6 * 60 * 60 + 36, displayed: false]))
}

private refreshChild() {
Expand Down Expand Up @@ -328,4 +340,10 @@ private getMaxHeatingSetpointTemperature() {

private getMinHeatingSetpointTemperature() {
temperatureScale == 'C' ? 10 : 50
}

private changeTemperatureSensorStatus(status) {
state.isChildOnline = (status == "online")
def map = [name: "DeviceWatch-DeviceStatus", value: status]
sendEventToChild(map)
}