Problems with Cover.set cover_position (Switch-Bot Curtain integration won't fire at all)

Hello everyone!

I’m new to HA and i like it very much!!! Don’t have any experience with coding and stuff, but a lot is very good to follow. Have already 20+ automations implemented. And i love it!

ow I’m working on a new one: automation with my curtains from Switch-Bot.

The problem is that i cant fire an event for the curtains after a trigger. The curtains wont do anything, but i can acces it manualy though through the panel.

Steps I’ve done to get the device in HA:

1. I edit /config/configuration.yaml and add this:

rest_command:
  switchbot_device_command:
    url: 'https://api.switch-bot.com/v1.0/devices/{{ deviceId }}/commands'
    method: post
    content_type: 'application/json'
    headers:
      Authorization: !secret switchbot_api
    payload: '{"command": "{{ command }}","parameter": "{{ parameter }}"}'


sensor:
  - platform: rest
    name: 'Woonkamer Gordijnen'
    resource: !secret switchbot_woonkamer_status_url
    method: GET
    scan_interval: 600
    headers:
      Authorization: !secret switchbot_api
      Content-Type: 'application/json'
    value_template: '{{ value_json.body.slidePosition }}'
    json_attributes_path: "$.body"
    json_attributes:
      - deviceId
      - deviceType
      - hubDeviceId
      - calibrate
      - group
      - moving
      - slidePosition

cover:
  - platform: template
    covers:
      bedroom_curtains:
        device_class: curtain
        friendly_name: "Woonkamer Gordijnen"
        position_template: "{{ states('sensor.bedroom_curtain_position') }}"
        open_cover:
          service: rest_command.switchbot_device_command
          data:
            deviceId: !secret switchbot_woonkamer_deviceId
            command: "turnOn"
        close_cover:
          service: rest_command.switchbot_device_command
          data:
            deviceId: !secret switchbot_woonkamer_deviceId
            command: "turnOff"
        stop_cover:
          service: rest_command.switchbot_device_command
          data:
            deviceId: !secret switchbot_woonkamer_deviceId
            command: "turnOff"
        set_cover_position:
          service: rest_command.switchbot_device_command
          data:
            deviceId: !secret switchbot_woonkamer_deviceId
            command: "setPosition"
            parameter: "0,ff,{{position}}"

2 I added /config/secrets.yaml and add this:

switchbot_api: "*my api of the device ;)*"

#Switchbot-Gordijn Woonkamer
switchbot_woonkamer_status_url: "https://api.switch-bot.com/v1.0/devices/E858B439BFA2/status"
switchbot_woonkamer_deviceId: "E858B439BFA2"

Than the identity is visible:

And i can change it positions, so far it works:
placed an images, but because i’m a new user cant place more that 1 image

Than i try to change the position of this curtain by the following code:

service: cover.set_cover_position
data:
  position: 50
target:
  entity-id: cover.bedroom_curtains

But nothing happens, even when i run it manualy it says: succesfully excuted. Also can’t nothing find in the log that points to this.
What can i do to get this work? What do i do wrong in this case, can’t figure it out.

I’m very curious to you guys reactions! Thank you for your time to dive into this problem!

Greetz!
Marwin

Well i figured it out. It wasn’t that difficult after all. This was the trick:

service: cover.close_cover
data: {}
target:
  entity_id: cover.bedroom_curtains