Hi!
I’m having problems using templates while customizing entities.
This is how configuration.yaml looks. Neither of the customizations is working, but when i open the card for a sensor for example, it returns the template in clear text under the history for the component. Do i have to enable anything for this to work?
That looks like it should work. The brackets are unnecessary but that shouldn’t affect the outcome. maybe needs to be icon_color inside glob? EDIT: doesn’t look like it needs to be icon color…
Yeah, I originally tried with 3 equal signs, but tried with 2 and forgot to change it back.
It should work, as I copied the last bit off of this forum. So it’s rather odd that it’s not working for me. Other customizations works fine, but they are not made with templating.
Templating inside ‘customize’ requires some sort of ‘add on’ called CustomUI
… which adds this feature.
So: if all you were trying to do is change the color of an input_boolean based on state and toggle some other element visibility, consider using a switch.template element instead.
first of all, rgb_color isn’t supported any longer, so you can take that out.
2nd: have you installed the custom-ui?
3d: dont use icon: and a template for the icon in the sensor. You have that in all of the above examples…
if you have a template sensor, you set the icon_template in the declaration of the sensor itself. If you use another entity, you set the icon template in customize:
Thanks Marius.
In my examples, I have just used all the different versions of users above, but none of them works.
2nd: yes, I have installed it. Is there a way to check if the installation was successful?
3rd: if I understand correctly, I should not use icon: and template: together, ie. either or?
So I have adjusted my customize.yaml to this, but still no joy:
sensor.broadlink_s1c_office_front:
friendly_name: Office Front Door
show_last_changed: true
# icon: mdi:door-closed
templates:
icon: >
if (state === 'open') return 'mdi:door-open';
return 'mdi:door-closed';
icon_color: >
if (state === 'open') return 'red';
return 'green';
i think this should work…
that being said, why version HA are you on? Right now, Ive updated to HA 0.81.2, and many customizations are off.
only thing I could say from here is you have to check if the states are really ‘open’ . Then again, if they wouldn’t be ‘open’ the else would have to check, which would be the ‘green’ and ‘door-closed’.
this customization is perfect, so if its not working, something else in the system/ setup isnt correct, or a bug is going on.
I’m on Hassio 0.81.2
I’m starting to wonder if CustomUI is properly installed. Nothing shows up on System although I followed the manual installation instructions perfectly. How could I check and how could I fix the installation?
if not then you should indeed check. do you have the .update.sh in your config directory? you know how to run it?
still, I fear the lates HA version has some issues with customize, because in both my installs customizations have flukes. And the truly annoying thing is they are not identical…while my customizations are.
Yes when I click on the “i” sign it doesn’t show me that CustomUI is installed, so I guess it doesn’t run.
I followed the instructions here: https://github.com/andrey-git/home-assistant-custom-ui/blob/master/docs/installing.md and tried both manual installation and running update.sh
I added customizer: custom_ui: hosted to my config and everything else. I can’t figure out why it wouldn’t run.
I have now also updated to 0.81.5 but no change. So weird.
Ive been using it for so long, I forgot how to install…
first, do the automatic instal via .update.sh (you have to create the file first and make it executable)
that would place all necessary files in the correct folders.
that isn’t enough though, as I found out setting up a spanking fresh install.
one also needs the frontend to load the custom card via:
I do that in a frontend.yaml file which is called i the configuration.yaml via
frontend: !include frontend.yaml
as a final step, to make thing easy and forget, one can set the custom-ui to be used globally in HA, and never have to specify it again via this setting in customize_glob.yaml
'*.*':
custom_ui_state_card: state-card-custom-ui
again, I call this customize_glob.yaml in configuration.yaml:
homeassistant:
# Name of the location where Home Assistant is running
name: Home
latitude: !secret latitude
longitude: !secret longitude
elevation: !secret elevation
unit_system: metric
time_zone: !secret time_zone
customize: !include_dir_merge_named customize
customize_glob: !include customize_glob.yaml
packages: !include_dir_named packages
customizer: !include customizer.yaml
frontend: !include frontend.yaml