Thanks for keeping on with it - I’ve just rebuilt my whole UI using mostly your tiles now! One small ‘bug’ I’ve come across, when text overflows to a second row, it seems to lose its alignment. For example:
Normal display, note the centred text:
When text becomes too long for the line it turns to right aligned, i.e. when my weather description becomes longer (ignore the overlapping time, I had to squash things to reproduce it):
Thanks for the fix, works perfectly in Chrome and Firefox, but I seem to be getting the same behaviour in Opera 57 on Windows.
Yeah I’m getting there, got a bit of a menu system going to display different cards on a wall mounted tablet. I’ll put up a demo once it’s finished. Just having some performance issues at the moment, after a few hours my tablet browser freezes up or crashes. I need to narrow down the cause, but don’t suspect it’s tiles doing it at this stage, and it may just be a Lovelace thing in general.
Another feature request I’ve come across that would be handy, is a separate service call for long-presses on tiles. Similar to this.
@rodrigodf - I would just like to say thank you very much for making a really great Tiles UI card for Lovelace. Both the built-in Entity Button card and the Custom Button card massively pale in comparison to the amazing work you are doing here. Thanks!
@rodrigodf I’ve started to transition my non-lovelace Tiles config to your new one and I think I’ve found a bug with background colours.
It looks like the “background” colour section within “entities” doesn’t work when the entity is a group (on or off), as it defaults to a green/red colour.
On another note, how would I make the text and icon appear on the same line please? It seemed to default to being on the same line in the original Tiles version:
Sorry, one more question, is there a way to make the text bold? I guess I need to use CSS styles, but not quite sure how. My lame attempt was to try the following, but it didn’t work.
though I don’t use the latest version, (since it broke too many dedicated settings of my legacy tiles… reverted to version 1) my groups are colored like this: config wide settings under the config, entity overrides in the entity setting:
type: custom:tiles-card
legacy_config:
row_height: 25px
text_uppercase: false
text_size: 1em
text_color_on: '#555B65'
text_color_off: '#F0C209'
text_sec_color_on: '#555B65'
color_on: '#F0C209'
color_off: '#555B65'
# icon_size: 25px works but is not necessary
entities:
- entity: group.all_lights_only
label_template: >
if (entities['sensor.lights_badge'].state !== 0) return 'Total lights on: ' + entities['sensor.lights_badge'].state;
return 'No lights on';
icon_template: >
if (state === 'on') return 'mdi:power-plug';
return 'mdi:power-plug-off';
style_template: >
if (state == 'on') return 'min-height: 25px;--tiles-icon-color: #555B65';
return 'min-height: 25px;--tiles-icon-color:#5daf35';
color_on: '#5daf35'
text_color_off: 'green'
column: 1
column_span: 3
row: 1
row_span: 1
- entity: group.all_hallway_lights
label: All hallway and ambient lights
icon_template: >
if (state === 'on') return 'mdi:power-plug';
return 'mdi:power-plug-off';
style_template: >
if (state == 'on') return 'min-height: 25px;--tiles-icon-color: #F0C209';
return 'min-height: 25px;--tiles-icon-color:#5daf35';
color_on: '#cf2525'
text_color_on: '#f0c209'
text_color_off: '#5daf35'
column: 1
column_span: 3
row: 2
row_span: 1
see the code for the first question. using label and icon, or in my setting _template for both seems to do the trick. Unless of course the tile isn’t large enough (both wide or tall) to have them fit both.
This is a feature I had previously thought of adding, but will probably require many modifications. I am currently involved in other projects and have no time at the moment, but I intend to add this feature in the future.
I believe the mistake is happening because you wrote backgroud instead of background. Note that whenever any setting is entered incorrectly, it is ignored.
For the text and icon to appear on the same line you must use the orientation: attribute that accepts the vertical (default) and horizontal values. Note that when the orientation is vertical label will be in the top and label_sec will be in the bottom, when the orientation is horizontal label will be on the left and label_sec on the right, the icon will always be in the middle (if it exists).
Another setting that can help you is align: that aligns all the content within the tile and accepts left, center and right values for horizontal alignment and top, middle and bottom values for vertical alignment. You can use only one type of alignment or combine the two by separating them with a space, the default is align: ‘center middle’:
You can also use the padding attribute (for label, label_sec and icon) to place them in a specific position, as in the example below that I have aligned in “bottom center” and raised label_sec 130px:
Thank you @Mariusthvdb and @rodrigodf for your incredibly useful replies, I will be trying them out this evening.
oh dear, what a fool I am for missing the obvious spelling mistake, thank you for pointing that out.
@rodrigodf the screenshots and example yaml you’ve given in your reply to me and on previous posts have been very useful. If you have chance, would you mind including these on your GitHub page, perhaps in a “Question & Answer Examples” wiki page please? I’m the sort of person who is much better able to understand code if I can see the visual example alongside it, as you have done here.
Just to help anyone new to this thread, here are the links to @rodrigodf’s excellent work!
You mentioned above that the icon will always be in the middle, which means label_sec is required to have the icon to the left, resulting in no options to have text below. I suspect this could be done using padding, but I’ll be viewing this on desktop and small screen so don’t want to have fixed positions.
Now to be honest, this is purely an aesthetics issue as I have no qualms using the following layout if it’ll be a pain to make the above example work.
Kiosk mode helps display this summary on my HyperPixel display which is next to the door, so that I can see the house status at a quick glance, as well as the weather outside.
Anyone know if there is a way to make the text closer together on 2 lines of text?
Look at the bottom row of my radion player, I made the text smaller, but it still doesn’t look right to me, and if there was a way to make the 2 rows of text (ie. Kitchen & Portable) closer together.
I’ve tried using just label: and using label: and label_sec: and both, and every combination of align and padding I can think of.
I am having trouble upgrading tiles on the latest version of Home Assistant. I am running 65.6 and tiles are working great. I have a test system running 85.1 but I am having trouble with icons and colors. I am using an input_text entity as the container and switch entities for the buttons.
Perhaps if only a row number was specified (as shown below), it could work out how to spread the buttons evenly over the card width. As it stands, it currently looks like this: