skydiver / ewelink-api

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

SONOFF RF_Bridge change state (or toggling) #178

Open alessandronocera89 opened 2 years ago

alessandronocera89 commented 2 years ago

Hi, there is a way to handle the state change of the SONOFF RF_BRIDGE that have multiple commands? I was wondering if the setDevicePowerState method can work or also the toggleDevice but in my response I've strange error and the message is not clear:

{
    "error": false
}

I don't know if there is a chance to trigger that command through this package but for sure the API exists (Alexa triggers that commands by voice so I guess eWeLink API exists).

This is the getDevices response and as you can see I've the RF_Bridge device:

... "params": { "bindInfos": { "alexa": [ "some alphanumeric things" ] }, "sledOnline": "on", "init": 1, "fwVersion": "3.3.0", "rssi": -68, "version": 8, "staMac": "mac address stuff", "setState": "arm", "rfList": [ { "rfChl": 0, "rfVal": "some alphanumeric things" }, { "rfChl": 1, "rfVal": "some alphanumeric things" } ], "cmd": "trigger", "rfChl": 0, "rfTrig0": "2022-05-28T06:42:53.000Z", "rfTrig1": "2021-01-02T11:55:22.000Z" }, "createdAt": "2019-11-28T17:01:04.711Z", "__v": 0, "onlineTime": "2022-05-20T09:45:55.880Z", "ip": "87.7.42.40", "location": "", "offlineTime": "2022-05-20T08:41:05.682Z", "tags": { "zyx_info": [ { "remote_type": "2", "name": "Rimessa", "buttonName": [ { "0": "button 1" }, { "1": "button 2" } ] } ] }, "deviceStatus": "", "sharedTo": [], "devicekey": "8dd5c49c-and other stuff", "deviceUrl": "https://eu-api.coolkit.cc/api/detail/5a2e1b360cf772f92c342f01_en.html", "brandName": "Sonoff", "showBrand": true, "brandLogoUrl": "https://eu-ota.coolkit.cc/logo/m6N8zJB0O3EVvhCei6zCPStFeKYKAzSa.png", "productModel": "RF_Bridge", "devConfig": { "remoteInfos": [ { "numberOfRemote": 16, "fwVersion": "2.7.0" } ] }, "uiid": 28 } ...

Any kinda of help will be appreciate a lot! Thanks guys!

Turcheg commented 1 year ago

I'm not able to toggle sonoff rf bridge @skydiver

Turcheg commented 1 year ago

@alessandronocera89 I have managed to control my RF bridge with help of ewelink-api. Here you can find the implementation: https://github.com/Turcheg/tg-shlagbaum/blob/master/src/app.ts#L235