/** * Zooz Power Strip Outlet VER 2.0 (CHILD DEVICE) * * Author: * Kevin LaFramboise (krlaframboise) * * Changelog: * * 2.1.0 (11/05/2018) * - Update parent when name changes. * * 2.0.2 (10/16/2018) * - Added support for changing the icon. * * 2.0.1 (09/30/2018) * - Initial Release * * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License * for the specific language governing permissions and limitations under the License. * */ metadata { definition ( name: "Zooz Power Strip Outlet VER 2.0", namespace: "krlaframboise", author: "Kevin LaFramboise", vid:"generic-switch-power-energy" ) { capability "Actuator" capability "Sensor" capability "Switch" capability "Outlet" // capability "Acceleration Sensor" capability "Power Meter" capability "Energy Meter" capability "Refresh" attribute "secondaryStatus", "string" attribute "energyTime", "number" attribute "energyDuration", "string" attribute "powerLow", "number" attribute "powerHigh", "number" command "reset" } simulator { } tiles(scale: 2) { multiAttributeTile(name:"switch", type: "generic", width: 6, height: 4, canChangeIcon: true){ tileAttribute ("device.switch", key: "PRIMARY_CONTROL") { attributeState "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#00a0dc" attributeState "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff" } tileAttribute ("device.secondaryStatus", key: "SECONDARY_CONTROL") { attributeState "default", label:'${currentValue}' } } valueTile("energy", "device.energy", width: 2, height: 2) { state "energy", label:'${currentValue} kWh', backgroundColor: "#cccccc" } valueTile("power", "device.power", width: 2, height: 2) { state "power", label:'${currentValue} W', backgroundColor: "#cccccc" } valueTile("powerHigh", "device.powerHigh", width: 2, height: 1, decoration:"flat") { state "powerHigh", label:'High: ${currentValue} W' } valueTile("powerLow", "device.powerLow", width: 2, height: 1, decoration:"flat") { state "powerLow", label:'Low: ${currentValue} W' } standardTile("refresh", "device.refresh", width: 2, height: 2) { state "default", label:'Refresh', action: "refresh", icon:"st.secondary.refresh-icon" } standardTile("reset", "device.reset", width: 2, height: 2) { state "default", label:'Reset', action: "reset", icon:"st.secondary.refresh-icon" } } preferences { } } def installed() { } def updated() { parent.childUpdated(device.deviceNetworkId) } def on() { parent.childOn(device.deviceNetworkId) } def off() { parent.childOff(device.deviceNetworkId) } def refresh() { parent.childRefresh(device.deviceNetworkId) } def reset() { parent.childReset(device.deviceNetworkId) }