SwitchBotAPI icon indicating copy to clipboard operation
SwitchBotAPI copied to clipboard

Open single curtain (of 2 curtains grouped together) via API

Open rweijnen opened this issue 4 months ago • 3 comments

Current Situation

In switchbot app it's possible to open just left or right side of my curtains but how to do this using switchbot api? I tried to do this by changing the index in the setPosition call to the group and changing the index to 1 or 2 but this just opens or closes both curtains.

I also tried obtaining the deviceId of the individual curtains and set turnOff, turnOn and setPosition but this returns 174 Device's cloud service not enable.

How to select just one curtain with api?

Logs

Using api to get devicelist:
deviceId     deviceName     deviceType hubDeviceId
--------     ----------     ---------- -----------
C1489A61xxxx Hub Mini 1A    Hub Mini   000000000000
CEA134E3xxxx Curtains Front Curtain    C1489A61xxxx 
E2F7FCB2xxxx Curtain 67     Curtain    000000000000
F5D13A7Fxxxx Curtains Back  Curtain    C1489A61xxxx
FDBB59Bxxxxx Curtain 88     Curtain    000000000000

Then view Curtains Back as example:
deviceId           : F5D13A7Fxxxx
deviceName         : Curtains Back
deviceType         : Curtain
enableCloudService : True
hubDeviceId        : C1489A61xxxx
curtainDevicesIds  : {F5D13A7Fxxxx, FDBB59B3xxxx}
calibrate          : True
group              : True
master             : True
openDirection      : left

so individual curtains are:
curtainDevicesIds  : {F5D13A7Fxxxx, FDBB59B3xxxx}

If I ask /devices/ FDBB59Bxxxx/status it works fine:
deviceId      : FDBB59B3xxxx
deviceType    : Curtain
calibrate     : True
group         : True
moving        : False
slidePosition : 0

I try to send turnOff, turnOn, setPosition command to device id FDBB59B3xxxx it fails:
statusCode body message                          
---------- ---- -------                          
       174      Device's cloud service not enabled

Configuration

I'm using Home Assistant but just sending rest commands and tests above using curl/powershell

Environment

  • OS:
  • Software:
  • Node:
  • npm:

Additional Context

Opening and closing the group (both curtains) works fine.

rweijnen avatar Apr 04 '24 07:04 rweijnen

I don't believe this option is in the API: image

donavanbecker avatar Apr 04 '24 11:04 donavanbecker

Yes I'm indeed looking for how to do exactly what the app is able to do but from the api. If that's not available, how does the app handle it (bluetooth?). Could you confirm if possible with the api? If not, could this be added in the future?

rweijnen avatar Apr 04 '24 11:04 rweijnen

I've just run into this same issue. Writing my own home automation script and I can open and close the curtains but I can't control just the left or right curtain only. This appears in the app so the API should support it?

AlexanderLeporiday avatar Apr 19 '24 19:04 AlexanderLeporiday