Getting an error with a script

Here’s a script in scripts.yaml:

script:
  button_test:
    alias: Button 
    sequence:
      - service: mqtt.publish
        data:
            topic: ToggleDoor2 
            payload: '1'
      - delay: 00:00:03
      - service: door_1.turn_off
script:
  do_nothing:

I borrowed it from another post and modified it slightly. Here’s one error:

2019-09-21 06:24:11 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of default_config. Setup failed for dependencies: script

When I flip the switch, I get

Failed to call service switch/turn_on unable to find service script/button_test

See file
All I want to do is have a push button that publishes a topic. Surely it can’t be hard, but I can’t find the answer. I’ve tried at least 6 different suggested ways of doing it and nothing works. Please help.
Thanks,
Jim.
Screenshot%20at%202019-09-21%2006-40-17

Here’s the entry in configuration.yaml that calls it:

switch:
  - platform: template
    switches:
      door_1:
        value_template: "{{ false }}"
        turn_on:
          service: script.button_test
          data:
            entity_id: '1569002528159'
        turn_off:
          service: script.do_nothing
          data:
            entity_id: '1569002528159'

Your scripts.yaml should look like this (without the script: keys)

button_test:
  alias: Button 
  sequence:
    - service: mqtt.publish
      data:
          topic: ToggleDoor2 
          payload: '1'
    - delay: 00:00:03
    - service: door_1.turn_off

do_nothing:

But it still won’t work because your service after the delay is not valid.

Thanks, all I want to do after the delay is reset the switch display to the off position. How can I do that? This is supposed to be a simple push button, rather than an on/off switch.

Jim

What’s the entity id of the thing you want to turn off?

It doesn’t have one

I gave up on the scripts. I can’t believe that a simple push button would be so hard.

Here’s what I have currently:

switch:
    - platform: mqtt
      command_topic: "Door1"
      name: "Door 1"
      payload_on: '1'
      payload_off: '1'
      optimistic: true
    - platform: mqtt
      command_topic: "Door2"
      name: "Door 2"
      payload_on: '1'
      payload_off: '1'
      optimistic: true

I’m not happy about the look of it, but it works. It’s way too busy.
Screenshot%20at%202019-09-23%2004-58-12

Something like this.
Screenshot%20at%202019-09-23%2005-02-53

So the payloads for on and off are the same? Why wouldn’t this work?

button_test:
  alias: Button 
  sequence:
    - service: mqtt.publish
      data:
        topic: Door2
        payload: '1'
    - delay: 00:00:03
    - service: mqtt.publish
      data:
        topic: Door1
        payload: '1'

Other than it looks like it would close/open both doors at once, I don’t know. I’ll try it.

That works. It takes up a whole lot more real estate than it should but I can live with it. The designer of this UI must be a reincarnated COBOL programmer. :smile:

Thanks!
Jim.