User Tools

Site Tools


projects:sonoff

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
projects:sonoff [2016/09/05 17:49] – [ESP8266] adm-janprojects:sonoff [2016/09/19 20:18] – [Known Hosts / Ports] adm-jan
Line 14: Line 14:
 ===== tl;dr ===== ===== tl;dr =====
 You could either configure a device with your own dispatch/websocket server and use the factory firmware. You could either configure a device with your own dispatch/websocket server and use the factory firmware.
-Or you could flash your own firmware using the OTA update mechanism. Currently both approaches are still theoretic.+Or you could flash your own firmware using the OTA update mechanism. <del>Currently both approaches are still theoretic.</del>
  
 ===== Setup ===== ===== Setup =====
Line 97: Line 97:
 | Dispatch Host       | eu-disp.coolkit.cc | 52.29.61.50     | 8081              | | Dispatch Host       | eu-disp.coolkit.cc | 52.29.61.50     | 8081              |
 | deviceDispatHost       | n/a (iotgo.iteadstudio.com) | 52.29.48.55     | 443              | | deviceDispatHost       | n/a (iotgo.iteadstudio.com) | 52.29.48.55     | 443              |
 +
 +^ Hostname               ^ IP-Address     ^ DNS    ^ Port   ^ Protocol   ^ Usage              ^ Description                                         ^
 +| eu-disp.coolkit.cc     | 52.29.61.50    | TRUE   | 8081   | HTTP       | device == 1.5.0    | dispatch/register device online, receive WS host    |
 +| eu-disp.coolkit.cc     | 52.29.61.50    | TRUE   | 443    | HTTPS      | device >= 1.5.2    | dispatch/register device online, receive WS host    |
 +| iotgo.iteadstudio.com  | 52.29.48.55    | FALSE  | 8081   | WS         | device == 1.5.0    | WebSocket to control the device from apps           |
 +| iot.itead.cn           | 52.29.48.55    | FALSE  | 443    | WSS        | device >= 1.5.2    | sec. WebSocket to control the device from apps      |
 +| dl.itead.cn            | 52.28.103.75   | FALSE  | 8088   | HTTP       | device >= 1.5.0    | OTA firmware download                               |
 +| eu-ota.coolkit.cc      | 52.28.103.75   | TRUE   | 80     | HTTP       | app >= 2.1.19      | Check for updated OTA firmware                      |
 +| eu-ota.coolkit.cc      | 52.28.103.75   | TRUE   | 8080   | HTTPS      | app >= ?           | OTA other / scene                                   |
 +| eu-api.coolkit.cc      | 52.29.61.50    | TRUE   | 8080   | HTTPS      | app >= ?           | http://iotgo.iteadstudio.com/api                    |
 +| alog.umeng.com         | 110.173.196.36 | TRUE   | 80     | HTTP       | app >= 2.1.19      | Used for user tracking                              |
 +| eu-long.coolkit.cc     | 52.29.48.55    | TRUE   | 8080   | WSS        | app >= 2.1.19      | sec. WebSocket to control devices from app          |
  
 ==== libimobiledevice ==== ==== libimobiledevice ====
