Yes just text and images, but we’re close
/**
* A virtual html switch
*
* no Copyright 2018 MATT BEHNKEN
*
* 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: "A virtual html switch", namespace: "mattbehnken", author: "MATT BEHNKEN") {
capability "Switch"
}
tiles(scale: 2) {
multiAttributeTile(name:"switch", type: "lighting", action: "getHtml", width: 6, height: 4, canChangeIcon: false){
tileAttribute ("device.switch", action: "gethtml", key: "PRIMARY_CONTROL") {
attributeState "on", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#00a0dc", nextState:"turningOff"
attributeState "off", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#00a0dc", nextState:"turningOff"
attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
}
}
htmlTile(name: "tileHtml", action: "getHtml", width:6, height: 5){
tileAttribute ("device.switch", key: "PRIMARY_CONTROL") {
attributeState "on", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#00a0dc", nextState:"turningOff"
attributeState "off", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
attributeState "turningOn", label:'${name}', action:"switch.off", icon:"st.switches.switch.on", backgroundColor:"#00a0dc", nextState:"turningOff"
attributeState "turningOff", label:'${name}', action:"switch.on", icon:"st.switches.switch.off", backgroundColor:"#ffffff", nextState:"turningOn"
}
}
main "tileHtml"
details(["switch", "tileHtml"])
}
}
mappings {
path("/getHtml") {
action: [GET: "getHtml"]
}
}
def getHtml () {
renderHTML {
head {
"""
<style type="text/css">
body {
background-size: contain;
background-repeat: no-repeat;
text-decoration: none;
}
</style>
"""
}
body {
"""
<a href="https://imgbb.com/"><img src="https://image.ibb.co/bKYOkx/Screenshot_20180224_032919_3.png" alt="Screenshot_20180224_032919_3" width="25%" align="right" border="0"></a>
<a color="black" href="https://imgbb.com/"><img src="https://image.ibb.co/jqUw5x/Screenshot_20180224_032919_2.png" alt="Screenshot_20180224_032919_2" width="25%" align="center" border="0"> smart wife </a>
"""
}
}
}
// parse events into attributes
def parse(String description) {
log.debug "Parsing '${description}'"
// TODO: handle 'switch' attribute
}
// handle commands
def on() {
log.debug "Executing 'on'"
// TODO: handle 'on' command
}
def off() {
log.debug "Executing 'off'"
// TODO: handle 'off' command
}