Handling long strings in tiles


#1

Has anyone come up with a good way to handle long strings in tiles? I was contemplating either trimming, replacing (I use common text to identify brand and type) or truncating but was interested to see how others have dealt with it.
IMG_0578


#2

No personal experience here but it looks like something that could be mitigated with a single replace expression. Set the tile title to something like this:

replace($device.name, @tileDeviceNamePattern, '')

where you globally define @tileDeviceNamePattern = '(Arlo|ST) +'. Basically all the text that you want to remove. If you only want to remove the brands if the text is over a certain number of characters you can control that in the pattern, too. @tileDeviceNamePattern = '(Arlo|ST) +(?=.\{20\})' will only remove device names if they are followed by 20 more letters. Not sure if you’re familiar with regular expressions like this, but generally you should be able to add as many brands as you want, separated by the | character, e.g. (Arlo|ST|Aeon|Fibaro).


#3

what i have done over time is to remove the brand, give all my rooms 2 digit codes and change the sensor or device to a 2 digit code. so ST Multi Living Room Window 2 is now LV XS Window 2. then i pad the length of title text to n, like say 15 characters. so, they all look uniformly sized. some examples

Living room Temperature Sensor Fireplace = LV TS Fireplace
Dining room Multi sensor                 = DN XS Room
Hangout room Motion Sensor               = HO MS Room

#4

Thanks for the suggestions! I actually think I will do both!

@bangali I had intended to use short descriptors but it never really happened, then it got to the point where the list is about 80 long! I need to spend an evening going through it I think.

@ipaterson your regex skills exceed mine, in fact without StackOverflow they would be none existent! I will use the example and add in the other brands (after they have been cleaned). I was thinking about may be using icons to denote type allowing me to remove device types from the text too.


#5

cool. if you wanted to have some fun, you could also combine them so your names in ST stay the same but for display on the tile they are standardized and shortened. :slight_smile: