Control Plug S through Cloud API

  • Hi,

    I just bought a Plug S and want to control it through the cloud API. I followed this guide:

    https://shelly.cloud/documents/deve…_api_access.pdf

    And I can read the device status successfully through /device/status. But when I try to turn the plug on or off through /device/relay/control/, I get the error "wrong_channel". Even when I include "channel":"0" to the API call. The document doesn't specify the Plug S, so it may have other API methods.

    Does anyone know how to control the Plug S through the cloud API? And is there a full documentation of the cloud API somewhere?

  • Hello,

    i had the same problem some time ago too. The shelly_cloud_api_access.pdf is not really helpful at that point. I don't know if there is a better documentation out there but i was able to solve the problem:

    The key point is that you have to make a https POST request and not a GET request to switch the plug. You can easily try it out using wget:

    wget -q -O - --post-data "id=xyz&auth_key=abcxyz&channel=0&turn=on" https://shelly-11-eu.shelly.cloud/device/relay/control

    If you specify your device id and auth_key, it should work.

    I am controlling my Shelly Plug S using the python requests library. If you like to have some examples on that just write me.


    Nevetheless a GET request is working also, if you only want to get the status information. So this is what makes it really confusing, that it works for one thing but does not work for the other things.

  • Hello,

    I was having exactly the same problem with a Shelly Plug S:

    I was sending a POST to the endpoint:

    https://shelly-xx-eu.shelly.cloud/device/relay/c…annel=0&turn=on

    and I was getting back the error "wrong_channel": "Could not control this relay channel!"

    The problem is that the webservice method allows the get parameters in the URL (auth_key and id), but the command parameters must go on the POST body.

    So to solve the problem, you just need to:

    send a POST to the endpoint using the auth_key and id parameters: "https://shelly-xx-eu.shelly.cloud/device/relay/c…_key=xxx&id=yyy"

    and send in the body, a TEXT with the parameters: "&channel=0&turn=on".

    Or, in alternative, simply send a POST to the endpoint without any parameter and all parameters in the POST BODY - i.e.:

    Endpoint: "https://shelly-xx-eu.shelly.cloud/device/relay/control/"

    Body: "auth_key=xxx&id=yyy&channel=0&turn=on"

    Hope this is useful for others 8) .

    Thank you!

    2 Mal editiert, zuletzt von neea_ct (31. Januar 2022 um 14:02)

  • Dieses Thema enthält einen weiteren Beitrag, der nur für registrierte Benutzer sichtbar ist.