Ikea Tradri

Hello!

So I have my xiaomi roborock working with voice commands with google home mini activating scripts to zoneclean different rooms. Next project is to do the same with “ikea trådfri” lights.

The gateway is setup and integrated, remote connecten to it, and lamps connected to the remote. I se both lamps in overview.

Now I want to make a script that, when activated, turns a lamp on with 10 % dim. I just dont know how to write the scripts. I´ve tried this:

Turn_lights_on_bedroom:
      alias: "Turn the lights on in bedroom"
      sequence:
        - service: light.turn_on
          data:
            entity_id: light.kitchen_counter
            brightness_pct: 30
        - service: light.turn_on
          data:
            entity_id: light.kitchen_main
            brightness_pct: 90

But I end upp getting error when “checking config”:

Invalid config for [script]: invalid slug Turn_lights_on_bedroom (try turn_lights_on_bedroom) for dictionary value @ data[‘script’]. Got OrderedDict([(‘vacuum_kitchen’, OrderedDict([(‘alias’, ‘Vacuum the kitchen’), (‘sequence’, [OrderedDict([(‘service’, ‘vacuum.send_command’), (‘data’, OrderedDict([(‘entity_id’, ‘vacuum.Bellman’), (‘command’, ‘app_zoned_clean’), (‘params’, [[25500, 25500, 25500, 27000, 1], [25300, 29300, 28800, 30000, 1]])]))])])])), (‘vacuum_kitchen_fast’, OrderedDict([(‘alias’, ‘Vacuum by the sink’), (‘sequence’, [OrderedDict([(‘service’, ‘vacuum.send_command’), (‘data’, OrderedDict([(‘entity_id’, 'vacuum.Be… (See /config/configuration.yaml, line 39). Please check the docs at Scripts - Home Assistant

How should one write a correct script 4 this?

I´ve made a group of the lights at least:

bedroom_lights:
    name: Belysning sovrum
    entities:
      - light.sangbord_hoger
      - light.sangbord_vanster

Now I want to call the group and set lights on with brightness_pct 10 %

From that error that doesn’t have anything to do with that script it looks like you have an indentation problem either before or after that script. The error will be at the transition from the vacuum script and the light turn on script.

I’d start checking there. If you can’t find it post your script config including the scripts before and after the turn on script above.

I got it to work! :slight_smile:

This is the scripts:

turn_on_bedroom_lights:
    alias: Tänd belysning i sovrummet
    sequence:
      service: light.turn_on
      data:
        entity_id: group.bedroom_lights
        brightness: 3
        
turn_off_bedroom_lights:
    alias: Släck belysning i sovrummet
    sequence:
      service: light.turn_off
      data:
        entity_id: group.bedroom_lights 

the “odd” thing though is that the codes differ from the ones used vid xiaomi vacuum:

vacuum_bedroom:
      alias: "Vacuum the bedroom"
      sequence:
        - service: vacuum.send_command
          data:
            entity_id: vacuum.Bellman
            command: app_zoned_clean
            params: [[25500,25500,25500,27000,1], [24300,32000,28800,35100,1], [23000,34300,24300,35100,1]]

An “-” before service

Now I can make IFTTTs that call these scripts :smiley: