# \[Tutorial\] Control shellys remote in other networks (Shelly Cloud API)

**URL:** <https://community.homey.app/t/tutorial-control-shellys-remote-in-other-networks-shelly-cloud-api/89189>\
**Category:** Tutorials\
**Created:** [September 11, 2023, 11:49am UTC](https://community.homey.app/t/tutorial-control-shellys-remote-in-other-networks-shelly-cloud-api/89189 "2023-09-11T11:49:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![schmucke](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/schmucke/32/79913_2.png) [@schmucke](https://community.homey.app/u/schmucke)\
**Post date:** [September 11, 2023, 11:49am UTC](https://community.homey.app/t/tutorial-control-shellys-remote-in-other-networks-shelly-cloud-api/89189/1 "2023-09-11T11:49:05Z")

</div>

Since the question of how to control Shellys in a different location has come up several times, I’ll put the whole thing into a small guide. These instructions describe how to control a device outside your network. Of course, the Shelly must be connected to the internet and the Shellycloud at the other location.

First of all, you need the Shelly API Key, which is the only way to access your devices. To do this, log into your account either in the ShellyAPP or via my.shelly.cloud.

Via **Settings → User settings → Cloud activation key** you can collect your unique key and the corresponding server.  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/7/2/72ecb1ab48dda8fd944b943cb8c0be3431d06314.png)  
_You should not give the key to anyone, as it can be used to manage all your Shellys. If you ever change your password in the ShellyCloud, the key will also change!_

Next, you need the ID of the device you want to control. To do this, navigate to it and find the **Device ID** under **Settings → Device information**.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/c/0/c0dcadd18efd6ce09588490ef7a183275ad6b3b0.png)  
_You also note/copy these down._

With these three pieces of information (API Key, Shelly Server and Device ID) you can remotely control a Shelly.

For this we need the “Then” condition with the logic card  
 ![image](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/6/e/6ead6e1c2937512cf7cfc5352cc0d32c5413c313.png)

Now it is a matter of filling this map with life. (In this example I open a window with a Shelly 2.5 in “Roller Mode”)

> Methode: **Post**  
> URL: **[https://shelly-XX-eu.shelly.cloud/device/relay/roller/control](https://shelly-XX-eu.shelly.cloud/device/relay/roller/control)**(Exchange XX with your shelly server)  
> Headers: **content-type:application/x-www-form-urlencoded** (with this we tell the server that we are now transmitting requests in the specified format)  
> Body: **id=XXXXXXXX&direction=open&auth\_key=XXXXXXXXXXXXXXXXXXXXXXXXXXX…** The ID is your DeviceID and the auth\_Key is the API key.

If this tile is now executed, the window, blind or shutter should open. To close, simply send “ **Close** ” and to stop “ **Stop** ” or you can also send a percentage instead of **direction** with **pos** “**pos=[0…100]**”.

If you use the Shelly to switch different lights, the API URL changes to

> URL: [https://shelly-xx-eu.shelly.cloud/device/relay/control](https://shelly-xx-eu.shelly.cloud/device/relay/control)  
> Body: **channel=&turn=on&auth\_key=XXXXXXXXXXXXXXXXXX…**

With the channel ID you tell the Shelly which channel it should switch (0 or 1). With turn you tell the Shelly whether it should switch the relay on or off. Once these basic principles are understood, it is easy to control the other Shellys in the family.

Here you will find a small overview of the individual Shellys and the possibilities to control them:

> **[Communication | Shelly Technical Documentation](https://shelly-api-docs.shelly.cloud/cloud-control-api/communication/)**
>
> For calling a device you need the device\_id for that device. It is available

^^translated with deepl^^

---

<div class="post-metadata">

**Author:** ![MIGUEL\_ARCAS](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/miguel_arcas/32/47640_2.png) [@MIGUEL\_ARCAS](https://community.homey.app/u/MIGUEL_ARCAS)\
**Post date:** [October 28, 2024, 10:56am UTC](https://community.homey.app/t/tutorial-control-shellys-remote-in-other-networks-shelly-cloud-api/89189/2 "2024-10-28T10:56:29Z")

</div>

Hello, How can I creAte a device with Post command in Homey Pro?  
Is there any sample?
