Update neo coolcam outlet

Ignore negative values
 DHT cleanup
This commit is contained in:
pgrondek 2020-09-18 15:24:50 +02:00
parent a1f2b5a877
commit e915eace80

View File

@ -13,7 +13,7 @@
* *
*/ */
metadata { metadata {
definition (name: "Neo Coolcam Outlet", namespace: "pgrondek", author: "Przemysław Grondek", ocfDeviceType: "oic.d.switch", runLocally: true, minHubCoreVersion: '000.017.0012', executeCommandsLocally: false, genericHandler: "Z-Wave") { definition (name: "Neo Coolcam Outlet", namespace: "pgrondek", author: "Przemysław Grondek", ocfDeviceType: "oic.d.switch", /* runLocally: false, minHubCoreVersion: '000.017.0012', executeCommandsLocally: false, genericHandler: "Z-Wave" */) {
capability "Energy Meter" capability "Energy Meter"
capability "Actuator" capability "Actuator"
capability "Switch" capability "Switch"
@ -87,18 +87,11 @@ def installed() {
log.debug "installed()" log.debug "installed()"
// Device-Watch simply pings if no device events received for 32min(checkInterval) // Device-Watch simply pings if no device events received for 32min(checkInterval)
initialize() initialize()
if (zwaveInfo?.mfr?.equals("0063") || zwaveInfo?.mfr?.equals("014F")) { // These old GE devices have to be polled. GoControl Plug refresh status every 15 min.
runEvery15Minutes("poll", [forceForLocallyExecuting: true])
}
} }
def updated() { def updated() {
// Device-Watch simply pings if no device events received for 32min(checkInterval) // Device-Watch simply pings if no device events received for 32min(checkInterval)
initialize() initialize()
if (zwaveInfo?.mfr?.equals("0063") || zwaveInfo?.mfr?.equals("014F")) { // These old GE devices have to be polled. GoControl Plug refresh status every 15 min.
unschedule("poll", [forceForLocallyExecuting: true])
runEvery15Minutes("poll", [forceForLocallyExecuting: true])
}
try { try {
if (!state.MSR) { if (!state.MSR) {
response(zwave.manufacturerSpecificV2.manufacturerSpecificGet().format()) response(zwave.manufacturerSpecificV2.manufacturerSpecificGet().format())
@ -139,14 +132,17 @@ def parse(String description) {
} }
def handleMeterReport(cmd){ def handleMeterReport(cmd){
log.debug("handleMeterReport")
if (cmd.meterType == 1) { if (cmd.meterType == 1) {
if (cmd.scale == 0) { if(cmd.scaledMeterValue >= 0 ){
createEvent(name: "energy", value: cmd.scaledMeterValue, unit: "kWh") if (cmd.scale == 0) {
} else if (cmd.scale == 1) { createEvent(name: "energy", value: cmd.scaledMeterValue, unit: "kWh")
createEvent(name: "energy", value: cmd.scaledMeterValue, unit: "kVAh") } else if (cmd.scale == 1) {
} else if (cmd.scale == 2) { createEvent(name: "energy", value: cmd.scaledMeterValue, unit: "kVAh")
createEvent(name: "power", value: Math.round(cmd.scaledMeterValue), unit: "W") } else if (cmd.scale == 2) {
} createEvent(name: "power", value: Math.round(cmd.scaledMeterValue), unit: "W")
}
}
} }
} }