Scripts no longer work after 0.16 Update

Hi guys,

after the last Update to version 0.16 and 0.16.1 my scripts stopped working. So if i execute a script nothing happens. If I restart HA now the Interface won´t load anymore until i reboot the Pi completely.

These scripts execute shell commands. Funny thing when I trigger the shell commands via Call Service they work.

In other sctips I use transitions to dim out the light. Now the lights simply turn off directly.

Maybe someone has a clue about this. Thanks in advance!

Same here on my PI :frowning:
Before reading this, I was thinking I messed something up.

We removed support for ‘execute_script’ syntax in script definitions. This syntax has been deprecated for 6 months.

The next version will be able to issue a warning when wrong syntax is used.

What we have to do exactly? Until now only I have write the configuration.yaml and known_devices.yaml and there is no “execute_script”, just “script”.
I got the following error in the log:

homeassistant.bootstrap: Invalid config for [script]: extra keys not allowed @ data['script']['alarmactivatedelay']['sequence'][3]['service’]
and the related code in the yaml is:
alarmactivatedelay:
alias: Alarm Activate Delay
sequence:
- alias: activealmwarn
service: homeassistant.turn_on
data:
entity_id: switch.AlmWarn13
- delay:
seconds: 60
- alias: deactivealmwarn
service: homeassistant.turn_off
data:
entity_id: switch.AlmWarn13
- alias: activatealarm
service: homeassistant.turn_on
service_data:
entity_id: group.alarma_activata
- delay:
minutes: 15
- alias: boileroff
service: homeassistant.turn_off
data:
entity_id: switch.REL133
How to bring scripts back working?
Until I learn how to make it work, I goes back to the ver. 0.15 that works fine:
pip3 install homeassistant==0.15
Thank you

@Mihai
You have one “service_data” key which is not allowed. That should be called just “data”.

I can’t judge the yaml formatting from your post, so I assume you have that correct.

Thanks a lot, it just works fine right now with the latest HA version!

Hi
Same problem:
I have updated HA to 0.18.2
And:
16-04-22 23:06:19 homeassistant.core: Invalid service data for script.door_closed: extra keys not allowed @ data['entity_id'] 16-04-23 00:03:30 homeassistant.core: Invalid service data for script.door_closed: extra keys not allowed @ data['entity_id'] 16-04-23 07:34:06 homeassistant.core: Invalid service data for script.door_closed: extra keys not allowed @ data['entity_id'] 16-04-23 08:44:09 homeassistant.core: Invalid service data for script.bath_fan: extra keys not allowed @ data['entity_id']

I am not understanding, what is wrong.

  door_open:
    alias: 'Door Opened'
    sequence:
      - delay:
        #supports seconds, milliseconds, minutes, hours
          minutes: 10
      - alias: 'Door message push'
        service: notify.push #notify.sms
        data: 
          message: 'ATTENTION!!! DOOR IS OPENED'
          title: "ALARM"
      - alias: 'Door message sms'
        service: notify.sms
        data: 
          message: 'ATTENTION!!! DOOR IS OPENED'


  door_closed:
    alias: 'Door Closed'
    sequence:
      - service: script.turn_off
        data: 
           entity_id: script.door_open

  bath_fan:
    alias: "Bath Fan Auto"
    sequence:
      # Cancel ev. old timers
      - service: script.turn_off
        data:
           entity_id: script.timer_off
      - service: light.turn_on
        data:
          entity_id: light.2b99_r2
      # Set new timer
      - service: script.turn_on
        data:
          entity_id: script.timer_off


  timer_off:
    alias: "Bath fan Off 15"
    sequence:
      - delay:
          minutes: 15
      - service: light.turn_off
        data:
          entity_id: light.2b99_r2

???
What is wrong

Hi!

It looks as if you have more than two spaces of indentation in front of the entity_id key in data in door_closed and the same for the first entity_id key in bath_fan.

Does not work.

 bath_fan:
    alias: "Bath Fan Auto"
    sequence:
      # Cancel ev. old timers
      - service: script.turn_off
        data:
          entity_id: script.timer_off
      - service: light.turn_on
        data:
          entity_id: light.2b99_r2
      # Set new timer
      - service: script.turn_on
        data:
          entity_id: script.timer_off


  timer_off:
    alias: "Bath fan Off 15"
    sequence:
      - delay:
          minutes: 15
      - service: light.turn_off
        data:
          entity_id: light.2b99_r2

  fan_off:
    alias: "Bath fan Off"
    sequence:
      - service: script.turn_off
        data:
          entity_id: script.timer_off
      - service: light.turn_off
        data:
          entity_id: light.2b99_r2

and part of automation:

- alias: Turn ON Bath Fan
  trigger:
    platform: state
    entity_id: sensor.pushbut1
    from: 'off'
    to: 'on'
  condition:
    platform: state
    entity_id: light.2b99_r2
    state: 'off'
#    for:
#      hours: 1
#      minutes: 2
#      seconds: 15
  action:
    entity_id: script.turn_on
    service: script.bath_fan

- alias: Turn OFF Bath Fan
  trigger:
    platform: state
    entity_id: sensor.pushbut1
    from: 'off'
    to: 'on'
  condition:
    platform: state
    entity_id: light.2b99_r2
    state: 'on'
#    for:
#      hours: 1
#      minutes: 2
#      seconds: 15
  action:
    entity_id: script.turn_on
    service: script.fan_off

Errors:
16-04-24 11:20:26 homeassistant.core: Invalid service data for script.door_closed: extra keys not allowed @ data[‘entity_id’]
16-04-24 11:20:31 homeassistant.core: Invalid service data for script.door_open: extra keys not allowed @ data[‘entity_id’]
16-04-24 11:20:39 homeassistant.core: Invalid service data for script.door_closed: extra keys not allowed @ data[‘entity_id’]
16-04-24 11:29:53 homeassistant.core: Invalid service data for script.door_open: extra keys not allowed @ data[‘entity_id’]
16-04-24 11:29:56 homeassistant.core: Invalid service data for script.door_closed: extra keys not allowed @ data[‘entity_id’]
16-04-24 11:31:01 homeassistant.core: Invalid service data for script.fan_off: extra keys not allowed @ data[‘entity_id’]

There is no data for the service script.turn_on or script.turn_off. If you want to pass data through, you have to call the script directly as a service rather than through script.turn_on and script.turn_off

So for normal service use, with just an entity_id, you use the following:

sequence:
  - service: script.turn_off
    entity_id: script.timer_off
  - service: light.turn_off
    entity_id: light.2b99_r2

But if you want to pass variables through, then you call the script directly as a service instead of using script.turn_on:

sequence:
  - service: script.timer_off
    data:
      some_var: Just some stuff
  - service: light.turn_off
    entity_id: light.2b99_r2

and then the variable “some_var” can be accessed inside the timer_off script by using a data_template or a value_template by using it like ‘{{ some_var }}’