I am looking to create and use 2 virtual switches for mode setting and routines based on myself and my wife’s current state: sleeping vs. awake
We use mobile presence as well, but this will add an extra layer of control in automations.
I used a generic switch DTH and modified it to use a 6x4 tile.
What I can’t figure out is why in the tile it adds a link to “a device” in this case itself (replicating device name). I’d like to get rid of this. How can I accomplish this?
Also, if I attempto to modify settings, or just open settings and “done” out of them, I get an error…
Can anyone help? I’d like to understand how to do this, and what I did wrong. BTW, if not obvious, I’m a complete Noob when it comes to code.
/**
- Copyright 2015 SmartThings
- 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.
- On/Off Button Tile
- Author: cozdabuch
- Date: 2013-05-01
*/
metadata {
definition (name: “Sleeping/Awake Status”, namespace: “smartthings”, author: “SmartThings”) {
capability “Actuator”
capability “Switch”
capability “Sensor”
}
// simulator metadata
simulator {
}
// UI tile definitions
tiles (scale: 2){
standardTile(name:“switch”, type: “generic”, width: 6, height: 4, canChangeIcon: true) {
state “off”, label: ‘AWAKE’, action: “switch.on”, icon: “st.Health & Wellness.health12”, backgroundColor: “#d6d6d6”, nextState: “on”
state “on”, label: ‘SLEEPING’, action: “switch.off”, icon: “st.Bedroom.bedroom2”, backgroundColor: “#aa797c”, nextState: “off”
}
main “switch”
details “switch”
}
}
def parse(String description) {
}
def on() {
sendEvent(name: “switch”, value: “on”)
}
def off() {
sendEvent(name: “switch”, value: “off”)
}