CyrisXD
(CyrisXD)
February 27, 2019, 1:12am
1
Just updated to 0.88.1 and messing around with the new LoveLace default UI.
However it seems when creating a button, it is triggering all my scripts in my scripts.yaml.
I’m looking to make a simple button to restart home assistant.
scripts.yaml
restart_hassio:
alias: "Restart Home Assistant"
sequence:
- service: homeassistant.restart
lovelace using new editor
entity: script.restart_hassio
hold_action:
action: none
tap_action:
action: call-service
service: script.turn_on
type: entity-button
When clicking the button it will trigger all my scripts instead of just the script.restart_hassio
Can anyone help?
Cheers
Having the same issue that is driving me crazy…
It must be some kind of bug.
Thanks for anyone who may shed some light into it.
Running 88.1 but it was already present in 88.0.
1 Like
tom_l
February 27, 2019, 1:29am
3
By doing this:
tap_action:
action: call-service
service: script.turn_on
You are calling the script.turn_on service with no entity supplied. So all scripts run.
You can leave out the service. It is defined in the entity (scripts are services).
entity: script.restart_hassio
hold_action:
action: none
tap_action:
action: call-service
type: entity-button
If your original entity was not a service able to be called you would have to supply the name of the entity to run (or if you wanted to call an alternate service than the entity, say one script for tap and a different one for hold):
entity: script.restart_hassio
hold_action:
action: none
tap_action:
action: call-service
service: script.turn_on
service_data:
entity_id: script.restart_hassio
type: entity-button
1 Like
CyrisXD
(CyrisXD)
February 27, 2019, 1:44am
4
So the above doesn’t work, button doesn’t call anything now.
But specifying the entity_id fixes this issue for now.
service: script.turn_on
service_data:
entity_id: script.restart_hassio
I’ve noticed the button editor might not be finished. Just saw it told me to toggle the editor to input service data. Thought this would’ve been picked up by the entity chosen on the first line.
I was already using service_data:
type: entity-button
name: Restart
icon: mdi:restart
tap_action:
action: call-service
service: script.turn_on
service_data:
entity_id: script.restart_hassio
entity: script.restart_hassio
But the mess happens anyway. Just followed the DOCS, with no hold_action.
Tryed the suggestion below but nothing happens then:
entity: script.restart_hassio
hold_action:
action: none
tap_action:
action: call-service
type: entity-button
Thanks for your help.
tom_l
February 27, 2019, 2:19am
6
CyrisXD:
So the above doesn’t work, button doesn’t call anything now.
But specifying the entity_id fixes this issue for now.
Ok I must be miss-remembering. I thought there was a shorthand way of writing it for scripts.
Just had a look at my config, this is the shorthand I was thinking of (because the script is a service):
entity: script.restart_hassio
hold_action:
action: none
tap_action:
action: call-service
service: script.restart_hassio
type: entity-button
And yes the built-in Lovelace cards are a work in progress.
@FunkyBoT are you sure you have the script name correct?
The method above or the longhand way I posted earlier definitely works.
CyrisXD
(CyrisXD)
February 27, 2019, 2:28am
7
@tom_l The shorthand doesn’t seem to work on my version either.
entity: script.restart_hassio
hold_action:
action: none
tap_action:
action: call-service
service: script.restart_hassio
type: entity-button
I followed exacly what you did and it seems to be working now.
Thank you very much.
1 Like
tom_l
February 27, 2019, 2:33am
9
Weird. It works for me.
Ah hang on. I’m using it on an icon in a picture elements card. You mustn’t be able to use it for a button entity card.
Write it out the long way.
CyrisXD
(CyrisXD)
February 27, 2019, 2:34am
10
Ah well no worries, I’ll just have to specify service data.
1 Like
tom_l
February 27, 2019, 2:37am
11
Just had a look at the polymer issues. There’s a very similar one open for this: