Custom UI: Tiles

yes, that s very nice indeed, and i need to use it for my Hue lights that can show On while in fact they are ‘unreachable’ because the power to them is switched off. Using this prevents me from accidentally switching them off…

  - entity: light.driveway
    label: Driveway
    icon: mdi:car
    column: 1
    column_span: 1
    row: 6
    row_span: 2
    style_template: "if (entities['binary_sensor.driveway_reachable'].state === 'off') return 'display:none';"
2 Likes

was pointed to the '-- 'necessity by @eddi89 here: https://github.com/c727/home-assistant-tiles/issues/44#issuecomment-382911774 Thanks!

since these aren’t toggle-tiles the color-on/off option obviously is incorrect (which is why i have all these templates i the first place, and config-settings aren’t applicable).

turns out it wasn’t text-sec-color: but --text-sec-color: that was needed:

39

only too bad adding this extra template, frustrates the text-decoration: line-through, which was working perfectly.

  - entity: script.tester_on
    label_sec: 'Tester on'
    style_template: "if (entities['sensor.tester_state'].state === 'on') return 'background-color: #F0C209; --tiles-text-sec-color: #555B65; color: #555B65';
                      else return 'background-color: #555B65; --tiles-text-sec-color: #F0C209; color: #F0C209; text-decoration: line-through';"
    icon_template: "if (entities['sensor.tester_state'].state === 'on') return 'mdi:power-plug'; else return 'mdi:power-plug-off'"

not sure if this is an issue or not? do these templates have a max number of configurable options?

1 Like

@eddi89 Wow, thank you so much for adding the weblink support so quickly!
It is working great!

Any trick or way to control vertical-align?
now I’m using that code to show second state on bottom

        color_on: 'transparent'
        color_off: 'transparent'
        column: 1
        column_span: 3
        row: 6
        row_span: 4
        icon: mdi:map-marker
        icon_size: 80px
        text_color: 'transparent'
        text_sec_color: 'white'

whats wrong with this template please, i need the multiple condition, but have formatted it incorrectly i am afraid.

 - entity: group.all_lights_only
        icon_template: "if (state === 'on') and (entities['sensor.driveway_reachable'].state === 'True') return 'mdi:power-plug';
                        else return 'mdi:power-plug-off';"

is the ‘and’ the wrong syntax, or should I change the brackets somehow?
have also tried:

if (condition1) && (condition2 )
if (condition1 and condition2)
if (condition1 && condition2)

as it stands, it shows the incorrect icon. the group state = on, the entities state in False, so it should return the else power-plug-off. it doesn’t…
no error, and a valid configuration through the checker.

the entities condition itself works fine, i use it elsewhere in the tiles, with desired result. It must be the combination of the conditions

@eddi89 how should we format multiple conditions? hope you can have a look please.

cheers,
Marius

1 Like

Thanks all, with help of this thread remade my front end to tiles,
from this:

to this:

possible make .png to icon, or just mdi:?

8 Likes

you can use something like this

style_template: “return ‘background-image: url("/local/icons/’ + state + ‘_left_1.png");’”

for .png files

Tried this method, it saves place for icon but not showing it just moves the text little right

I don’t know if it’s mistake in my code or it is not possible

EDIT: Trying to change icon not background picture

Hi,
is it possible to show next row when the first row state is on Or the first row switch is on then show the second row switch?

Thanks

Hey guys - love this addon, but having some problems with adding images.

I want to have some custom images and this works if my images are 72x72 pixels

input_text.airplay:
custom_ui_state_card: state-card-tiles
config:
columns: 5
column_width: 72px
row_height: 72px
color: grey
entities:
- entity: script.airplay_select_x977
image: /local/Images/X977.png

However it looks really bad on high resolution screens:

If I use a 512x512 image I can only see the top left part of the image and was wondering how I could show the full size image, but scale it down to fit the 72x72 button?

Thanks

***** EDIT ****
I Fixed this with CSS

