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
projects:sonoff [2016/09/06 05:44] – [Further reading] adm-janprojects:sonoff [2016/09/19 20:19] (current) – [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 87: Line 87:
 //Note:// Not all hosts were found defined in the app. Some where discovered by sniffing the network traffic and will differ depending on your location. //Note:// Not all hosts were found defined in the app. Some where discovered by sniffing the network traffic and will differ depending on your location.
  
-Description         ^ DNS Name          ^ IP Address      Protocol/Ports    ^ +Hostname               ^ IP-Address     DNS    ^ Port   ^ Protocol   ^ Usage              ^ Description                                         
-apiHost             | api.coolkit.cc, eu-api.coolkit.cc    | 52.29.61.50     8080              | +| eu-disp.coolkit.cc     | 52.29.61.50    TRUE   8081   HTTP       device == 1.5.0    | dispatch/register device online, receive WS host    | 
-httpServer          api.coolkit.cc    | 52.29.61.50     | HTTPS via 8080    | +| eu-disp.coolkit.cc     | 52.29.61.50    | TRUE   | 443    | HTTPS      | device >= 1.5.2    | dispatch/register device online, receive WS host    | 
-dispatchHost        disp.coolkit.cc   | n/a     8080              +iotgo.iteadstudio.com  52.29.48.55    | FALSE  | 8081   | WS         device == 1.5.0    | WebSocket to control the device from apps           
-websocketHost       long.coolkit.cc   n/a     8080              | +iot.itead.cn           52.29.48.55    FALSE  443    WSS        device >= 1.5.2    secWebSocket to control the device from apps      | 
-deviceDispatHost    disp.coolkit.cc   | n/a     443               | +| dl.itead.cn            | 52.28.103.75   | FALSE  8088   HTTP       device >= 1.5.0    OTA firmware download                               | 
-otaHost             | ota.coolkit.cc    n/a     | 8080              | +| eu-ota.coolkit.cc      52.28.103.75   | TRUE   | 80     | HTTP       app >= 2.1.19      Check for updated OTA firmware                      | 
-EU OTA Host         | eu-ota.coolkit.cc | 52.28.103.75     80, 8088              | +| eu-ota.coolkit.cc      | 52.28.103.75   TRUE   8080   HTTPS      | app >= ?           | OTA other / scene                                   | 
-Dispatch Host       | eu-disp.coolkit.cc | 52.29.61.50     8081              | +| eu-api.coolkit.cc      | 52.29.61.50    TRUE   8080   HTTPS      app >= ?           | http://iotgo.iteadstudio.com/api                    | 
-deviceDispatHost       n/a (iotgo.iteadstudio.com| 52.29.48.55     443              |+| 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 317:
       "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 339:
   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 ====
projects/sonoff.1473140646.txt.gz · Last modified: 2016/09/06 05:44 by adm-jan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki