UI-Lovelace-Minimalist / UI

UI-Lovelace-Minimalist is a "theme" for HomeAssistant
https://ui-lovelace-minimalist.github.io/UI/
Other
1.64k stars 432 forks source link

Chip Navigation Emoji #60

Open damianeickhoff opened 2 years ago

damianeickhoff commented 2 years ago

Is it possible to give a emoji to a Navigation Chip? For now, only a MDI will work.

When giving a card the Navigation Template and the Icon Only template, it shows the Emoji, but the margin is off.

          - type: 'custom:button-card'
            template:
              - chip_icon_only
              - chip_navigate
            variables:
              ulm_chip_navigate_path: verlichting
              ulm_chip_icon_only: '💡'  

This is what it looks like.

afbeelding

damianeickhoff commented 2 years ago

Looks like I already fixed it with a edited template:

chip_icon_state_navigate:
  template: chips
  triggers_update:
    - "[[[ variables.ulm_chip_icon_state_entity ]]]"
  tap_action:
    action: navigate
    navigation_path: "[[[ return variables.ulm_chip_navigate_path; ]]]"    
  label: |
    [[[
      var icon = '❔';
      if (variables.ulm_chip_icon_state_icon){
        var icon = variables.ulm_chip_icon_state_icon;
      } 
      var state = '';
      if (states[variables.ulm_chip_icon_state_entity].state){
        var state = states[variables.ulm_chip_icon_state_entity].state;
      } 
      return icon + ' ' + state;
    ]]]

Card:

          - type: 'custom:button-card'
            template:
              - chip_icon_state_navigate
            variables:
              ulm_chip_navigate_path: verlichting
              ulm_chip_icon_state_icon: '💡'
              ulm_chip_icon_state_entity: sensor.current_lights_on

afbeelding

But also, as mentioned in #35 the state doenst update unless a page reload.

CM000n commented 2 years ago

just set triggers_update in your template to:

  triggers_update: all

Should be fixed in next release with https://github.com/UI-Lovelace-Minimalist/UI/issues/35