{"id":13,"date":"2016-04-21T23:59:28","date_gmt":"2016-04-21T23:59:28","guid":{"rendered":"https:\/\/smartlifeautomated.wordpress.com\/?p=13"},"modified":"2017-07-11T05:47:06","modified_gmt":"2017-07-11T05:47:06","slug":"sonoff-wifi-switch-smartthings","status":"publish","type":"post","link":"https:\/\/smartlife.tech\/blog\/2016\/04\/21\/sonoff-wifi-switch-smartthings\/","title":{"rendered":"Sonoff Wifi Switch &#038; SmartThings"},"content":{"rendered":"<p>This is a wifi relay that can be found for as low as $5. I have had a few of these up and running for a little while now and they are working great. They can even support instant status updates (notify SmartThings on state change) when the switch is toggled by pressing the button, and are really quite simple to setup.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-26\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/sonoff1.jpg\" alt=\"Sonoff1\" width=\"720\" height=\"405\" srcset=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/sonoff1.jpg 720w, https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/sonoff1-300x169.jpg 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/p>\n<p><!--more--><\/p>\n<div id='gallery-1' class='gallery galleryid-13 gallery-columns-5 gallery-size-thumbnail'><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon portrait'>\n\t\t\t\t<a href='https:\/\/smartlife.tech\/blog\/2016\/04\/21\/sonoff-wifi-switch-smartthings\/20160419_112127\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/20160419_112127-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/div><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon portrait'>\n\t\t\t\t<a href='https:\/\/smartlife.tech\/blog\/2016\/04\/21\/sonoff-wifi-switch-smartthings\/20160419_112135\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/20160419_112135-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/div><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon portrait'>\n\t\t\t\t<a href='https:\/\/smartlife.tech\/blog\/2016\/04\/21\/sonoff-wifi-switch-smartthings\/20160417_143034\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/20160417_143034-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/div><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/smartlife.tech\/blog\/2016\/04\/21\/sonoff-wifi-switch-smartthings\/20160417_150037\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/20160417_150037-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/div><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon landscape'>\n\t\t\t\t<a href='https:\/\/smartlife.tech\/blog\/2016\/04\/21\/sonoff-wifi-switch-smartthings\/20160417_150043\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/20160417_150043-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/div><\/figure>\n\t\t<\/div>\n\n<p><strong>**Warning**<\/strong>: Do all of the flashing before connecting the switch to mains electricity. Be safe when working with electrical devices. I take no responsibility if you do something that damages yourself or your property. \ud83d\ude09<\/p>\n<h2>Flashing Firmware<\/h2>\n<p>This step is extremely easy, so don&#8217;t let it intimidate you. I have built an image of ESPEasy that supports rules which are needed for some of the logic on the switch. First, download the <a href=\"https:\/\/github.com\/erocm123\/SmartThingsPublic\/raw\/master\/devicetypes\/erocm123\/sonoff-wifi-switch.src\/ESPEasy_R120.zip\" target=\"_blank\">ESPEasy firmware flashing tool<\/a>. Next download the firmware image that I have built <a href=\"https:\/\/github.com\/erocm123\/SmartThingsPublic\/raw\/master\/devicetypes\/erocm123\/sonoff-wifi-switch-2-0.src\/ESPEasy_R100_1024.bin\" target=\"_blank\">here<\/a>, and place it in the same director<img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-70 alignright\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/sonoff5.jpg\" alt=\"Sonoff5\" width=\"354\" height=\"241\" srcset=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/sonoff5.jpg 354w, https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/sonoff5-300x204.jpg 300w\" sizes=\"auto, (max-width: 354px) 100vw, 354px\" \/>y that you extracted the ESPEasy flash.cmd tool in. Now, with an <a href=\"http:\/\/www.amazon.com\/gp\/product\/B014Y1IMNM\/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=9325&amp;creativeASIN=B014Y1IMNM&amp;linkCode=as2&amp;tag=smartlife06-20&amp;linkId=WWOQY26LFRNHMAAB\" target=\"_blank\">FTDI Adapter<\/a><img loading=\"lazy\" decoding=\"async\" style=\"border:none !important;margin:0!important;\" src=\"http:\/\/ir-na.amazon-adsystem.com\/e\/ir?t=smartlife06-20&amp;l=as2&amp;o=1&amp;a=B014Y1IMNM\" alt=\"\" width=\"1\" height=\"1\" border=\"0\" \/> (SET AT 3.3V) connected to the switch (square pin = VCC, then TX , RX, GROUND &#8211; that order), plug the FTDI adapter into the USB port of your computer while holding down the button on the switch. This puts it into programming mode. Run the flash.cmd script that came in the ESPEasy zip download and enter the following settings (COM Port: specific to your computer, Flash Size: 1024, Build: 100). Wait for it to finish and the hardest part is done.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-35 aligncenter\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/sonoff02.png\" alt=\"Sonoff02\" width=\"660\" height=\"910\" srcset=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/sonoff02.png 660w, https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/sonoff02-218x300.png 218w\" sizes=\"auto, (max-width: 660px) 100vw, 660px\" \/><\/p>\n<h2>Connect to Your Home Wifi<\/h2>\n<p>Now, plug the switch into power and wait for a moment. It should create an access point named ESP_00. Connect to that access point with the password: configesp and it should redirect you to the page where you can connect it to your access point. If it doesn&#8217;t redirect you the IP address is 192.168.4.1. Put in your network access point information and hit connect. Waiting at this page will usually give you the IP address of the switch before it kicks you off of it&#8217;s ESP_00 access point.<\/p>\n<p>The switch should then connect to your Wifi access point. I recommend setting a DHCP reservation for the switch or giving it a static IP address at this point. If the splash page that shows you the switches IP address (mentioned above) did not appear, use whatever technique you usually use on your network to find a newly attached devices ip address. Your DHCP server \/ router is a good place to start.<\/p>\n<h2>SmartThings Setup<\/h2>\n<p>Add the device handler to your SmartThings account.<\/p>\n<p><a href=\"https:\/\/github.com\/erocm123\/SmartThingsPublic\/blob\/master\/devicetypes\/erocm123\/sonoff-wifi-switch-2-0.src\/sonoff-wifi-switch-2-0.groovy\" target=\"_blank\">https:\/\/github.com\/erocm123\/SmartThingsPublic\/blob\/master\/devicetypes\/erocm123\/sonoff-wifi-switch-2-0.src\/sonoff-wifi-switch-2-0.groovy<\/a><\/p>\n<p>Create a new device in the IDE and choose the Sonoff Wifi Switch device handler. In the SmartThings App, find the switch and edit it&#8217;s preferences with the IP address. Hit &#8220;Done&#8221; and the device handler should configure the switch with the devices and rules that it needs to function. The status portion of the handler should notify you that the configuration was successful. If it doesn&#8217;t change after a few seconds try hitting the &#8220;configure&#8221; button.<\/p>\n<div id='gallery-2' class='gallery galleryid-13 gallery-columns-3 gallery-size-thumbnail'><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon portrait'>\n\t\t\t\t<a href='https:\/\/smartlife.tech\/blog\/2016\/04\/21\/sonoff-wifi-switch-smartthings\/screenshot_20160421-165516\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/screenshot_20160421-165516-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/div><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon portrait'>\n\t\t\t\t<a href='https:\/\/smartlife.tech\/blog\/2016\/04\/21\/sonoff-wifi-switch-smartthings\/screenshot_20160421-165238\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/screenshot_20160421-165238-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/div><\/figure><figure class='gallery-item'>\n\t\t\t<div class='gallery-icon portrait'>\n\t\t\t\t<a href='https:\/\/smartlife.tech\/blog\/2016\/04\/21\/sonoff-wifi-switch-smartthings\/screenshot_20160421-165328\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/screenshot_20160421-165328-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/div><\/figure>\n\t\t<\/div>\n\n<h2>Configure Switch for Instant Status Updates (optional)<\/h2>\n<p>If you want SmartThings to get notified when you press the button on the switch, connect to the switch via http:\/\/ipaddress\/config and put the IP address of your SmartThings hub and port 39500 in the config as seen below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-49 aligncenter\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/sonoff04.png\" alt=\"Sonoff04\" width=\"410\" height=\"692\" srcset=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/sonoff04.png 410w, https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/04\/sonoff04-178x300.png 178w\" sizes=\"auto, (max-width: 410px) 100vw, 410px\" \/><\/p>\n<h2>Where to Buy<\/h2>\n<p><span style=\"font-weight: 400;\">It just so happens that Itead is having a promotional sale on their products. Click through to <a href=\"https:\/\/goo.gl\/RGAe4p\" target=\"_blank\" rel=\"noopener\">this link<\/a> to get some <strong>great smart home gear at up to 20 &#8211; 30 % off!<\/strong><\/span><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a wifi relay that can be found for as low as $5. I have had a few of these up and running for a little while now and they are working great. They can even support instant status updates (notify SmartThings on state change) when the switch is toggled by pressing the button, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[6,4,5],"tags":[],"class_list":["post-13","post","type-post","status-publish","format-standard","hentry","category-home-automation","category-sonoff","category-wifi"],"_links":{"self":[{"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/posts\/13","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/comments?post=13"}],"version-history":[{"count":2,"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/posts\/13\/revisions"}],"predecessor-version":[{"id":805,"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/posts\/13\/revisions\/805"}],"wp:attachment":[{"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/media?parent=13"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/categories?post=13"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/tags?post=13"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}