How do I return a tile from a device?

I have found the wiki reference, there is a lot of information there.

Can someone point me at a tutorial for returning an image tile? I know I can find one in the OpenWeather driver, but need more examples or a reference.

Is it just a HTTP string that gets returned?

Not quite what I wanted. I have a number and a color code. I want to send a tile that is that number with that color for a background.

I could easily use an app on a personal web server that returns the image i want using imagemagic, but wanted something internal.

You can indeed put some HTML in an attribute of your driver code. Then for a tile select your device, attribute as template and then the attribute you put the html in. This is a snippet I use for a Qubino Smart plug. The attribute on the tile is htmlTile:

private void UpdateTile(  ){
    def val = ""
    
    // Create special compound/html tile
    val = "<B>Power : </B> "+ device.currentValue("power").toString() + " W</BR><B>Amperage : </B> " + device.currentValue("amperage").toString() + " A</BR><B>Energy : </B> " + device.currentValue("energy").toString() + " KWh</BR><B>Voltage : </B> " + device.currentValue("voltage").toString() + " V" 
    if( device.currentValue( "htmlTile" ).toString() != val ){
       sendEvent( name: "htmlTile", value: val )
    }
}

Not sure you can do the same using a variable. Too new to Hubitat :slight_smile:

Cheers Rene

The current code is:

        String aTile
        aTile = '<style>table{border: 1px solid black;}th{padding: 15px;}</style><table class = "center" style="background-color:'
        aTile += aQIcolor
        aTile += '><tr><th>'
        aTile += aQI
        aTile += '</th></tr><tr><td>'
        aTile += aQIfactor
        aTile += '/td></tr></table>'
        
        descriptionText = "${device.displayName} Tile is ${aTile}"
		if (txtEnable) log.info "${descriptionText}"

        sendEvent(name: 'AlertTile', value: aTile )

But the return looks blank in the log, event and status page.

Found it! Missing a "

I wish I could see the string returned, it always parses it.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.