AC7SS
October 5, 2022, 1:07am
1
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?
AC7SS
October 5, 2022, 5:31pm
3
rlithgow1:
Yes, for template pick image, then just put in the url to the image.
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
Cheers Rene
AC7SS
October 5, 2022, 10:14pm
5
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.
AC7SS
October 5, 2022, 10:23pm
7
I wish I could see the string returned, it always parses it.
system
Closed
October 5, 2023, 10:23pm
8
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.