Olá a todos, estou a tentar implementar alteração da côr dos icons consoante o seu estado.
Depois da leitura de vários post relativos ao tema, comecei a minha jornada pela instalação dos Custom-ui colocando as seguintes configurações.
Originalmente era o home-assistant-custom-ui
aparentemente houve um problema já identificado que causava a não alteração da côr, porém apenas coloquei em comment as configurações.
copiar state-card-custom-ui.html and state-card-custom-ui.html.gz para www/custom_ui)
configurar no ui-lovelace.yaml
resources:
- type: module
url: /local/plugins/slider-entity-row.js?v=1
- type: module
url: /local/community/lovelace-slider-entity-row/slider-entity-row.js
- type: module
url: /local/custom-lovelace/weather-card/weather-card.js
- type: module
url: /local/community/mini-media-player/mini-media-player-bundle.js?v=1.11.0
- type: module
url: /local/animated-background/animated-background.js
- type: module
url: /local/community/mini-graph-card/mini-graph-card-bundle.js?v=0.9.4
- type: module
url: /local/community/button-card/card-mod.js
- type: js
url: /local/community/vertical-stack-in-card/vertical-stack-in-card.js?v=0.3.2
- url: /local/plugins/card-mod.js?v=1
type: module
- url: /local/custom-ui/custom-ui.js?v=20201120 #change this v-number on each update
type: module
configuration.yaml
homeassistant:
####################################################
# #
# Customize #
# #
####################################################
customize_glob:
light.*:
custom_ui_state_card: custom-ui
cover.*:
custom_ui_state_card: custom-ui
sensor.*:
custom_ui_state_card: custom-ui
switch.*:
custom_ui_state_card: custom-ui
binary_sensor.openclose_8:
custom_ui_state_card: state-card-custom-ui
templates:
hs_color: "if (state === 'Open') return [0, 100, 100];
else if (state === 'Closed') return [120, 100, 100];"
customize: !include customize.yaml
frontend:
themes: !include_dir_merge_named themes
########### CUSTOM UI CONFIG ##############
## extra_html_url:
## - /local/custom_ui/state-card-custom-ui.html
## extra_html_url_es5:
## - /local/custom_ui/state-card-custom-ui-es5.html
extra_module_url:
- /local/lovelace/resources/custom-ui/custom-ui.js
Comecei o meu teste com um sensor binário da xiaomi binary_sensor.openclose_8, mas a côr não muda.
Alguma coisa deverá estar a escapar-me.