Handy script to reset IKEA Trådfri Bulb

If you struggle with the timing to reset IKEA Trådfri bulbs, try this script.
Just replace switch.ip44plug09_relay with a switch of your own, preferrably one with very little delay.

Turn the lamp on, then run the script.

The script works flawless for me, even for those tricky E14’s:

alias: Reset IKEA bulb with IP44plug09
sequence:
  - repeat:
      count: '5'
      sequence:
        - service: switch.turn_off
          data: {}
          target:
            entity_id: switch.ip44plug09_relay
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 900
        - service: switch.turn_on
          data: {}
          target:
            entity_id: switch.ip44plug09_relay
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 500
mode: single
2 Likes

This is a great idea! A suggested improvement. Changing the script to use a defined variable block outside the sequence can make the script more flexible. You can use the PASSING VARIABLES TO SCRIPTS functionality to change the smart plug when using the call_service action.

ikea_tradfri_reset:

  variables:
    smart_plug: "switch.REPLACE_SWITCH_NAME" #change this to your default smart plug or it can be change at run time using a generic script.turn_on service.

  sequence:
  - repeat:
      count: '5'
      sequence:
        - service: switch.turn_off
          data: {}
          target:
            entity_id: "{{ smart_plug }}"
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 900
        - service: switch.turn_on
          data: {}
          target:
            entity_id: "{{ smart_plug }}"
        - delay:
            hours: 0
            minutes: 0
            seconds: 0
            milliseconds: 500
            
  mode: single
1 Like