The contents of the CUSTOMIZE.YAML file have no effect

I tried to use CustomUI today so I installed it.

image

Then I wanted to change “icon”, “icon_color” and “state” using the “customize.yaml” file but it doesn’t work.

I lost hours but I was not successful.
Later I noticed that everything in “customize.yaml” does not work.

Any help is welcome.

Check that the customizations are loaded:

homeassistant:
  customize: !include customize.yaml

That is, see the image in the previous post.

It’s hard to tell unfortunately because of all the mangling applied to the image… way easier to work with text, rather than images of images :wink:

In configuration.yaml I have:

homeassistant:
  customize: !include customize.yaml

Then I created a customize.yaml file in which I have this:

switch.g16_i1:
  templates:
    icon: 'if (state === ''on'') return ''mdi:window-open-variant''; return ''mdi:window-closed-variant'';

      '
    icon_color: 'if (state === ''on'') return ''rgb(255, 0, 0)'';  return ''rgb(0,
      0, 0)'';

      '
    state: if (state==='on') return 'Deschis'; else return 'Inchis';


binary_sensor.g7_s1:
  templates:
    icon: >
      if (state === 'on') return 'mdi:motion-sensor';
      return 'mdi:human-male';
    icon_color: > 
      if (state === 'on') return 'rgb(255, 0, 0)'; 
      return 'rgb(0, 171, 0)';
    state: if (state ==='on') return 'MISCARE'; else return 'Liniste';

switch.g20_i2:
  friendly_name: Kitchen kettle
  icon: mdi:kettle

Have you restarted homeassistant since adding the line to configuration.yaml?

I restarted it over 10 times.

I know how to set it up, I’ve done it before. But now it just doesn’t work.

I don’t know what else to do.

What else can I do?
I’m going crazy …

According to this, the above is not valid yaml https://codebeautify.org/yaml-validator

Have you tried the “check config” button?

Tagging @Mariusthvdb here as he’s the maintainer of custom UI

If anything for this to work you need custom_ui installed.

Did you do that ? If so, please show the inspector console showing that, or the config/info page, I ask because your post doesn’t show the latest version.

Second to that, not having checked all your templates but please don’t customize States. That is very dangerous, because it interferes with the Ha state machine, and will cause more confusion than profit.

switch.g16_i1:
  templates:
    icon: >
      if (state == 'on') return 'mdi:window-open-variant'; 
      return 'mdi:window-closed-variant';

    icon_color: >
      if (state == 'on') return 'rgb(255, 0, 0)';
      return 'rgb(0, 0, 0)';

binary_sensor.g7_s1:
  templates:
    icon: >
      if (state == 'on') return 'mdi:motion-sensor';
      return 'mdi:human-male';
    icon_color: > 
      if (state == 'on') return 'rgb(255, 0, 0)'; 
      return 'rgb(0, 171, 0)';

switch.g20_i2:
  friendly_name: Kitchen kettle
  icon: mdi:kettle

this should work

Thank you very much everybody!

The problem is that HA does not read the “customize.yaml” file.
On another IP, everything works, including CusomUI.

I will try.

are you preceding the templates with:

homeassistant:
  customize:

?
either do this in a package, or, via configuration.yaml, where you point the config to the correct customize.yaml

no need to try the config checker, you need to correct your yaml… and, point the configuration to the correct location, so it can find it

this isn’t necessary either, simply reload the customizations, via the left side configuration menu /server controls/reload location & customizations

sometimes a clear cache and reload page helps, but this should suffice

In configuration.yaml I have:

homeassistant:
  customize: !include customize.yaml

And if I have something simple in customize.yaml it doesn’t work, for example:

switch.g16_i1:
  friendly_name: pii kettle
  icon: mdi:kettle

Thanks @ Mariusthvdb

Everything works on another IP.
In the meantime I found out about reload the customizations.
I also cleared the cache.

Ok but this doesn’t require custom_ui, and is a matter of regular (core) customization as @Tinkerer posted above.
custom_ui is needed when you start templating, or when you need icon_color.

btw, where did you save the customize.yaml? it should be in the config folder, using the !include you do now.

customize.yaml is in the configuration folder.
image

cusiom_ui …
image

I wanted to use custom_ui … and so I found that whatever is in customize.yaml does not work

seems alright…
please delete all custom_ui files and download the latest version. (It is needed to hide the more-info attributes)

Also, you don’t happen to have files left of the older custom_ui, or the customizer for that matter? They should all be deleted from your config.