Battery tile messed up in Android


(www.rboyapps.com - Make your home your butler!) #1

@slagle @jody.albritton

With the latest Android built 2.1.1 when using a carousel and multiattributetiles if the Battery (2x2) is on the last row it’s messed up (if it’s the 1st tile it’ll wont’ show properly, if it’s the second last or last tile it WON’T show at ALL!)

Try this:

metadata {
    definition (name: "Battery Tile Messed up on Android", namespace: "rboy", author: "RBoy") {
        capability "Battery"
        capability "Refresh"

    }

    tiles(scale: 2) {
        multiAttributeTile(name:"summary", type: "generic", width: 6, height: 4){
            tileAttribute ("device.enableStatus", key: "PRIMARY_CONTROL") {
                attributeState "...", label: "...", action:"", nextState:"..."
            }
            tileAttribute ("device.temperature", key: "SECONDARY_CONTROL") {
                attributeState("temperature", label:'${currentValue}°',
                               backgroundColors:[
                                   [value: 31, color: "#153591"],
                                   [value: 44, color: "#1e9cbb"],
                                   [value: 59, color: "#90d2a7"],
                                   [value: 74, color: "#44b621"],
                                   [value: 84, color: "#f1d801"],
                                   [value: 95, color: "#d04e00"],
                                   [value: 96, color: "#bc2323"]
                               ]
                              )
            }
        }

        standardTile("monitorStatus", "device.monitorStatus", width: 2, height: 2, canChangeIcon: false, inactiveLabel: true, canChangeBackground: false, decoration: "flat") {
            state "...", label: "...", action:"", nextState:"..."
        }

        standardTile("enableStatus", "device.enableStatus", width: 2, height: 2, canChangeIcon: false, inactiveLabel: true, canChangeBackground: false) {
            state "...", label: "...", action:"", nextState:"..."
        }

        standardTile("wifi", "device.wifi", width: 2, height: 1, canChangeIcon: false, inactiveLabel: true, canChangeBackground: false, decoration: "flat") {
            state "5", label: "", icon: "http://smartthings.rboyapps.com/images/wifi_a6.png", backgroundColor: "#FFFFFF"
        }

        standardTile("lfr", "device.lfr", width: 2, height: 1, canChangeIcon: false, inactiveLabel: true, canChangeBackground: false, decoration: "flat") {
            state "5", label: "", icon: "http://smartthings.rboyapps.com/images/wifi_a6.png", backgroundColor: "#FFFFFF"
        }

        carouselTile("cameraDetails", "device.image", width: 6, height: 4) { }

        standardTile("take", "device.image", width: 2, height: 2, canChangeIcon: false, inactiveLabel: true, canChangeBackground: false) {
            state "taking", label:'Taking', action: "", icon: "st.camera.take-photo", backgroundColor: "#53a7c0"
        }

        valueTile("lastUpdate", "device.lastUpdate", width: 2, height: 1, inactiveLabel: false, decoration: "flat") {
            state "lastUpdate", label:'Last Update ${currentValue}'
        }

        standardTile("forceUpdate", "device.lastUpdate", width: 2, height: 2, canChangeIcon: false, inactiveLabel: true, canChangeBackground: false, decoration: "flat") {
            state "", label:'Sensor Update', action: "forceSensorsUpdate", icon: "http://smartthings.rboyapps.com/images/sensors.png"
        }

        valueTile("battery", "device.battery", width: 2, height: 2, inactiveLabel: false) {
            state "battery", label:'Battery\n ${currentValue}%', unit: "", backgroundColors:[
                [value: 15, color: "#ff0000"],
                [value: 30, color: "#fd4e3a"],
                [value: 50, color: "#fda63a"],
                [value: 60, color: "#fdeb3a"],
                [value: 75, color: "#d4fd3a"],
                [value: 90, color: "#7cfd3a"],
                [value: 99, color: "#55fd3a"]
            ]
        }

        valueTile("temperature", "device.temperature", width: 2, height: 2) {
            state("temperature", label:'${currentValue}°',
                  backgroundColors:[
                      [value: 31, color: "#153591"],
                      [value: 44, color: "#1e9cbb"],
                      [value: 59, color: "#90d2a7"],
                      [value: 74, color: "#44b621"],
                      [value: 84, color: "#f1d801"],
                      [value: 95, color: "#d04e00"],
                      [value: 96, color: "#bc2323"]
                  ]
                 )
        }

        standardTile("refresh", "device.status", width: 2, height: 2, inactiveLabel: false, decoration: "flat") {
            state "refresh", action:"refresh.refresh", icon:"st.secondary.refresh"
        }
        
        standardTile("ledStatus", "device.ledStatus", width: 2, height: 2, canChangeIcon: false, inactiveLabel: true, canChangeBackground: false) {
          state "...", label: "...", action:"", nextState:"..."
        }

        standardTile("blank", "device.image", width: 2, height: 1, canChangeIcon: false,  canChangeBackground: false, decoration: "flat") {
            state "blank", label: "", action: "", icon: "", backgroundColor: "#FFFFFF"
        }

        standardTile("blank2x", "device.image", width: 2, height: 2, canChangeIcon: false,  canChangeBackground: false, decoration: "flat") {
            state "blank", label: "", action: "", icon: "", backgroundColor: "#FFFFFF"
        }

        main "summary"
        details(["take", "monitorStatus", "enableStatus", "cameraDetails", "temperature", "refresh", "ledStatus", "lfr", "lastUpdate", "wifi", "blank2x", "forceUpdate", "battery"])
    }
}

def refresh() {
    log.debug "Setting battery to 100%"
	sendEvent name: "battery", value: 100
}

Create this device type and hit refresh, when battery is reported 100% on Android the tile will disappear!


(www.rboyapps.com - Make your home your butler!) #2

It’s totally messed up, infact if you interchange the last 3 full size tiles (2x2) from the last row to second last row and move the second last row 3 half size tiles (1x2) to the last row, now the images in the half size tiles don’t show!!


(www.rboyapps.com - Make your home your butler!) #3

I think part of the issue may be Android is having trouble showing 128x128 size PNG images


(Tim Slagle) #4

It’s really hard to provide support here, please email Jody and I