1024 tile?

Has anyone found a workaround for the ... limit of 1024 in a tile?

I've read a little and see it's legacy - no real explanation for why (and I do NOT want to know). HE just gives and gives! ARGH.

But your thread title is a bit inflammatory, and you reference something you don’t want to talk about in the OP :thinking:. When someone says, “pay no attention to the man behind the curtain,” people are usually gonna look, if for no other reason than you brought it up in the first place. That strikes me as strange.

Why not just ask whether anyone has any effective workarounds, if that’s where you’d like the discussion to remain focused?

7 Likes

Its a secret. They did it just to annoy users. Don't tell anyone!

But really, why not give an example where you are running into this issue, and why you need more characters than 1024 on a tile. That 1024 limit is a LOT of stuff in one little space. You can Tweet something with 140 (or 280) characters for goodness sakes.

5 Likes

I changed it just for you MTK

I am trying to help another Dev on a layout problem. I fixed it but it can't be displayed on a dashboard because of the 'limit'.

// TO DO: show next game on tile whenever showing last game?
def getGameTile(game) {
logDebug("Getting game tile for ${state.team.displayName}")
def gameTile = "

"
def isClearWhenInactiveConfig = getClearWhenInactiveSetting()
if (!isClearWhenInactiveConfig || (isClearWhenInactiveConfig && !isInactive())) {
def textColor = getTextColorSetting()
def fontSize = getFontSizeSetting()
def colorStyle = ""
if (textColor != "#000000") colorStyle = "color:" + textColor
if (game != null) {
def detailStr = null
def gameFinished = (game.status == "Scheduled" || game.status == "InProgress") ? false : true
if (game.status == "InProgress") detailStr = game.progress
else if (gameFinished) detailStr = game.status
else detailStr = game.gameTimeStr

        gameTile = "<div style='overflow:auto;height:90%;font-size:${fontSize}%;${colorStyle};'><table width='100%'>"
        gameTile += "<tr><td style='background-image: url(${game.awayTeam.logo});background-position: center;background-repeat: no-repeat;background-size: contain;background-origin: padding-box;'><img src='shorturl.at/fyU06' width='100%'></td>"
        gameTile += "<td width='10%' align=center>at</td>"
        gameTile += "<td style='background-image: url(${game.homeTeam.logo});background-position: center;background-repeat: no-repeat;background-size: contain;background-origin: padding-box;'><img src='shorturl.at/fyU06' width='100%'></td></tr>"
        if (parent.showTeamName) {
            gameTile += "<tr style='padding-bottom: 0em'><td width='40%' align=center>${game.awayTeam.name}</td>"
            gameTile += "<td width='10%' align=center></td>"
            gameTile += "<td width='40%' align=center>${game.homeTeam.name}</td></tr>"
        }
        if (parent.showTeamRecord && !getHideGameResultSetting()) {
            def awayTeamRecordSuffix = ""
            if (league == "NHL") awayTeamRecordSuffix = "-" + game.awayTeam.overtimeLosses
            else if (league == "NFL") awayTeamRecordSuffix = "-" + game.awayTeam.ties
            def homeTeamRecordSuffix = ""
            if (league == "NHL") homeTeamRecordSuffix = "-" + game.homeTeam.overtimeLosses
            else if (league == "NFL") homeTeamRecordSuffix = "-" + game.homeTeam.ties
            gameTile += "<tr><td width='40%' align=center style='font-size:${fontSize*0.75}%'>${'(' + game.awayTeam.wins + '-' + game.awayTeam.losses + awayTeamRecordSuffix + ')'}</td>"
            gameTile += "<td width='10%' align=center></td>"
            gameTile += "<td width='40%' align=center style='font-size:${fontSize*0.75}%'>${'(' + game.homeTeam.wins + '-' + game.homeTeam.losses + homeTeamRecordSuffix + ')'}</td></tr>"
        }
        gameTile += "<tr style='padding-bottom: 0em;'><td width='100%' align=center colspan=3>${detailStr}</td></tr>"
        if (parent.showChannel && game.channel != "null" && game.channel != null && !gameFinished) gameTile += "<tr><td width='100%' align=center colspan=3 style='font-size:${fontSize*0.75}%'>${game.channel}</td></tr>"
        gameTile += "</table></div>"
    }
}
return gameTile

In terms of a workaround, I have been recently starting to write html files to local storage. Also gets around some limitations with html in attributes.

1 Like

I ran into that when trying to serve up a data URI for an image. It was way too many characters.

My workaround was to write a small lightweight app with an HTTP entrypoint that returned the content. Kind of annoying, but it works.

Another thing I noticed was that the 1024 limit only seemed to be imposed when the dashboard loaded. If I pre-loaded something small and then re-set the attribute to >1024, it works. But I didn't find a reliable way to do that dance when loading dashboards.

3 Likes

the original developer pulls an image string which ultimately gets served via wiki - about 70 chars long and there are 2 of them. without going back yet, he must have been reallllly close to the limit aread as I only added about 80 chars to his code for the fix. Wiki has a 'shortURL' api and looking into seeing if I can fix the new problem in this way. doubtful. I also use a 1x1 gif and I had intended on embedding using the very common base64 - guess thats a waste of time as well.

I think it was limited to 1024 for performance reasons.

It was at one point 256 and got bumped. I actually remember when this change was implemented.

1 Like

My suggestion would still be to save that html (gameTile) to a local file on the HE hub. @thebearmay recently shared some code that has helped me do this, from memory he may have crafted it from Hubigraphs. I'll have a few examples of it in use myself over the next week or two, or can share some early copy of my code if you are interested.

I myself would be very interested! One item that was recently pointed out is 'local' based functionality that's not truly local. and I'm a culprit. I wrote a driver (I think you helped!) and it points at my github for the icons. That clearly is a no-no that I hadn't perceived. yet I don't have an easy way of moving or storing the icons into the hub itself. I could see your work impacting that out of the git-go (pun intended.) As well, being free to build useful tiles that aren't limited in the archaic way I've crashed into, that would be a boon as well. Just point a flashlight, and I'll follow!

1 Like

Ignore the library header on this as trying to use it that way will cause a 500 error. Code for the file manager was derived from the Hubigraphs code and modified for general use.

https://raw.githubusercontent.com/thebearmay/hubitat/main/libraries/localFileMethods.groovy

2 Likes

Hopefully I'll release one or two examples of my use of this over the weekend, but everything you need is in @thebearmay 's code. Like I hinted at, prepare your HTML like you already are in the game tile variable and then write it to a file, which you can configure on a Preference setting for the file name. I then include an iFrame attribute that links to the HTML file, or you could use existing iFrame drivers. I personally like the work of @mbarone with the advanced iFrame driver, but it is also good to have a built-in option.

I almost succeeded with @thebearmay localFileMethods but wasn't able to get the blob into the local file - I keep getting the URL stored. I recognize what is going on, but I'm not yet sure how to stuff the raw file into the store file.
@sburke781 I'll patiently wait for your examples - I learn quite a lot from you gents and I'm in no hurry!

It would seem these types of needs are common. NM. not being able to use sub-folders sure is messy...

1 Like

Haven't gotten a blob working just yet, have a couple of ideas to try but haven't had the time to play yet...

Text type files seem to work without issue though.

1 Like

Yeah I have only been storing text files at this stage as well, sorry, thought that was all you needed as well.

yea. the text file read/write wasn't to egregious but it seems the image blob is a horse of a different color!

Reading the blob isn’t too bad just haven’t cracked the write.

Just a thought - what if I snap the apache library for fileutils and store it in the hub? Can I then call the functions of fileUtils.copyUrlToFile? isn't that what the new Library thing is for?

No, it's for code sharing between several apps/drivers.

3 Likes