skydiver / ewelink-api

eWeLink API for JavaScript
https://www.npmjs.com/package/ewelink-api
MIT License
265 stars 109 forks source link

Switching multi-channel devices #76

Open fakkio opened 4 years ago

fakkio commented 4 years ago

Hi everyone, I'm trying to toggle a multi-channel switch, but I get an error from the server. No problem using the official app. I'm using the library in the browser, I have no problem with other single-channel devices. The request-response pasted below: WS request:

{
   "action":"update",
   "deviceid":"10007b7e72",
   "apikey":"480837cb-aa7f-4b10-855b-327826fb3865",
   "selfApikey":"480837cb-aa7f-4b10-855b-327826fb3865",
   "params":{
      "switches":[
         {
            "outlet":0,
            "pulse":null,
            "switch":"on"
         },
         {
            "outlet":1,
            "pulse":null
         },
         {
            "outlet":2,
            "pulse":null
         },
         {
            "outlet":3,
            "pulse":null
         }
      ]
   },
   "sequence":1582712713914,
   "userAgent":"app"
}

WS response:

{
   "error":400,
   "deviceid":"10007b7e72",
   "apikey":"480837cb-aa7f-4b10-855b-327826fb3865",
   "sequence":"1582712713914"
}

I have no clue on what to do. I've tried to sniff official app traffic but i see only many strange symbols 😊. Can someone help me?

Fabio.