forked from SmartThingsCommunity/SmartThingsPublic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request SmartThingsCommunity#3548 from SmartThingsCommunit…
…y/staging Rolling up staging changes to production
- Loading branch information
Showing
14 changed files
with
1,056 additions
and
72 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
devicetypes/smartthings/child-metering-switch.src/child-metering-switch.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/** | ||
* Copyright 2018 SRPOL | ||
* | ||
* 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:https://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: "Child Metering Switch", namespace: "smartthings", author: "SmartThings", mnmn: "SmartThings", vid: "generic-switch-power-energy") { | ||
capability "Switch" | ||
capability "Power Meter" | ||
capability "Energy Meter" | ||
capability "Refresh" | ||
capability "Actuator" | ||
capability "Sensor" | ||
capability "Health Check" | ||
|
||
command "reset" | ||
} | ||
|
||
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") | ||
} | ||
} | ||
valueTile("power", "device.power", decoration: "flat", width: 2, height: 2) { | ||
state "default", label:'${currentValue} W' | ||
} | ||
valueTile("energy", "device.energy", decoration: "flat", width: 2, height: 2) { | ||
state "default", label:'${currentValue} kWh' | ||
} | ||
standardTile("refresh", "device.power", inactiveLabel: false, decoration: "flat", width: 2, height: 2) { | ||
state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh" | ||
} | ||
standardTile("reset", "device.energy", inactiveLabel: false, decoration: "flat", width: 2, height: 2) { | ||
state "default", label:'reset kWh', action:"reset" | ||
} | ||
|
||
main(["switch"]) | ||
details(["switch","power","energy","refresh","reset"]) | ||
} | ||
} | ||
|
||
def on() { | ||
parent.childOnOff(device.deviceNetworkId, 0xFF) | ||
} | ||
|
||
def off() { | ||
parent.childOnOff(device.deviceNetworkId, 0x00) | ||
} | ||
|
||
def refresh() { | ||
parent.childRefresh(device.deviceNetworkId) | ||
} | ||
|
||
def ping() { | ||
refresh() | ||
} | ||
|
||
def reset() { | ||
parent.childReset(device.deviceNetworkId) | ||
} | ||
|
||
def installed() { | ||
sendEvent(name: "checkInterval", value: 2 * 15 * 60 + 2 * 60, displayed: false, data: [protocol: "zwave", hubHardwareId: device.hub.hardwareID, offlinePingable: "1"]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.