Has anyone found a solution? I’m still struggling with this. None of my icons or colors get adjusted and yes, I have CustomUI installed. Thanks
works just fine, give us your code and we can help
Thanks. I tried pretty much everything, but nothing works. All icons and colors remain unchanged.
Here are some of the versions I tried:
sensor.broadlink_s1c_living_front:
friendly_name: Living Front Door
show_last_changed: true
icon: mdi:door-open
templates:
rgb_color: if (state === 'closed') return [51, 153, 255]; else return [255, 0,0];
icon_template: '{{ ''mdi:door-open'' if is_state(''sensor.broadlink_s1c_living_front'',''open'') else ''mdi:glassdoor'' }}'
sensor.broadlink_s1c_living_side:
friendly_name: Living Side Door
icon: mdi:door-open
show_last_changed: true
templates:
icon_color: "if (state === 'closed') return 'rgb(51, 153, 255)'; else return 'rgb(255, 0, 0)';"
icon_template: "{{ 'mdi:door-open' if is_state('sensor.broadlink_s1c_living_side', 'open') else 'mdi:door-open' }}"
sensor.broadlink_s1c_office_motion:
friendly_name: Office Motion
show_last_changed: true
icon: mdi:walk
templates:
rgb_color: "if (state === 'no_motion') return [#5294E2]; else return [#E45E65];"
icon_template: '{{ ''mdi:run-fast'' if is_state(''sensor.broadlink_s1c_office_motion'', ''motion'') else ''mdi:walk'' }}'
sensor.broadlink_s1c_office_front:
friendly_name: Office Front Door
show_last_changed: true
icon: mdi:door-closed
templates:
icon_template: >
if (state === 'open') return 'mdi:door-open';
return 'mdi:door-closed';
icon_color: >
if (state === 'open') return 'red';
return 'green';
sensor.broadlink_s1c_office_back:
friendly_name: Office Back Door
show_last_changed: true
icon: mdi:door-closed
templates:
rgb_color: "{{ [255, 0, 0] if is_state('sensor.broadlink_s1c_office_back', 'open') else [51, 153, 255] }};"
icon_template: "{{ 'mdi:door-open' if is_state('sensor.broadlink_s1c_office_back', 'open') else 'mdi:door-closed' }};"
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:
templates:
icon: >
if (state === 'on') return 'mdi:music';
return 'mdi:music-off';
icon_color: >
if (state === 'on') return 'rgb(251, 210, 41)';
return 'rgb(54, 95, 140)';
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?
you mean this:
which is shown when you click
?
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.
Hi again Marius,
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.
does it matter that I have another custom component running (Broadlink)?
I test like this and it works. You need to check the state from its entity_id whether ‘on, off’ or ‘open, close’
homeassistant:
customize:
binary_sensor.office_motion_sensor:
friendly_name: Office Motion
show_last_changed: true
templates:
icon: >
if (state === 'on') return 'mdi:run-fast';
return 'mdi:walk';
icon_color: >
if (state === 'on') return 'rgb(255, 0, 0)';
return 'rgb(0, 255, 0)';
binary_sensor.office_door_sensor:
friendly_name: Office Door
show_last_changed: true
templates:
icon: >
if (state === 'on') return 'mdi:door-open';
return 'mdi:door';
icon_color: >
if (state === 'on') return 'rgb(255, 0, 0)';
return 'rgb(255, 255, 0)';
I do have another custom_component running Broadlink which is climate component.
no it doesnt.
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:
frontend:
extra_html_url:
- /local/custom_ui/state-card-custom-ui.html
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
Hope this helps!
Excellent detailed step by step explanations Marius, thanks! I think only thing missing is
customizer:
custom_ui: hosted
in configuration.yaml
With your help, I got CustomUI working (I upgraded to 0.81.6 and I had the customization_glob wrong). Not sure, which one solved it.
However, unfortunately neither icons nor colors are changing still. So sad.
Do you have to be on the default template to have it working? I’m on dark orange.
Thanks again!
No, I dont use that. You only need to use 1 setup method of the possible ones. I use the automatic setup using the .update.sh and download the custom-ui files locally. If you use the hosted setup, the files are read from the custom-ui server.
Not sure at you mean here, but I take it you’re referring to a theme? That shouldn’t have to do anything with custom-ui.
One thing important: if the sensors are template sensors, most of the customizing is done in the sensor declaration, and not via custom-ui.
Not sure if you posted that already, but what type of sensor are you trying to customize, please show (make a screenshot) the sensor on the dev-state page?
Heya Marius, it finally works!
I have tried so many things and installed, uninstalled and reinstalled CustomID, upgraded Hassio and various addons that I’m not sure why or how it started to work. But finally it does. Very happy indeed.
Thanks for all your help and patience!
Hi all
is this a valid customization?
person.me:
icon: mdi:human-male
templates:
icon_color: >
if (state === 'home') return 'rgb(255, 0, 0)';
return 'rgb(0, 255, 0)';
_stateDisplay: >
if (state === 'home') return 'A casa';
return 'Fuori casa';
Only the icon:
is working, the icon_color:
and _stateDisplay:
aren’t.
Any advice?
Thanks
depending on your version of HA, at least _stateDisplay isn supported any longer.
For these customizations to work you have to have custom-ui installed, did you?
also, person.me probably isn’t a correct entity_id? make that person_me.
My version is latest, 0.88
I have custom-ui installed, but I don’t know which version is since I’m not upgrading from a long time.
This is my config
extra_html_url:
- /local/custom_ui/state-card-custom-ui.html
- /local/custom_ui/custom-weather-card.html
- /local/custom_ui/hass-fontawesome-solid.html
- /local/custom_ui/hass-fontawesome-brands.html
extra_html_url_es5:
- /local/custom_ui/state-card-custom-ui-es5.html
- /local/custom_ui/custom-weather-card.html
customizer:
custom_ui: local
Is there any other way to change color and state ?
person
is the new entity with 0.88 and person.me
is what I’ve defined in configuration.yaml
Thanks
ok.
I don’t know about person yet, so best ask others about that.
State won’t be customizable any longer, until a new way has been developed.
icon and icon_color still work, at least in 87.1
again, if person is customizable I wouldn’t know. Have seen issues in Lovelace with state filters on sensors and device_trackers too, so I could very well be Not Yet…