{"id":229,"date":"2016-08-14T15:49:26","date_gmt":"2016-08-14T15:49:26","guid":{"rendered":"https:\/\/smartlifeautomated.wordpress.com\/?p=229"},"modified":"2017-07-11T05:45:43","modified_gmt":"2017-07-11T05:45:43","slug":"sonoff-documentation","status":"publish","type":"post","link":"https:\/\/smartlife.tech\/blog\/2016\/08\/14\/sonoff-documentation\/","title":{"rendered":"Sonoff Documentation"},"content":{"rendered":"<p>As I am likely done developing on this great little relay, I wanted to write a short post regarding how to interact with it. Of course, it was meant to be used with SmartThings, but it does have a web interface and can be used independently.<!--more--><\/p>\n<h3>Connecting it to your wifi<\/h3>\n<p>When power is first applied it creates a wifi AP titled &#8220;Sonoff.[MAC address]&#8221;. This is for ease and convenience of adding it to your home network. After connecting to the access point with the password &#8220;configme&#8221;, you browse to 192.168.4.1 and connect it to your wifi access point. At that point it should reboot and obtain an ip address from your network.<\/p>\n<h3>SmartThings Service Manager SmartApp<\/h3>\n<p>The service manager is designed to pick up after the above step is complete. You install the SmartApp and run its &#8220;discover&#8221; mode. It will find all the Sonoff switches on your network. It will also display the IP address that the switches obtained so you can connect to their web interface if you desire. Connecting to their web interface is an optional step as the service manager will configure the switch to work with your SmartThings hub.<\/p>\n<h3>Web Interface<\/h3>\n<div id='gallery-1' class='gallery galleryid-229 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\/08\/14\/sonoff-documentation\/sonoff_web1\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/08\/sonoff_web1-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\/08\/14\/sonoff-documentation\/sonoff_web2\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/08\/sonoff_web2-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 landscape'>\n\t\t\t\t<a href='https:\/\/smartlife.tech\/blog\/2016\/08\/14\/sonoff-documentation\/sonoff_web3\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/08\/sonoff_web3-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 landscape'>\n\t\t\t\t<a href='https:\/\/smartlife.tech\/blog\/2016\/08\/14\/sonoff-documentation\/sonoff_web4\/'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/smartlife.tech\/blog\/wp-content\/uploads\/2016\/08\/sonoff_web4-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/div><\/figure>\n\t\t<\/div>\n\n<p>The web interface has the the following pages:<\/p>\n<p><strong>\/  <\/strong>                     (root)<br \/>\n<strong>\/advanced<\/strong>     (advanced configuration)<br \/>\n<strong>\/control<\/strong>         (relay control)<br \/>\n<strong>\/update<\/strong>          (firmware update)<\/p>\n<p>From here you can do some advanced configuration. You can set a static IP address if you would like. You can also configure a password to use for configuration &amp; firmware update, as well as control. If you do setup a control password here, you must input the password into the device within SmartThings. You can also set the Boot Up state from here, although that can also be configured within SmartThings.<\/p>\n<p>There is also a way to graphically control the relay from the web interface. You can turn it on or off with a click of the mouse.<\/p>\n<h3>Password Protection<\/h3>\n<p>The username for password protection of the config and the control is: &#8220;admin&#8221;<\/p>\n<h3>JSON endpoints<\/h3>\n<p>On the main page of the device, there is a listing of all the JSON endpoints. Here is a listing of their function.<\/p>\n<p><strong>status<\/strong>: This will return a status of the relay (power) and the switches uptime (uptime).<\/p>\n<p><strong>config<\/strong>: This endpoint is intended to be used by the HA system to send configuration parameters to the switch. You can send the HA hub ip address (haip), communication port, (haport) and &#8220;power on state&#8221; (pos).<\/p>\n<p><strong>on<\/strong>: Turns the relay on.<\/p>\n<p><strong>off<\/strong>: Turns the relay off.<\/p>\n<p><strong>reboot<\/strong>: Reboots the device<\/p>\n<p><strong>info<\/strong>: Returns the firmware version (version), date (date), and the MAC address (mac) of the device.<\/p>\n<h3>Firmware Update<\/h3>\n<p>Updating the firmware is an extremely simple process. You navigate to \/update for the switch you are wanting to update, click and select the bin file you downloaded, and hit the &#8220;Update&#8221; button.<\/p>\n<p>The latest firmware can be found here: <a href=\"https:\/\/github.com\/erocm123\/SmartThingsPublic\/tree\/master\/devicetypes\/erocm123\/sonoff-wifi-switch.src\">https:\/\/github.com\/erocm123\/SmartThingsPublic\/tree\/master\/devicetypes\/erocm123\/sonoff-wifi-switch.src<\/a><\/p>\n<h3>Factory Reset<\/h3>\n<p>You can reset the devices wifi &amp; network configuration settings by holding the switch down on the device for 10 &#8211; 20 seconds. You can reset all of the settings on the device (useful if you forget the configuration password) by holding down the switch for 20 &#8211; 60 seconds.<\/p>\n<h3>Downloads<\/h3>\n<p><strong>Device Handler<\/strong>: <a href=\"https:\/\/github.com\/erocm123\/SmartThingsPublic\/blob\/master\/devicetypes\/erocm123\/sonoff-wifi-switch.src\/sonoff-wifi-switch.groovy\">https:\/\/github.com\/erocm123\/SmartThingsPublic\/blob\/master\/devicetypes\/erocm123\/sonoff-wifi-switch.src\/sonoff-wifi-switch.groovy<\/a><\/p>\n<p><strong>SmartApp<\/strong>: <a href=\"https:\/\/github.com\/erocm123\/SmartThingsPublic\/blob\/master\/smartapps\/erocm123\/sonoff-connect.src\/sonoff-connect.groovy\">https:\/\/github.com\/erocm123\/SmartThingsPublic\/blob\/master\/smartapps\/erocm123\/sonoff-connect.src\/sonoff-connect.groovy<\/a><\/p>\n<p><strong>Firmware<\/strong>: <a href=\"https:\/\/github.com\/erocm123\/SmartThingsPublic\/raw\/master\/devicetypes\/erocm123\/sonoff-wifi-switch.src\/Sonoff.ino.generic.bin\">https:\/\/github.com\/erocm123\/SmartThingsPublic\/raw\/master\/devicetypes\/erocm123\/sonoff-wifi-switch.src\/Sonoff.ino.generic.bin<\/a><\/p>\n<h3>Where to Buy<\/h3>\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>As I am likely done developing on this great little relay, I wanted to write a short post regarding how to interact with it. Of course, it was meant to be used with SmartThings, but it does have a web interface and can be used independently.<\/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-229","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\/229","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=229"}],"version-history":[{"count":3,"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/posts\/229\/revisions"}],"predecessor-version":[{"id":804,"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/posts\/229\/revisions\/804"}],"wp:attachment":[{"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/media?parent=229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/categories?post=229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smartlife.tech\/blog\/wp-json\/wp\/v2\/tags?post=229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}