Hello all
I posted this in another thread, and have deleted it, as it drowned.
Thank you @Kuuji for the custom:button-card - awesome card, that I use a lot.
Does anyone know, if it possible to perform two tap_action’s within a card ?
I have a included top menu that consists of button-card’s. What I would like to achieve is:
tap_action:
Call a script, that sets a variable, so it knows what button is pressed and highlight that button. This works by now.(thanks to Petro)
After that : navigate to a certain lovelace view (dependent on the button pressed)
I cannot do this in the called script, as far as I know, as there isn’t a lovelace “Navigate” function in HA scripts.So I guess I would have to do a second action already during the “tap_action” action in the button-card if in any way possible.
Other ideas for solutions are also welcome. I’ll post two code snippets and a small screenshot, so you get the idea.
lovelace card:
- type: "custom:button-card"
icon: mdi:food-variant
show_label: false
size: 50%
color: auto
tap_action:
action: call-service
service: script.menu_skift
service_data:
valgtmenu: 'kokken'
styles:
card:
- height: 100px
- width: 100px
- background-color: rgba(0, 0, 0, 0.5)
icon:
- color: >
[[[
if (states['variable.menu_click'].state =='kokken')
return "#5294E2";
return "gray";
]]]
script:
menu_skift:
alias: "menu skift"
sequence:
- service: variable.set_variable
data_template:
variable: menu_click
value: "{{ valgtmenu }}"
Below is a screenshot with the menu bar at the top. Clicking should, further than highligt the button (works) navigate to that view.
Thanks for any help
Michael