Can't define scripts: extra keys not allowed @ data[script]

Hello,

I’ve been using HA now for quite some time with basic functionalities. I have now started to build more sophisticated dashboards using Mushroom cards.

Plan is to merge windows and cover information into the same cover card.


The colors around the cover icon shall indicate the window state (closed, tilted, open). Now some windows have handles that can be electronically locked. My idea is to use double or long tap to toggle the window locks and display the state with an additional badge. As there is no lock.toggle service, I wanted to call a script from within the card yaml to toggle the lock, passing the entity id through a variable.

This is where the trouble starts. I can’t set up the respective script. Whatever I do, I get the dreadful extra keys not allowed @ data[script] error. So I steadily lowered the level, used the example from the docs and even extremely primitive test versions like

script:
  toggle_windows_lock:
    alias: Toggle Windows Lock
    sequence:
      alias: Turn on ceiling light
      action: light.turn_on
      target:
        entity_id: light.buro_decke

But whatever I do, I get this error message whenever I try to save the script. I am getting a little bit frustrated over this, especially because neither the docs example nor anything that ChatGPT would provide a working solution.

I will be grateful for every hint to point me into the right direction. :slight_smile:

Thx Johannes

Where are you trying to put that script?

In the card?

Scripts go in your configuration.yaml. You can call them from the card with the tap action option.

No, in the script editor. “Save” then throws the error.

If you are using the UI you don’t need to add any of this:

You go straight to the actions in the sequence.

Thanks Tom,
When I think that this little thing cost me hours today…

I will now move back to my real code. Hopefully with better results :slight_smile: