Script won't fire

I’m trying to run a script that will make sure a smart switch is turned on, and then activate a scene. The scene works fine by itself, but if the switch isn’t on then the scene can’t see the lights to activate the scene so I am using a script to sequence the process.

Nighttime:
  alias: Nighttime
  sequence:
    - service: switch.turn_on
      entity_id: switch.stairway_switch
    - delay:
        seconds:10
    - service: scene.turn_on
      entity_id: scene.Nighttime

The scene works properly when run, so I know it’s somewhere in the script. The script is in a separate file from the configuration.yaml file, since the scripts show up on the dashboard and the haas --script check_config gripes if I do something wrong in the scripts.yaml file, I’m assuming it’s getting included and processes properly at least syntactically. The message log only shows the following message in response.

    16-11-13 14:55:19 homeassistant.components.http: Serving /api/services/homeassistant/turn_on to 127.0.0.1 (auth: True)

Any thoughts please?

Any thoughts?

Maybe check if the switch is reporting back and updated within the 10 second time frame? Some protocols will turn the light on instantly but reporting the state back to HA can be slower.

Sorry, that’s the only thing I can think of on this one, everything looks correct on your config.

Something else I noticed. When I run the script from the web page, the home_assistant.log file, gets this message inserted.

Serving /api/services/homeassistant/turn_on to 192.168.2.105 (auth: True)

What’s interesting about it is that 192.168.2.105 is the PC I’m running the web page from. If I run the script from the pi hosting HA, I get

/api/services/homeassistant/turn_on to 127.0.0.1 (auth: True)

So I’m guessing this is just the browser being instructed to turn the toggle on or off in response to the button being pressed.