Line 316: Line 328:
       "binList": [       "binList": [
         {         {
-          "downloadUrl": "http://attack.server.com/ota/rom/…/user1.1024.new.2.bin", +          "downloadUrl": "http://sonoff-142817.appspot.com/ota.php?filename=user1.1024.new.2", 
-          "digest": "2e1f86922c66f606b5e141121eaa112dea8834ce8717aba29a011316daa0b1d7",+          "digest": "a0046523521134e2d7eeaa243f29d8bd4748d0647788e097b4fdf75502a8ffba",
           "name": "user1.bin"           "name": "user1.bin"
         },         },
         {         {
-          "downloadUrl": "http://attack.server.com/ota/rom/…/user2.1024.new.2.bin", +          "downloadUrl": "http://sonoff-142817.appspot.com/ota.php?filename=user2.1024.new.2", 
-          "digest": "8c0c484fe66a0c32447628cde3ac5a97dbbb0a72ff0123ea08ff48c9972faf7f",+          "digest": "a4986bd17a5c2a884c4860c79a1d58d5c9546da232d68ce888fa8c4ad4389a19",
           "name": "user2.bin"           "name": "user2.bin"
         }         }
Line 338: Line 350:
   openssl dgst -sha256 /path/to/user1.bin   openssl dgst -sha256 /path/to/user1.bin
  
 +==== Sharing ====
 +
 +Once you have registered a device in your account you have the option to share it to an other account.
 +To share a device both users need to be online at the same time.
 +User-A initiates the process and User-B has to accept it.
 +The whole process is carried out via WebSocket (secure/unsecure depending on your firmware).
 +
 +User-A sends an invitation message to User-B:
 +<file javascript user-a to server>
 +{
 +    "action": "share",
 +    "apikey": "6ffb86ec-2190-4ade-a6a9-7ead37a660fc",   # user api key from sender
 +    "deviceid": "10000xxxxx",                           # device id
 +    "sequence": "1474273634539",                        # milliseconds
 +    "userAgent": "app",
 +    "params": {
 +        "userName": "recipient@example.com",            # recipient
 +        "uid": "sender@example.com",                    # sender
 +        "deviceName": "Device0xxxxx"                    # device name
 +    }
 +}
 +</file>
 +
 +<file javascript server to user-b>
 +{
 +    "action": "share",
 +    "apikey": "6ffb86ec-2190-4ade-a6a9-7ead37a660fc",   # user api key from sender
 +    "deviceid": "10000xxxxx",                           # device id
 +    "sequence": "1474273634539",                        # milliseconds
 +    "shareUser": "f9f168bf-675a-4d88-91c6-4c5fe9f0be57",# user api key from recipient
 +    "userAgent": "app",
 +    "params": {
 +        "uid": "sender@example.com",                    # recipient
 +        "userName": "recipient@example.com",            # sender
 +        "deviceName": "Device0xxxxx"                    # device name
 +    }
 +}
 +</file>
 +//Notice:// The server used the provided email address of the recipient to lookup his user api key.
 +
 +User-b accepts the invitation:
 +<file javascript user-b to server>
 +{
 +    "apikey": "6ffb86ec-2190-4ade-a6a9-7ead37a660fc",   # user api key from sender
 +    "deviceid": "10000xxxxx",                           # device id
 +    "error": 0,                                         # no error
 +    "result": 2,                                        # success
 +    "sequence": "1474273634539",                        # milliseconds
 +    "userAgent": "app"
 +}
 +</file>
 +
 +<file javascript server to user-a>
 +{
 +    "apikey": "6ffb86ec-2190-4ade-a6a9-7ead37a660fc",   # user api key from sender
 +    "deviceid": "10000xxxxx",                           # device id
 +    "error": 0,                                         # no error
 +    "result": 2,                                        # success
 +    "sequence": "1474273634539",                        # milliseconds
 +}
 +</file>
 +
 +//Notice:// The sharing process is dealt out between two users and the server. The server is the router here.
 +If a device is not shared with your account, the server will not route through messages to the device.
 +On the other hand, the device does //not// know anything about it's owner or who is allowed to control it.
 +**Nothing holds you back from directly talking to a Sonoff device. It will accept any command from anyone.**
 ===== ESP8266 ===== ===== ESP8266 =====
 ==== Sonoff firmware ==== ==== Sonoff firmware ====
 The original Sonoff firmware is based on Espressifs SDK 1.4 that is for download here: [[http://bbs.espressif.com/viewtopic.php?p=3756#p3756|ESP8266_NONOS_SDK_V1.4.0_15_09_18]] The original Sonoff firmware is based on Espressifs SDK 1.4 that is for download here: [[http://bbs.espressif.com/viewtopic.php?p=3756#p3756|ESP8266_NONOS_SDK_V1.4.0_15_09_18]]
-I mirrored it here: [[:projects:sonoff:esp_iot_sdk_v1.4.0_15_09_18.zip|ESP8266_NONOS_SDK_V1.4.0_15_09_18]].+I mirrored it here: {{:projects:sonoff:esp_iot_sdk_v1.4.0_15_09_18.zip|ESP8266_NONOS_SDK_V1.4.0_15_09_18}}.
 ==== esptool.py ==== ==== esptool.py ====
-If you ever messed around and maybe even bricked your device (like I did), use esptool to flash the firmware again:+If you ever messed around and maybe even bricked your device (like I did), you will need to solder and use esptool to flash the firmware again:
  
-  esptool.py --baud 576000 write_flash 0x00000 bin/boot_v1.2.bin 0x01000 bin/upgrade/user1.2048.new.3.bin 0x81000 bin/upgrade/user2.2048.new.3.bin 0x1FC000 bin/esp_init_data_default.bin 0x1FE000 bin/blank.bin --flash_size 16m+  esptool.py --port /dev/cu.usbmodem1411 write_flash -fs 8m 0x00000 bin/boot_v1.4\(b1\).bin 0x01000 user1.1024.new.2.bin 0xFB000 bin/blank.bin 0xFC000 bin/esp_init_data_default.bin 0xFE000 bin/blank.bin
  
 ==== Further reading ==== ==== Further reading ====
   * [[http://smallbits.marshall-tribe.net/blog/2016/05/29/esp8266-pushing-ota-upgrades|Memory Layout]]   * [[http://smallbits.marshall-tribe.net/blog/2016/05/29/esp8266-pushing-ota-upgrades|Memory Layout]]
 +  * {{ :projects:sonoff:2a-esp8266-sdk_getting_started_guide_en.pdf |}}
 +  * {{ :projects:sonoff:2b-esp8266_non-os_sdk_iot_demo_guide_en.pdf |}}
 +  * {{ :projects:sonoff:99c-esp8266_fota_guide_en_.pdf |}}
projects/sonoff.txt · Last modified: 2016/09/19 20:19 by adm-jan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki