{"id":2404,"date":"2023-11-06T20:58:16","date_gmt":"2023-11-06T19:58:16","guid":{"rendered":"https:\/\/theroamingworkshop.cloud\/b\/?p=2404"},"modified":"2023-11-06T21:21:41","modified_gmt":"2023-11-06T20:21:41","slug":"shelly-1-wifi-switch-scheduler-local-http-api-config-and-plug-box-assembly","status":"publish","type":"post","link":"https:\/\/theroamingworkshop.cloud\/b\/en\/2404\/shelly-1-wifi-switch-scheduler-local-http-api-config-and-plug-box-assembly\/","title":{"rendered":"Shelly 1: wifi switch\/scheduler, local HTTP API config and plug box assembly"},"content":{"rendered":"\n<p>Today I&#8217;m bringing you the second chance that I&#8217;ll give Shelly. My first <strong>Shelly Dimmer<\/strong> blew up for excess temperature inside a connection box, but another <strong>Shelly 2.5<\/strong> controlling two lights is holding fine, also fitted in the wall.<\/p>\n\n\n\n<p>Maybe the difference is the extra 5\u00baC that they withstand, so I&#8217;m going to fit a <strong>wall plug with switch and scheduler<\/strong> using a tiny <strong>Shelly 1<\/strong>, and just hope it survives.<\/p>\n\n\n\n<p>Apart from the tiny size, Shelly are easy to configure, so we&#8217;ll also see how to control them locally via the <strong>HTTP API<\/strong>.<\/p>\n\n\n\n<div id=\"menu\" style=\"padding:20px 20px 20px 20px; border-left:2px solid darkgrey;\">\n<p style=\"font-weight:bold;\">Content<\/p>\n<\/div>\n<script>\nvar text;\nvar element;\n\nfunction fillmenu(){\n\nfor (let i=0; i<window.document.getElementsByTagName(\"h2\").length; i++){\nelement = window.document.getElementsByTagName(\"h2\")[i];\ntext = \"\u25b9 \"+element.innerHTML;\nvar newelement = document.createElement(\"a\");\nnewelement.innerHTML=text;\nvar postid=window.document.getElementsByTagName(\"article\")[0].id;\nvar url = \"https:\/\/theroamingworkshop.cloud\/b\/?p=\"+postid.substr(5,postid.length)+\"#\"+element.id;\nnewelement.setAttribute(\"href\", url);\nnewelement.appendChild(document.createElement(\"br\"));\nwindow.document.getElementById(\"menu\").appendChild(newelement);\nconsole.log(text);\n}\n}\nif(window.location.href.includes(\"tag\")){\n\n}else{\nwindow.setTimeout(fillmenu,2000);\n}\n\n<\/script>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"block-6c720368-2f0f-4e6f-8578-e74c056d28c6\">Requirements<\/h2>\n\n\n\n<p>My goal is to enable a wall plug that I can control and schedule via WIFI, in my case, to manage the electrical water heater. This is what I'll use:<\/p>\n\n\n\n<ul class=\"wp-block-list\" id=\"block-117649e9-8f27-46a0-aa0d-3d1fe40686db\">\n<li>Shelly 1.<\/li>\n\n\n\n<li>Two wire electric cable (line and neutral).<\/li>\n\n\n\n<li>Male plug.<\/li>\n\n\n\n<li>Female plug socket.<\/li>\n\n\n\n<li>Assembling material for a case (3D printer, plywood, etc).<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-3 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly8.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" data-id=\"2386\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly8.jpg\" alt=\"\" class=\"wp-image-2386\"\/><\/a><figcaption class=\"wp-element-caption\">Shelly 1<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly10.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" data-id=\"2385\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly10.jpg\" alt=\"\" class=\"wp-image-2385\"\/><\/a><figcaption class=\"wp-element-caption\">Electric cable<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly11.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" data-id=\"2383\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly11.jpg\" alt=\"\" class=\"wp-image-2383\"\/><\/a><figcaption class=\"wp-element-caption\">Male plug<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly13.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" data-id=\"2381\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly13.jpg\" alt=\"\" class=\"wp-image-2381\"\/><\/a><figcaption class=\"wp-element-caption\">Female plug socket (front)<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly12.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" data-id=\"2382\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly12.jpg\" alt=\"\" class=\"wp-image-2382\"\/><\/a><figcaption class=\"wp-element-caption\">Female plug socket (back)<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly9.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" data-id=\"2384\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly9.jpg\" alt=\"\" class=\"wp-image-2384\"\/><\/a><figcaption class=\"wp-element-caption\">Assembly support printed in 3D<\/figcaption><\/figure>\n<\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"block-d66a7ff8-689b-433f-ae3a-21dcb2d19297\">Electric connection<\/h2>\n\n\n\n<p id=\"block-95b3afe5-b3c6-45f7-b3ea-848f241cc4be\">Let's look at Shelly's user manual and see how we need to make the connections:<\/p>\n\n\n\n<p><a href=\"https:\/\/www.shelly.com\/documents\/user_guide\/shelly_1_multi_language.pdf\">https:\/\/www.shelly.com\/documents\/user_guide\/shelly_1_multi_language.pdf<\/a><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\" id=\"block-60a925a0-7cbe-4134-a773-52beeec0556c\"><img loading=\"lazy\" decoding=\"async\" width=\"323\" height=\"289\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly1.png\" alt=\"\" class=\"wp-image-2379\" style=\"aspect-ratio:1.1176470588235294;object-fit:cover;width:250px\"\/><\/figure>\n<\/div>\n\n\n<p id=\"block-b7f88770-d75e-4c5d-bdd7-3165c02af6a8\">The idea for this standard schematic is to connect Shelly 1 to a light bulb and its switch, where every symbol means the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>L<\/strong>: line<\/li>\n\n\n\n<li><strong>N<\/strong>: neutral<\/li>\n\n\n\n<li><strong>SW<\/strong>: switch<\/li>\n\n\n\n<li><strong>I<\/strong>: input<\/li>\n\n\n\n<li><strong>O<\/strong>: output<\/li>\n<\/ul>\n\n\n\n<p>As I want to enable a plug socket, the schematic will vary slightly, as I will not be using any switch and I can connect the input directly to the line. On the other hand, and for I reason I ignore, there is no cabling inside the connection box, so I bring the electric line from another plug using the cable... In the end, it all ends like this:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"323\" height=\"289\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly1b.png\" alt=\"\" class=\"wp-image-2387\" style=\"width:250px\"\/><\/figure>\n<\/div>\n\n\n<p style=\"border-left:3px solid orange;padding-left:5px;font-size:14px;\"><i><b>TIP! <\/b>I'd say that I confused the cable color norm, but it is not important in this case as its a closed circuit and it will work anyways.<\/i><\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-3 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly7.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" data-id=\"2388\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly7.jpg\" alt=\"\" class=\"wp-image-2388\"\/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly16.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"1280\" data-id=\"2390\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly16.jpg\" alt=\"\" class=\"wp-image-2390\"\/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly15.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"1280\" data-id=\"2389\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly15.jpg\" alt=\"\" class=\"wp-image-2389\"\/><\/a><\/figure>\n<\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"montaje-carcasa\">Assembly<\/h2>\n\n\n\n<p id=\"block-b58cdc36-b931-46be-9beb-0392cf6b2302\">You might see that I made a small 3D support to guide the cabling, as well as a lid to cover the void around the socket. Modelling every part in 3D, with real measures, helps to distribute the space properly and ensure that your solution fits:<\/p>\n\n\n\n<iframe style=\"width:100%;height:350px;border:none\" src=\"https:\/\/theroamingworkshop.cloud\/threeJS\/models\/shelly-plug\/\"><\/iframe>\n\n\n\n<p>I'll leave here the 3D .stl models ready to send to your slider software.<\/p>\n\n\n\n<p><em><strong>Shelly-Plug_support_v1.stl<\/strong><\/em><\/p>\n\n\n\n<p><a href=\"https:\/\/theroamingworkshop.cloud\/demos\/Shelly-Plug_support_v1.stl\">https:\/\/theroamingworkshop.cloud\/demos\/Shelly-Plug_support_v1.stl<\/a><\/p>\n\n\n\n<p><em><strong>Shelly-Plug_tapa_v1.stl<\/strong><\/em><\/p>\n\n\n\n<p><a href=\"https:\/\/theroamingworkshop.cloud\/demos\/Shelly-Plug_tapa_v1.stl\">https:\/\/theroamingworkshop.cloud\/demos\/Shelly-Plug_tapa_v1.stl<\/a><\/p>\n\n\n\n<p>Finally, this is how it all looks crafted in place. It's not the perfect fit, but it does the job I needed.<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly6.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" data-id=\"2393\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly6.jpg\" alt=\"\" class=\"wp-image-2393\"\/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly5.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" data-id=\"2391\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly5.jpg\" alt=\"\" class=\"wp-image-2391\"\/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly4.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" data-id=\"2392\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly4.jpg\" alt=\"\" class=\"wp-image-2392\"\/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly3.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" data-id=\"2394\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly3.jpg\" alt=\"\" class=\"wp-image-2394\"\/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly2.jpg\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"1280\" height=\"720\" data-id=\"2395\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly2.jpg\" alt=\"\" class=\"wp-image-2395\"\/><\/a><\/figure>\n<\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"block-e51096a5-63cc-44b4-9b1b-febc356c156e\">Internet connection<\/h2>\n\n\n\n<p id=\"block-b58cdc36-b931-46be-9beb-0392cf6b2302\">Let's now see how to bring the Shelly 1 to life and control it locally.<\/p>\n\n\n\n<p id=\"block-b58cdc36-b931-46be-9beb-0392cf6b2302\">Opposite to Sonoff, Shelly makes it much easier and you just need to follow the user manual.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Power Shelly 1<\/strong> using the male plug.<\/li>\n\n\n\n<li>This will activate an AP (Access Point) or Wi-Fi network with an <strong>SSID<\/strong> looking like \"<strong><em>shelly1-01A3B4<\/em><\/strong>\". Connect to this Wi-Fi network using a smartphone or PC.<\/li>\n\n\n\n<li>Once connected, use a web browser to access the IP at <strong>192.168.33.1<\/strong> and it will take you to Shelly's web interface for device configuration.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly17.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"909\" height=\"422\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly17.png\" alt=\"\" class=\"wp-image-2396\"\/><\/a><\/figure>\n<\/div>\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>Once in, you must config the device (inside <strong><em>Internet &amp; Security<\/em><\/strong> menu) so that it automatically connects to your local Wi-Fi network, as well as it is recommended to restrict access with username and password.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-gallery aligncenter has-nested-images columns-default is-cropped wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly18.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"889\" height=\"584\" data-id=\"2398\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly18.png\" alt=\"\" class=\"wp-image-2398\"\/><\/a><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly19.png\" target=\"_blank\" rel=\"noreferrer noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"881\" height=\"713\" data-id=\"2397\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly19.png\" alt=\"\" class=\"wp-image-2397\"\/><\/a><\/figure>\n<\/figure>\n\n\n\n<p id=\"block-4cefe04a-11eb-4dce-9585-f8a615b2b85f\">We're all set to communicate with Shelly 1 locally.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"shelly-http-api\">Shelly HTTP API usage<\/h2>\n\n\n\n<p id=\"block-a1e6c89c-d92c-4ea9-b5b3-4f7374988308\">To use the command of the HTTP API you must know the device IP in your local network.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"block-cf06b332-7f8b-4292-af81-3d99c02fb3b3\">Find IP in the router<\/h3>\n\n\n\n<p>You can access the network map in your router, usually from the address <code>http:\/\/192.168.1.1<\/code><\/p>\n\n\n\n<p>The address and the password should be in some sticker in your router. Then you'll see your device with a name like <strong><em>shelly1-XXXXXXXXXXXX<\/em><\/strong>:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\" id=\"block-855bc0c5-1a86-48d8-814d-18cbaa754e54\"><img loading=\"lazy\" decoding=\"async\" width=\"403\" height=\"222\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly20.png\" alt=\"\" class=\"wp-image-2399\"\/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"block-c004d94f-fb69-4376-a315-09723e17e84d\">Find IP using nmap<\/h3>\n\n\n\n<p>In a terminal you can use the tool <strong>nmap<\/strong> to scan your local network.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Download it if not done yet:<br><code>sudo apt-get update<\/code><br><code>sudo apt-get install nmap<\/code><\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\" id=\"block-1b9e7580-b1a2-4f81-b33f-327e9a92998f\">\n<li>Scan your network (using <strong>sudo<\/strong> you'll get the MAC address, which is useful as the IP could change when restarting the router)<br><code>sudo nmap -v -sn 192.168.1.0\/241.0\/24<\/code><\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\" id=\"block-dae90ac6-e73b-436b-94ec-f9aec624e4cb\"><img loading=\"lazy\" decoding=\"async\" width=\"413\" height=\"81\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly21.png\" alt=\"\" class=\"wp-image-2400\"\/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\" id=\"block-0334414b-519b-4248-b77f-d58d7d2160f9\">Send HTTP requests to the device<\/h3>\n\n\n\n<p id=\"block-3904f408-a806-45b5-90cc-72db4952782e\">Shelly's HTTP API is well documented in their website:<\/p>\n\n\n\n<p><a href=\"https:\/\/shelly-api-docs.shelly.cloud\/gen1\/#common-http-api\">https:\/\/shelly-api-docs.shelly.cloud\/gen1\/#common-http-api<\/a><\/p>\n\n\n\n<p id=\"block-1b9708fe-7552-4750-9c4f-4be3b51740e0\">In order to communicate with the device, you need to send HTTP requests using some software like <strong>Postman<\/strong> or using <strong>curl<\/strong> or <strong>wget<\/strong> in a terminal.<\/p>\n\n\n\n<p id=\"block-e4e2c8f1-aea0-4882-aee8-da7aa061cb6b\">The request will be sent to the <strong>device IP<\/strong> with:<\/p>\n\n\n\n<p><kbd>$ curl -X GET http:\/\/192.168.1.XX\/command<\/kbd><\/p>\n\n\n\n<p id=\"block-e4e2c8f1-aea0-4882-aee8-da7aa061cb6b\">If you defined user and password, you need to include them in the URL like below, or you'll receive a \"<em>401 unauthorized<\/em>\" response:<\/p>\n\n\n\n<p><kbd>$ curl -X GET http:\/\/user:pass@192.168.1.XX\/command<\/kbd><\/p>\n\n\n\n<p id=\"block-e4e2c8f1-aea0-4882-aee8-da7aa061cb6b\">Now let's see some specific cases:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"block-328fb855-a920-4bb0-b709-b01f082b5049\">Device information<\/h2>\n\n\n\n<p id=\"block-df69aded-501b-4e64-98f2-438704479766\"><code>http:\/\/[user]:[pass]@[ip]\/status<\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\" id=\"block-9916550e-494a-43e6-b986-87f4c8cb05b4\">\n<li><strong>curl<\/strong><\/li>\n<\/ul>\n\n\n\n<p id=\"block-674b6ba0-da71-4986-af9e-f216ef78b15d\"><code>curl -X GET 'http:\/\/user:pass@192.168.1.XX\/status<\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\" id=\"block-48c16ff2-c202-4cbc-9a73-d0d378391bab\">\n<li><strong>Response<\/strong><\/li>\n<\/ul>\n\n\n\n<pre id=\"block-e49c08d6-432d-471e-a5d5-ac23e7075bd1\" class=\"wp-block-code\"><code>{\"wifi_sta\":{\"connected\":true,\"ssid\":\"MYWIFINETWORK\",\"ip\":\"192.168.1.XX\",\"rssi\":-70},\"cloud\":{\"enabled\":false,\"connected\":false},\"mqtt\":{\"connected\":false},\"time\":\"19:30\",\"unixtime\":1699295403,\"serial\":1,\"has_update\":false,\"mac\":\"A4CF12F407B1\",\"cfg_changed_cnt\":0,\"actions_stats\":{\"skipped\":0},\"relays\":&#91;{\"ison\":false,\"has_timer\":false,\"timer_started\":0,\"timer_duration\":0,\"timer_remaining\":0,\"source\":\"input\"}],\"meters\":&#91;{\"power\":0.00,\"is_valid\":true}],\"inputs\":&#91;{\"input\":0,\"event\":\"\",\"event_cnt\":0}],\"ext_sensors\":{},\"ext_temperature\":{},\"ext_humidity\":{},\"update\":{\"status\":\"idle\",\"has_update\":false,\"new_version\":\"20230913-112003\/v1.14.0-gcb84623\",\"old_version\":\"20230913-112003\/v1.14.0-gcb84623\"},\"ram_total\":51688,\"ram_free\":39164,\"fs_size\":233681,\"fs_free\":146333,\"uptime\":2679}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"encender-apagar\">Turn (on\/off)<\/h2>\n\n\n\n<p id=\"block-6577991e-4885-414e-8e58-c5d0508247d6\"><code>http:\/\/[usr]:[pass]@[ip]\/relay\/0?turn=[on\/off]<\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\" id=\"block-322f6236-9ada-484a-b258-60ea2cd9f7ac\">\n<li><strong>curl<\/strong><\/li>\n<\/ul>\n\n\n\n<p id=\"block-43f3c573-4860-4b73-9ed0-9d05a8b6427a\"><kbd>curl -X GET http:\/\/user:pass@192.168.1.XX\/relay\/0?turn=on<\/kbd><\/p>\n\n\n\n<ul class=\"wp-block-list\" id=\"block-202c0b1f-646c-4d70-bbc6-9b42ce94f22f\">\n<li><strong>Response<\/strong><\/li>\n<\/ul>\n\n\n\n<pre id=\"block-e94dc518-5d22-4390-bc43-4908bae0bc3b\" class=\"wp-block-code\"><code>{\"ison\":true,\"has_timer\":false,\"timer_started\":0,\"timer_duration\":0,\"timer_remaining\":0,\"source\":\"http\"}<\/code><\/pre>\n\n\n\n<p>The value <kbd>0<\/kbd> in the URL matches te number of the relay or internal switch in the Shelly. In this case there is only one, but in the case of <strong>Shelly 2.5<\/strong> you have two relays, so you can call them individually changing this value.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"programador\">Scheduler<\/h2>\n\n\n\n<p id=\"block-987f1e51-52c8-4519-8c26-53cf99d76185\"><code>http:\/\/[usr]:[pass]@[ip]\/settings\/relay\/0?schedule_rules=[HHMM]-[0123456]-[on\/off]<\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\" id=\"block-8b4d069b-9ccf-433d-9984-26a3cc0a690f\">\n<li><strong>curl<\/strong><\/li>\n<\/ul>\n\n\n\n<p id=\"block-5b9c208b-0f61-4452-b1d1-344ac2b91b53\"><code><kbd>curl -X GET http:\/\/user:pass@192.168.1.XX\/settings\/relay\/0?<\/kbd>schedule_rules=1945-0123456-on<\/code><\/p>\n\n\n\n<ul class=\"wp-block-list\" id=\"block-ad010307-a458-49fa-b057-9fde43676c5b\">\n<li><strong>Response<\/strong><\/li>\n<\/ul>\n\n\n\n<pre id=\"block-57b778f1-8e9d-413d-bbb7-7b665debbdcf\" class=\"wp-block-code\"><code>{\"name\":\"CALENTADOR\",\"appliance_type\":\"General\",\"ison\":false,\"has_timer\":false,\"default_state\":\"off\",\"btn_type\":\"toggle\",\"btn_reverse\":0,\"auto_on\":0.00,\"auto_off\":0.00,\"power\":0.00,\"schedule\":true,\"schedule_rules\":&#91;\"1945-0123456-on\"]}<\/code><\/pre>\n\n\n\n<p>In this case, the URL defines the following schedule rule parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>HHMM<\/strong>: hour and minute that activate the rule<\/li>\n\n\n\n<li><strong>0123456<\/strong>: days of the week when the rule is active<\/li>\n\n\n\n<li><strong>on\/off<\/strong>: status that the rule triggers<\/li>\n<\/ul>\n\n\n\n<p>This way, to schedule the on and off of the device (except during weekends), you could send a request like this one:<\/p>\n\n\n\n<p><kbd>curl -X GET http:\/\/192.168.1.XX\/settings\/relay\/0?schedule_rules=2300-01234-on,0700-01234-off<\/kbd><\/p>\n\n\n\n<p>Obviously you can also configure the schedule rules from the web interface, or just check the commands worked:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"882\" height=\"698\" src=\"https:\/\/theroamingworkshop.cloud\/b\/wp-content\/uploads\/2023\/11\/shelly22.png\" alt=\"\" class=\"wp-image-2401\"\/><\/figure>\n<\/div>\n\n\n<p id=\"block-dd271cf7-4c04-40b8-91fe-1983a80ba7f1\">And that would cover all of it. Jump off and fill your house with tiny Shellys completely customizable. Any questions or comments on Twitter \ud83d\udc26 please! (though given what's going on with the X thing, who knows how long I'll last...)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today I&#8217;m bringing you the second chance that I&#8217;ll give Shelly. My first Shelly Dimmer blew up for excess temperature inside a connection box, but another Shelly 2.5 controlling two lights is holding fine, also fitted in the wall. Maybe the difference is the extra 5\u00baC that they withstand, so I&#8217;m going to fit a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2380,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68],"tags":[403,401,409,573,397,411,405,575,571,567,565,399,569,407],"class_list":["post-2404","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-electronics","tag-electronica","tag-electronics","tag-internet","tag-interruptor","tag-iot","tag-lights","tag-luces","tag-programador","tag-scheduler","tag-shelly","tag-shelly-1","tag-smat-home","tag-switch","tag-wifi","post-preview"],"_links":{"self":[{"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/posts\/2404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/comments?post=2404"}],"version-history":[{"count":6,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/posts\/2404\/revisions"}],"predecessor-version":[{"id":2411,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/posts\/2404\/revisions\/2411"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/media\/2380"}],"wp:attachment":[{"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/media?parent=2404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/categories?post=2404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroamingworkshop.cloud\/b\/wp-json\/wp\/v2\/tags?post=2404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}