Service [[[ this.dispatchevent(new event('hass-toggle-menu', { bubbles1: true, composed: true})) return none; called service [[[ this.dispatchEvent(new Event('hass-toggle-menu', { bubbles1: true, composed: true})) return none; which was not found.
I’m trying with this code, but if there’s another way to toggle the menu button with button-card, let me know.
It appears the button card does not like to execute the services when nested. I wanted to test how it was grouping the buttons and didn’t expect positive results without renaming bubbles1 back to bubbles.
I have zero experience with using a button in a button, or with the service at hand. However, could it have to do with the ‘path’ to the actionable item?
As if somehow the nested button doesnt get out of the main button to the menu item, and has no item to perform the action on, hence ending up logging none?
I suppose this would be an issue to post on the Button-card repo, as it is not yet provided for, and it would seem a nice addition to the power of button-card
For the time being, I’d suggest to use any of the other available options, and redesign your card to the options that do work…
automation:
# needed for Javascript in buttons shortcut menu
- alias: Back button
id: back_button
mode: single
trigger:
platform: state
entity_id: input_boolean.back_button
to: 'on'
action:
service: input_boolean.turn_off
target:
entity_id: input_boolean.back_button
- alias: Forward button
id: forward_button
mode: single
trigger:
platform: state
entity_id: input_boolean.forward_button
to: 'on'
action:
service: input_boolean.turn_off
target:
entity_id: input_boolean.forward_button
somehow that seems much simpler, but I need to check if the results is the same…
seems awfully indentical if you ask me… I do remember though it wasnt reliable, and in the end did away with them. I just had to find them in my 2022 backups .
Admit I didnt have the menu item button, and that service is new to me.
Do you have some documentation where you got that from?
I have experienced this in the past (here) when using a button is inside a button. Using another type of card inside the button card worked for me in the past, but I like your resolution. Nice workaround!
Hi, I have a custom button card with a entity picture ( the currently playing cover). It is possible to fade in the image every time that change? Now load without any transition.
Potentially stupid question here (I am NOT experienced with CSS). I’m trying to use the custom button card to change icon colours based on entity state. I have a theme installed (Caule). Only the theme colours show - is there a way to override the theme within the custom button card?
Hi, thanks for this. And that does indeed override the theme colours. I can use this to do exactly what I wanted. Kudos to you, very grateful. Although being me I want to know why, but that is for another day.
Because button-card supports JavaScript’s - they are one of most powerful functions of button card. You can do pretty much anything with it, for example:
name: | #or label, or any custom field...
[[[
if(states['sensor.temperature.out'].state > '25')
return "it's hot outside"
else if (states['sensor.temperature.out'].state > '15')
return "it's ok outside"
else
return "it's cold outside"
]]]
you can also define state to show another thing and not real state of sensor, but in this case it’s like this:
show_state: true
state_display: |
[[[
if(states['sensor.status.ups'].state =='online')
return "UPS works on power"
else
return "UPS runs on batteries"
]]]
etc…
check button-card’s github page, there are many examples there.
I think that 50-70% of my cards are made with this button card. I’m dead if this card stops working…
Thanks for these example, gives me food for thought. I have solved my original issue, which is really embarrassing. I was using an input_boolean as the entity to test as I didn’t want to keep messing with the state of my aircon. Of course the boolean can only have two states, but I was trying to set it to e.g. heat, cool, etc and this of course messed up the cards actions and defaulted to the theme colours. Once I relpaced it with a dropdown helper with multiple states it all worked as expected. Here is my working code: