Script and automation issue

Hi, I’m moving to from an older version of HA to 2023.3.1, in the previous version I managed a script to turn off a mqtt switch after 40 minutes it was tunerd on. Now every configuration files have passed the syntax verification, but the automation I wrote seems not to fire the script anymore.

This is my automation.yaml, I was trying with a boolean field instead the mqtt switch, but the logic it’s the same:

- id: a0050
  alias: "turn off boltest when turned on"
  trigger:
    platform: state
    entity_id: input_boolean.boltest
    to: "on"
  action:
    service: script.turn_on
    target:
      entity_id: script.boltest_script

- id: a0051
  alias: "boltest reset timer"
  trigger:
    platform: state
    entity_id: input_boolean.boltest
    to: "off"
  action:
    service: script.turn_off
    target:
      entity_id: script.boltest_script

And the script.yaml:

boltest_script:
  alias: boltest_script
  sequence:
  - delay: 00:00:10
  - service: homeassistant.toggle
    data:
      entity_id: input_boolean.boltest

thank you

my understanding is that

service: script.turn_off

be replace with

service: script.turn_on

as the .turn_on is the bit that starts the script to run/start

Hi, it’s weird but in the logbook I don’t see any trace for the script to be called when boltest change state to ON.
I wrote directly the script.yaml, I’m not using the UI, would this be the problem?

Did you reload the scripts? Developer Tools>YAML>Scripts?

Hi, yes complete HA reload done many times…

Does your script show up here, like my LEAF refresh script does?

And does it work if run from there?

If it doesn’t appear, does your configuration.yaml have a script line in it like below?

rest: !include_dir_merge_list rest
script: !include scripts.yaml
sensor: !include_dir_merge_list sensors

Make sure the file name in the !include matches the file name you’re using.

Hi, I realized there was a typo-error of the entity-id in my scripts.yaml. Solved. Thak you!

Which is why it’s always important to post the actual code causing the problem. We might have spotted that.