Should I be able to call a script as a service in order to test it?

I wrote a script to turn on lights, send me a notification, wait 3 hours, and then turn off some lights. I’m trying to trigger it at sunset but I want to test the script before I do. It passes the check config test but when I try to call the script as a service it tells me “failed to call service script/1234567”

The HA log says:
Error handling message: {‘type’: ‘call_service’, ‘domain’: ‘script’, ‘service’: ‘1545167432876’, ‘service_data’: {}, ‘id’: 81}
9:14 AM components/script.py (ERROR)

Should I be able to call a script as a service so that I know it will work correctly when used in an automation?

SCRIPT:

'1545167432876':
  alias: sunset lights on
  sequence:
  - data:
      entity_id: 
        - switch.frontyard_lights_switch
        - switch.backyard_lights_switch
        - switch.living_room_outlet_switch
        - switch.wemolivingroom
        - switch.wemobedroom
    service: switch.turn_on
  - data:
      message: "lights are on"
      title: "HassIO"
    service: notify.ios_garrett_iphone
  - delay: '3:00:00'
  - data:
      entity_id: switch.wemolivingroom
    service: switch.turn_off

AUTOMATION:

- id: '1545167782324'
  alias: lights on
  trigger:
  - event: sunset
    platform: sun
  condition: []
  action:
  - service: script.1545167432876

you call scripts and automations by the alias name not the id.

so in your case:

script.sunset_lights_on
automation.lights_on

you can see the entity_id’s for those entities by looking in the states page.

1 Like