input_text.radio:
custom_ui_state_card: state-card-tiles
config:
columns: 6
row_height: 50px
color: white
entities:
- entity: script.airplay_select_x977
style_template: “return ‘background-image: url(/local/Images/X977.png); background-size: contain;’”

1 Like

Forgive me if this has been covered but I couldn’t see it anywhere in the repository or thread above, what domains are supported?

script and input_boolean are from the examples above but what about remote (if a boolean ON and OFF is defined, or if it is just a single command?)

I’m using the tiles and like it very much. I did run into a small issue. When closing an persistent notification the tiles change (see below). refreshing the page fixes it.
Anybody ran into this issue?

yes,

its driving me mad not being able to solve that…
made an issue report on the GitHub https://github.com/c727/home-assistant-tiles/issues/28 but unfortunately it is still unresolved.

Since i get 2 persistent notifications at each boot since updating to 69.1 (not loading HAssio and the silly discovery notification) it is not such a small issue any longer…

on the App this is even more pronounced:

at startup with persistent notifications:

after dismissing

after reload

trying to solve the above issue, which has tiles with heights that adjust to the info being displayed dynamically, i want to have the tiles only show 2 lines (instead of possible 3 when the value is too long to fit and needs the 3d row):

example:

  - entity: switch.sw_tester_template
    label_sec_template: >
      if (state === 'on') return 'Tester' + 
            entities['sensor.tester_actueel'].state;
      return 'Tester off';
    icon_template: >
      if (state === 'on') return 'mdi:test-tube';
      return 'mdi:test-tube-off';

this shows the Tester tile with name Tester and its value.

Trying to take the word Tester out only to show the value, I tested this:

      - entity: switch.sw_tester_template
        label_sec_template: >
          if (state === 'on') return   entities['sensor.tester_actueel'].state;
          return 'Tester off';
        icon_template: >
          if (state === 'on') return 'mdi:test-tube';
          return 'mdi:test-tube-off';

But that wouldn’t show any text nor value. This however does work:

      - entity: switch.sw_tester_template
        label_sec_template: >
          if (state === 'on') return '' + 
                entities['sensor.tester_actueel'].state;
          return 'Tester off';
        icon_template: >
          if (state === 'on') return 'mdi:test-tube';
          return 'mdi:test-tube-off';

Why do i need to show the empty text '' and doesnt the entities['sensor.tester_actueel'].state (also tried states.sensor.tester_actueel.state ) show when on its own?

Thanks for you help,
Marius

copying this to a separate thread.

HI, as a side topic on your example, how do you get the Buienradar screen to show up and be dynamic?

Ok nice to know im not the only one. I will keep an eye on the github thanks!
As for the buienrader screen i added a camera with these settings:

platform: generic
still_image_url: http://api.buienradar.nl/image/1.0/RadarMapNL?w=500&h=512
name: Buienradar

Anyone know if it’s possible to alter the formation of the tiles based on a value.

Let’s say I want to control my Nest.
If on heat
If on cool
Show 1 number (with up and down arrows)

If on heat And cool
show 2 numbers (with up and down arrows)

If not a longer work around could be to change the color of the tiles to the background color if not used?
Any thoughts?

I just have a question. Just for trying I copied the whole github from mviezzer (https://github.com/maattdiy/home-assistant-config/tree/master/config).

Why can’t I see any tile ?
I used this https://github.com/andrey-git/home-assistant-custom-ui/blob/master/docs/installing.md to install, and then just copied everything.

so been plugging away at this and have the following layout (where the cool buttons are hidden when in heat only mode).
The bit I cant figure out is how to increase the temp by 1 for example:

  - entity: climate.nest
    label_template: '{{ states.climate.nest.attributes.target_temp_low }}'
    service: climate.set_temperature
    data:
      entity_id: climate_nest
      target_temp_high : temperature +1

the data component in the docs mentions it can be YAML or JSON. so assuming i could also use:

{
“entity_id”: “climate.nest” , “target_temp_high” : temperature +1
}

but i dont understand how to add the math part to this.

if someone could point me in the right direction that would be super helpful :smiley:
thanks

I’m liking this a great deal. Thanks for making it.

3 Likes