UI icon indicating copy to clipboard operation
UI copied to clipboard

Chip Navigation Emoji

Open damianeickhoff opened this issue 4 years ago • 2 comments

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 avatar Dec 02 '21 08:12 damianeickhoff

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.

damianeickhoff avatar Dec 02 '21 09:12 damianeickhoff

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

CM000n avatar Dec 08 '21 17:12 CM000n