Trying to run a random script

Hi all, I’m trying to use a script to run a random script. Below is my code:

random:
  alias: Random
  mode: single
  sequence:
  - data_template:
      entity_id: >
        {{ ["script.red", "script.blue", "script.green"]
          | random}}
      service: script.turn_on

When but I get the following error:

  • Invalid config for [script]: must contain at least one of service, service_template. @ data[‘script’][‘random’][‘sequence’][0]. Got OrderedDict([(‘data_template’, OrderedDict([(‘entity_id’, ‘{{ [“script.red”, “script.green”, “script.blue”]\n | random}}\n’), (‘service’, ‘script.turn_on’)]))]). (See /config/configuration.yaml, line 17). Please check the docs at Scripts - Home Assistant

I tried looking at the data templates page and tried using service, and service_template but basically get the same error

1 Like

Move service: script.turn_on left two spaces.

you have got to be kidding me?!?!?!

thanks, I feel stupid.

Heh, no need to feel stupid. It happens

Hello, I’m wondering if anyone can help me here. I’m trying to use this script to run a random script (which will activate a hue scene).

Here’s the Code I’m using:

random:
  alias: Random
  mode: single
  sequence:
  - data_template:
      entity_id: >
        {{ ["script.Chinatown", "script.Arctic aurora"]
          | random}}
      service: script.turn_on

But I’m getting the error: Message malformed: extra keys not allowed @ data[‘random’]

I also copied the random sensor into my yaml:

# Example configuration.yaml entry
binary_sensor:
  - platform: random

Sorry if this is a noob question, I’m newish to Home Assistant.