New readers, please skip this first post, and jump down to my post 27 september 2019. Thanks.
Hello all
I’m using the custom:button-card with great success - and thanks @RomRider, for the card !
I’m struggling however to make it execute a script. The script itself works, if I trigger it from within HA UI, but not from my lovelace card. I hope anyone can help me with the answer.
First and foremost, I would like to execute the variable update directly from the custom:button-card, but if not possible I would as a secondary option like to call my “set variable value” script with a argument.
I don’t know what you want to try with the script toggle in your config i.e. “value”?.
And i also see you’re using a navigate path in the same tap_action, i don’t think this will work. (can be wrong)
Why not use one script, to fire up the next script AND set the variable?
Nevertheless, i “only” use the following code which works like a charm to trigger my script in the button card code.
Thanks for the replies so far. I believe have tried tthem all, even mixing them. It seems to me that the variable value is not coming over from the automation.
I have made a very simple test, but still cannot get it to work.
Automation:
- type: "custom:button-card"
icon: mdi:food-variant
show_label: false
size: 50%
color: auto
tap_action:
action: call-service
service: script.menu_skift
data:
# variables: <- it makes no difference if this line is there or not
valgtmenu: 'kokken'
This runs without error, but clears the current variable value.
If I in the script put in:
value: ‘Test’ instead
it works just fine, also triggering it from the automation. So to me, either the automation is not sending, or the script is not receiving the variable with my current syntax.
It maskes absolutely no sense, me starting to explain how many diffent combinations I have tried, and ensure you that I have read the documentaion…
Your syntax works !
I’m ebarrased to bow my head and say thanks ! I have no idea, how this could be the missing link I didnt try. Maybe, I had it right, but at that time had the script wrong.
May I ask second question please. What I am trying to achieve, is :
“on_tap” :
Set a variable
navigate to another lovelace view.
I can’t however read from “custom:button-card” documentation how to do two actions “On_Tap”, as well as I dont think I can Navigate" from a HA script ?
What do you suggest ? Call a script from a script ?
I hope I’m not asking too much from your time. I so, I apologize, and please just ignore.