Skip to content

Instantly share code, notes, and snippets.

@vl4ds
Created September 17, 2016 01:08
Show Gist options
  • Save vl4ds/b61496a20b08e22789a3e20d742e9508 to your computer and use it in GitHub Desktop.
Save vl4ds/b61496a20b08e22789a3e20d742e9508 to your computer and use it in GitHub Desktop.
/**
* Test Render of All Text Tiles
*
* Copyright 2016 Patrick Stuart
*
* 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.
*
*/
def texts = ["123", "123456", "12345 67890", "12345678901234567890"]
metadata {
definition (name: "Test Render of All Text Tiles", namespace: "pstuart", author: "Patrick Stuart") {
}
simulator {
}
def tileDetails = []
tiles(scale: 2) {
(1..6).each { w -> //width
(1..8).each { h -> //height
(0..3).each { t -> //text
tileDetails << "vt${w}${h}${t}"
valueTile("vt${w}${h}${t}", "vt${w}${h}${t}", decoration: "flat", width: w, height: h) {
state "default", label:"${h}x${w}" + texts[t]
}
}
}
}
(1..6).each { w -> //width
(1..8).each { h -> //height
(0..3).each { t -> //text
standardTile("st${w}${h}${t}", "st${w}${h}${t}", width: w, height: h) {
state "default", label:"${h}x${w}" + texts[t], backgroundColor:"#cccccc"
}
tileDetails << "st${w}${h}${t}"
}
}
}
main "vt110"
details(tileDetails)
}
}
// parse events into attributes
def parse(String description) {
log.debug "Parsing '${description}'"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment