Skip to content

Commit

Permalink
Convert on / off to lowercase
Browse files Browse the repository at this point in the history
  • Loading branch information
erocm123 authored Sep 26, 2019
1 parent c0e4054 commit ec2f04f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Drivers/sonoff-3ch-tasmota.src/sonoff-3ch-tasmota.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -165,33 +165,33 @@ def parse(description) {
events << createEvent(name: "voltage", value: result.ENERGY.Voltage, unit: "V")
}

if (result.containsKey("POWER1") || result.containsKey("POWER2") || result.containsKey("POWER3") || result.containsKey("POWER4")) {
if (result.containsKey("POWER1") || result.containsKey("POWER2") || result.containsKey("POWER3")) {
if (result.containsKey("POWER1")) {
log.debug "POWER1: $result.POWER1"
def childDevice = childDevices.find{it.deviceNetworkId == "$device.deviceNetworkId-ep1"}
if (childDevice) {
childDevice.sendEvent(name: "switch", value: result.POWER1)
childDevice.sendEvent(name: "switch", value: result.POWER1.toLowerCase())
}
}
if (result.containsKey("POWER2")) {
log.debug "POWER2: $result.POWER2"
def childDevice = childDevices.find{it.deviceNetworkId == "$device.deviceNetworkId-ep2"}
if (childDevice) {
childDevice.sendEvent(name: "switch", value: result.POWER2)
childDevice.sendEvent(name: "switch", value: result.POWER2.toLowerCase())
}
}
if (result.containsKey("POWER3")) {
log.debug "POWER3: $result.POWER3"
def childDevice = childDevices.find{it.deviceNetworkId == "$device.deviceNetworkId-ep3"}
if (childDevice) {
childDevice.sendEvent(name: "switch", value: result.POWER3)
childDevice.sendEvent(name: "switch", value: result.POWER3.toLowerCase())
}
}

def allOff = true
childDevices.each {
childDevice ->
if (childDevice.currentState("switch").value != "OFF") allOff = false
if (childDevice.currentState("switch").value != "off") allOff = false
}

if (allOff) {
Expand Down

0 comments on commit ec2f04f

Please sign in to comment.