Scripts and lovelace entities card

Hi,

Here’s something I’ve been looking for an answer for sometime now. Why do some scripts display as a toggle switch (I assume this is to enable or disable the script) while others show the word ‘execute’ to run the script?

Is it possible to explicitly have the script display oneway or the other?

screenshot_615

If you have a delay or wait state in the script the toggle switch will be used to give you the option to cancel the script.

Oh right. Hadn’t thought of that. So I hit the toggle to on, then the script runs to the first break and switches itself off again? If I hit the toggle again, it picks up where it left off?
Is there a way to override it, so I can just have the ‘execute’ option?

customize:
  script.lights_out:
    can_cancel: false 

Thanks, where do I put those lines? I’ve tried various parts of the entities card and haven’t got it to work. As an aside, the scripts show up as numbers.

Here’s what I’ve tried (well one of the options anyway).

entities:
  - entity: script.1559882413231
    icon: 'mdi:lightbulb-off'
  - entity: script.1579078947664
    icon: 'mdi:chef-hat'
show_header_toggle: false
title: Scripts
type: entities
customize:
  script.1559882413231:
    can_cancel: false 

Thanks for your post.

No, it stops at the break with the toggle remaining on until the script finishes. If you switch the toggle off it cancels the script.

Customize goes under homeassistant: in your configuration.yaml file. Not in the script definition.

If I’m reading this correctly, I should add this to the customize.yaml file (I have “customize: !include customize.yaml”) in my configuration.yaml file.

I’ve added:

script.1559882413231:
  can_cancel: false 

to customize.yaml, reloaded “location & customizations” it still displays with a toggle instead of “execute”. Restarted home assistant, no change.

I also tried to change the setting in the Customizations GUI, it just changes “false” back to “true”.

What am I missing?

OK, I think I’ve found the problem. Turned out I had a duplicate key for the script in the customize.yaml, not picked up by the “check config” routine.

Thanks everyone for your responses.

2 Likes