Home Assistant Icon Color probleempje

Pagina: 1
Acties:

Onderwerpen


Acties:
  • 0 Henk 'm!

  • Zeetijger
  • Registratie: Juli 2008
  • Laatst online: 07-09-2023
Hi,

Na een week pielen toch maar hulp vragen.

Wat gaat er nu verkeerd in deze HEEL eenvoudige is_state regel. Wat ik ook probeer de kleur is weg??

Gr. Willem

YAML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
- type: horizontal-stack
  cards:
     - type: custom:mushroom-entity-card
       entity: binary_sensor.sw_zolder
       icon: mdi:switch
       name: Zolder
       layout: vertical
       icon_color: green
       icon_type: icon
     - type: custom:mushroom-entity-card
        entity: binary_sensor.sw_garage
        icon_color: |-
          {% if is_state('binary_sensor.sw_garage', 'on') %}
            green
          {% else %}
            red
          {% endif %}
        icon: mdi:switch
        name: Garage
        layout: vertical


Afbeeldingslocatie: https://tweakers.net/i/8GsgNcNIuXGUe5O1DbJVZkc39Vc=/full-fit-in/4920x3264/filters:max_bytes(3145728):no_upscale():strip_icc():fill(white):strip_exif()/f/image/ZCdr2ok4yvAsTW152FZaLOj4.jpg?f=user_large

Ook hier houden code-tags het leesbaar

[ Voor 3% gewijzigd door Septillion op 06-09-2023 13:28 ]


Acties:
  • 0 Henk 'm!

  • skate master
  • Registratie: September 2004
  • Laatst online: 21:00

skate master

Autodesk Educator Expert

Het lijkt erop dat je een - teveel hebt staan in je tweede card.

Volgens mij moet je in je tweede Card dit
YAML:
1
icon_color: |-

veranderen in
YAML:
1
icon_color: |

Acties:
  • 0 Henk 'm!

  • Zeetijger
  • Registratie: Juli 2008
  • Laatst online: 07-09-2023
Blijft het zelfde. | of |- of > of >| geprobeerd

icon_color: |
{% if is_state('binary_sensor.sw_garage', 'on') %}
green
{% else %}
red
{% endif %}

Acties:
  • 0 Henk 'm!

  • Septillion
  • Registratie: Januari 2009
  • Laatst online: 22:30

Septillion

Moderator Wonen & Mobiliteit
Na het in cod tags zetten is ook je probleem duidelijk, entity en icon_color staan een spatie te veel naar rechts. Yaml is echt allergies voor te veel (of te weinig) spaties.

YAML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
- type: horizontal-stack
  cards:
    - type: custom:mushroom-entity-card
      entity: binary_sensor.sw_zolder
      icon: mdi:switch
      name: Zolder
      layout: vertical
      icon_color: green
      icon_type: icon
    - type: custom:mushroom-entity-card
      entity: binary_sensor.sw_garage
      icon_color: >-
        {% if is_state('binary_sensor.sw_garage', 'on') %}
          green
        {% else %}
          red
        {% endif %}
       icon: mdi:switch
       name: Garage
       layout: vertical