Milliseconds

I have the following template switch to simulate a pulse switch:

switch:
  - platform: template
    switches:
      blind_kitchen_left_up:
        friendly_name: "Blind Kitchen Left Up"
        value_template: "{{ is_state('switch.modbus_switch_01', 'on') }}"
        turn_on:
        - service: switch.turn_on
          data:
            entity_id: switch.modbus_switch_01
        - delay:
          milliseconds: 250
        - service: switch.turn_off
          data:
            entity_id: switch.modbus_switch_01
        turn_off:
        - service: switch.turn_off
          data:
            entity_id: switch.modbus_switch_01
        icon_template: "mdi:blinds"

and receive the error

Invalid config for [switch.template]: [milliseconds] is an invalid option for [switch.template]. Check: switch.template->switches->blind_kitchen_left_up->turn_on->1->milliseconds. (See /config/packages/logo.yaml, line 28). Please check the docs at https://www.home-assistant.io/integrations/template

But when I look at https://www.home-assistant.io/docs/scripts/#delay I think I did right. Is this my error or a Home Assistant bug?

Kind regards, Christian

Needs to be

        - delay:
            milliseconds: 250

Also note that on anything before the 0.113 beta, it won’t actually be 250 milliseconds. It will basically just guarantee that it happens in the next second.

Does it mean, that in 0.113 we will get more time granurality in scripts/automations?

Yep, see the next release notes here: https://rc.home-assistant.io

I tried doing this in the frontend (edit as yaml) and it is saved without an error message, however, when you edit the automation again you can see that it was changed to

delay: '[object Object]'
1 Like