Activate a scene inside a script

I’m aware now that you cannot activate a script from inside a scene. Which is a bummer because some of my lights are controlled via the Harmony Hub send_command.

I tried switching my entire lighting scenes over to scripts. It works, but there’s a large delay compared to using scenes. Plus, it’s a pain to set switches and lights using scripts.

So I tried this:

  scene_starlight:
    alias: Starlight
    sequence:
      - service: remote.send_command
        data:
          entity_id: remote.harmonyhub
          device: 41760987
          command: Light1
      - service: scene.turn_on
	    data:
          entity_id: scene.starlight

However, this does not seem to work. Am I just screwing up the syntax, or can scenes not be turned on from within a script?

Try:

- service: scene.turn_on
  entity_id: scene.starlight

I run scripts as part of scenes, like this:

- scene:
  - name: Bedtime
    entities:
      light.landing_light:
        state: on
        transition: 2
        brightness: 1
      light.office_light:
        state: off
        transition: 2
      light.kitchen:
        state: off
        transition: 2
      light.tv_light:
        state: off
        transition: 2
      script.living_room_off_delayed:
        state: on

With the script code elsewhere (in a different .yaml file). Is this the kind of thing you wanted to do?

1 Like

I had that originally. But I can give it another shot. It seemed like other commands wanted it to fall under Data:

Wait, so you CAN do that? If so, that’s great news. I’ll have to give that a try tonight!

Yes, I have a few scenes that run scripts in them :+1:t3:

do it still working?
It stopped working here.

You can no longer call scripts from scenes.

1 Like

Are there any workarounds, or do we have to just change our setups and remove all scripts from scenes?

You have to remove all scripts from scenes.

1 Like

OK, thanks for the confirmation :+1:t3:

I created a input_boolean which triggers the script in an automation. That worked for me! :slight_smile:
In the scene:

scene:
  - name: my scene
    entities:
      input_boolean.random_color: on

Yea, I have a few of those.

I ended up recreating my scenes with scripts.