Skip to content

Instantly share code, notes, and snippets.

@vlaraort
Created May 7, 2022 18:45
Show Gist options
  • Save vlaraort/b74d6c3113f1a031245d27329e1f22f7 to your computer and use it in GitHub Desktop.
Save vlaraort/b74d6c3113f1a031245d27329e1f22f7 to your computer and use it in GitHub Desktop.
Custom chip menu for HA minimalist UI, to toggle side menu
---
chip_menu:
template: "chips"
tap_action:
action: 'call-service'
service: |
[[[
this.dispatchEvent(new Event('hass-toggle-menu', { bubbles: true, composed: true}))
]]]
show_icon: true
icon: "mdi:menu"
styles:
grid:
- grid-template-areas: "'i'"
@Nicoautoxp
Copy link

Hi,
does this still work ? I tried it and it can't find the service. Do I need to change something ?

@roschi02
Copy link

@Nicoautoxp, you have to use it with the minimalist integration.
Please make this change to prevent errors from popping up.

---
chip_menu:
  template: "chips"
  tap_action:
    action: 'call-service'
    service: |
      [[[
        this.dispatchEvent(new Event('hass-toggle-menu', { bubbles: true, composed: true}));
        return none;
      ]]]
  show_icon: true
  icon: "mdi:menu"
  styles:
    grid:
      - grid-template-areas: "'i'"

@joaopedros2
Copy link

i tried to use it but i get a error

  bnt_3:
    card:
      type: custom:button-card
      icon: mdi:menu
      tap_action:
        action: call-service
        service: |-
          [[[
            this.dispatchEvent(new Event('hass-toggle-menu', { bubbles: true, composed: true}));
            return none;
          ]]]
      styles:
        icon:
          - width: 20px
          - color: white
          - justify-self: center
          - align-self: center
        card:
          - border-radius: 100px
          - width: 39px
          - height: 39px
          - background: rgb(39,39,39)
          - box-shadow: none
ButtonCardJSTemplateError: ReferenceError: none is not defined in 'this.dispatchEvent(new Event('hass-toggle-menu', { bubbles: true, composed: true})); return none...'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment