# Access to the new local API on a TaHoma Box/Switch

**URL:** <https://discourse.nodered.org/t/access-to-the-new-local-api-on-a-tahoma-box-switch/70029>\
**Category:** Share Your Projects\
**Created:** [3 November 2022 14:14 UTC](https://discourse.nodered.org/t/access-to-the-new-local-api-on-a-tahoma-box-switch/70029 "2022-11-03T14:14:49Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hubertus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hubertus/32/10077_2.png) [@Hubertus](https://discourse.nodered.org/u/Hubertus)\
**Post date:** [3 November 2022 14:14 UTC](https://discourse.nodered.org/t/access-to-the-new-local-api-on-a-tahoma-box-switch/70029/1 "2022-11-03T14:14:49Z")

</div>

After two days of wild experimenting - here is my approach to access the local API of my TaHoma switch:

1. the documentation to turn on the developer mode [GitHub - Somfy-Developer/Somfy-TaHoma-Developer-Mode: A collection of requests to use a local API with Somfy TaHoma gateways](https://github.com/Somfy-Developer/Somfy-TaHoma-Developer-Mode)

2. the interactive page for testing: [Swagger UI](https://somfy-developer.github.io/Somfy-TaHoma-Developer-Mode/#/Api/)

3. the authentication process described in [1.] can be reproduced very well with the help of the Node-Red node "HTTP-Request" and run until the registration of the token(s). Displaying the tokens and deleting them also works as described.

4. after that I was not able to access the local API of the switch via HTTP-Requets. This was followed by various error messages. The absolutely same commands via EXEC and "curl -X ..." (as described in [2.]) worked fine and I am satisfied with the result for now.

If further information is desired, I will gladly provide information or make the corresponding flow available.

Many greetings  
Hubertus

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [3 November 2022 16:10 UTC](https://discourse.nodered.org/t/access-to-the-new-local-api-on-a-tahoma-box-switch/70029/2 "2022-11-03T16:10:08Z")

</div>

Nice, thanks for the info. The "developer mode" must be something recent, this used to be oauth2 only, which was horrible to work with. I use homebridge with the tahoma plugin for now.

The [overkiz node](https://flows.nodered.org/node/node-red-contrib-overkiz) (overkiz, is what somfy uses) was recently updated, maybe that works too (didnt try)

---

<div class="post-metadata">

**Author:** ![HeraldCoupe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/heraldcoupe/32/71908_2.png) [@HeraldCoupe](https://discourse.nodered.org/u/HeraldCoupe)\
**Post date:** [10 December 2022 16:28 UTC](https://discourse.nodered.org/t/access-to-the-new-local-api-on-a-tahoma-box-switch/70029/3 "2022-12-10T16:28:21Z")

</div>

Please can you share examples of your curl commands that will open and close the blinds.

---

<div class="post-metadata">

**Author:** ![Hubertus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hubertus/32/10077_2.png) [@Hubertus](https://discourse.nodered.org/u/Hubertus)\
**Post date:** [12 December 2022 09:07 UTC](https://discourse.nodered.org/t/access-to-the-new-local-api-on-a-tahoma-box-switch/70029/4 "2022-12-12T09:07:35Z")

</div>

i use the same curl calls as described in the [swagger ui](https://somfy-developer.github.io/Somfy-TaHoma-Developer-Mode/#/Setup/get_setup_devices). So for example:

```auto
curl -X 'POST' \
  'https://gateway-<your-gateway-id>.local:8443/enduser-mobile-web/1/enduserAPI/exec/apply' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <your-token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "label": "Bad/Rollladen",
  "actions": [
    {
      "commands": [
        {
          "name": "setClosure",
          "parameters": [
            "50"
          ]
        }
      ],
      "deviceURL": "io://<your-gateway-id>/<device-id>"
    }
  ]
}'

```

to set the blind to 50%. Also you can use the commands:  
stop  
down  
up  
open  
close  
my  
... all without parameters  
or setPosition same as setClosure

BR  
Hubertus

---

<div class="post-metadata">

**Author:** ![HeraldCoupe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/heraldcoupe/32/71908_2.png) [@HeraldCoupe](https://discourse.nodered.org/u/HeraldCoupe)\
**Post date:** [13 December 2022 12:37 UTC](https://discourse.nodered.org/t/access-to-the-new-local-api-on-a-tahoma-box-switch/70029/5 "2022-12-13T12:37:10Z")

</div>

Thank you, thats really helpful at least to prove I'm not going crazy.  
I have tried this but I get the really unhelpful error:

{"error":"Processing exception.","errorCode":"UNSPECIFIED\_ERROR"}

My suspicion is that the difference is that my motors are rts, not io but thats just a hunch and I don't know what to try next.

---

<div class="post-metadata">

**Author:** ![Hubertus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hubertus/32/10077_2.png) [@Hubertus](https://discourse.nodered.org/u/Hubertus)\
**Post date:** [13 December 2022 12:54 UTC](https://discourse.nodered.org/t/access-to-the-new-local-api-on-a-tahoma-box-switch/70029/6 "2022-12-13T12:54:22Z")

</div>

This should make no difference whether rts or io.

Which result do you get when querying the devices?

```auto
> curl -X 'GET \
> 'https://gateway-<your-gateway-id>.local:8443/enduser-mobile-web/1/enduserAPI/setup/devices' \
> -H 'accept: application/json' \
> -H 'Authorization: Bearer <your-token>'

```

the call lists all available and controllable devices.

There you can also see which commands are supported by each device.

---

<div class="post-metadata">

**Author:** ![HeraldCoupe](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/heraldcoupe/32/71908_2.png) [@HeraldCoupe](https://discourse.nodered.org/u/HeraldCoupe)\
**Post date:** [13 December 2022 13:48 UTC](https://discourse.nodered.org/t/access-to-the-new-local-api-on-a-tahoma-box-switch/70029/7 "2022-12-13T13:48:12Z")

</div>

```auto
[
  {
    "creationTime": 1666871965346,
    "deviceURL": "rts://2017-1033-8638/16774911",
    "available": true,
    "synced": true,
    "type": 1,
    "states": [],
    "label": "Gym blind",
    "definition": {
      "states": [],
      "widgetName": "UpDownScreen",
      "attributes": [],
      "uiClass": "Screen",
      "commands": [
        {
          "nparams": 0,
          "commandName": "stop",
          "paramsSig": "*p1"
        },
        {
          "commandName": "test",
          "nparams": 0
        },
        {
          "nparams": 0,
          "commandName": "open",
          "paramsSig": "*p1"
        },
        {
          "nparams": 0,
          "commandName": "close",
          "paramsSig": "*p1"
        },
        {
          "commandName": "identify",
          "nparams": 0
        },
        {
          "nparams": 0,
          "commandName": "up",
          "paramsSig": "*p1"
        },
        {
          "nparams": 0,
          "commandName": "down",
          "paramsSig": "*p1"
        },
        {
          "nparams": 0,
          "commandName": "my",
          "paramsSig": "*p1"
        },
        {
          "nparams": 0,
          "commandName": "openConfiguration",
          "paramsSig": "*p1"
        },
        {
          "nparams": 0,
          "commandName": "rest",
          "paramsSig": "*p1"
        }
      ],
      "type": "ACTUATOR"
    },
    "attributes": [],
    "enabled": true,
    "controllableName": "rts:BlindRTSComponent",
    "subsystemId": 0
  },
  {
    "creationTime": 1666871964036,
    "deviceURL": "rts://2017-1033-8638/16746440",
    "available": true,
    "synced": true,
    "type": 1,
    "states": [],
    "label": "Living room blind",
    "definition": {
      "states": [],
      "widgetName": "UpDownScreen",
      "attributes": [],
      "uiClass": "Screen",
      "commands": [
        {
          "nparams": 0,
          "commandName": "stop",
          "paramsSig": "*p1"
        },
        {
          "commandName": "test",
          "nparams": 0
        },
        {
          "nparams": 0,
          "commandName": "open",
          "paramsSig": "*p1"
        },
        {
          "nparams": 0,
          "commandName": "close",
          "paramsSig": "*p1"
        },
        {
          "commandName": "identify",
          "nparams": 0
        },
        {
          "nparams": 0,
          "commandName": "up",
          "paramsSig": "*p1"
        },
        {
          "nparams": 0,
          "commandName": "down",
          "paramsSig": "*p1"
        },
        {
          "nparams": 0,
          "commandName": "my",
          "paramsSig": "*p1"
        },
        {
          "nparams": 0,
          "commandName": "openConfiguration",
          "paramsSig": "*p1"
        },
        {
          "nparams": 0,
          "commandName": "rest",
          "paramsSig": "*p1"
        }
      ],
      "type": "ACTUATOR"
    },
    "attributes": [],
    "enabled": true,
    "controllableName": "rts:BlindRTSComponent",
    "subsystemId": 0
  }
]

```

Edit as I'm not allowed to post any more....

I've tried up and down etc but get the same result. I've gone back to Swagger which produces this curl:

curl -X 'POST'   
'[https://gateway-2017-1033-8638.local:8443/enduser-mobile-web/1/enduserAPI/exec/apply](https://gateway-2017-1033-8638.local:8443/enduser-mobile-web/1/enduserAPI/exec/apply)'   
-H 'accept: application/json'   
-H 'Authorization: Bearer 638f79237fbe15af7b48'   
-H 'Content-Type: application/json'   
-d '{  
"label": "string",  
"actions": [  
{  
"commands": [  
{  
"name": "down"  
}  
],  
"deviceURL": "rts://2017-1033-8638/16774015"  
}  
]  
}'

which returns an execId but also:

Failed to fetch.  
Possible Reasons:

CORS  
Network Failure  
URL scheme must be "http" or "https" for CORS request.

The blind doesn't move.

---

<div class="post-metadata">

**Author:** ![Hubertus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hubertus/32/10077_2.png) [@Hubertus](https://discourse.nodered.org/u/Hubertus)\
**Post date:** [13 December 2022 14:18 UTC](https://discourse.nodered.org/t/access-to-the-new-local-api-on-a-tahoma-box-switch/70029/8 "2022-12-13T14:18:42Z")

</div>

ok - so you can't use the setPosition etc. commands. It seems that only "open", "close", "up", "down", "stop" and "my" can be used. A direct positioning is not possible with RTS. But if you have set a MY position you can move to it - or with UP/DOWN and then STOP.

You can also emulate the setPosition. If you know the time in seconds that is needed for opening and closing, you can also use this to move to the position ;-). If the shutter needs 12 seconds to close, you can also reach a position 50% with six seconds.

---

<div class="post-metadata">

**Author:** ![Hubertus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hubertus/32/10077_2.png) [@Hubertus](https://discourse.nodered.org/u/Hubertus)\
**Post date:** [13 December 2022 17:04 UTC](https://discourse.nodered.org/t/access-to-the-new-local-api-on-a-tahoma-box-switch/70029/9 "2022-12-13T17:04:56Z")

</div>

copy the curl command and execute it in the shell e.g. of your raspberry - than you will see it works. i had the same errors but with the shell or with the exec-node in node-red it will work fine.
