homebridge-ewelink
homebridge-ewelink copied to clipboard
It is recommended that you use websocket to get device status instead of requesting API
Hello,
There are some problems in the way of getting the device status of your project. Although the request device list (/api/user/device) can get all the device status, too many requests for the interface will cause great pressure on the coolkit server. It is recommended to use websocket to monitor and get the latest status of the device in real time.
Relevant document address: https://coolkit-technologies.github.io/apiDocs/findStatus_en.html
It can improve your project and hope to adopt it.
Thank you!
Hi carl, it's good to have an official API documentation! I would like to adopt the new API you've mentioned, however my ewelink device is out of order, and I don't have any other functional device to test right now. It would be hard (if not impossible) to develop such functionality without testing. Due to the virus outbreak I cannot buy a new device from taobao now, let's see if we can do this after things get back to normal.
Hi carl, it's good to have an official API documentation! I would like to adopt the new API you've mentioned, however my ewelink device is out of order, and I don't have any other functional device to test right now. It would be hard (if not impossible) to develop such functionality without testing. Due to the virus outbreak I cannot buy a new device from taobao now, let's see if we can do this after things get back to normal.
OK, I see, thank you for your reply.
Hi, Just wondered if this is still a “thing”? With guidance I would be able to help with the coding.
At present, we have two versions (v1 and v2) of the interface, but the document is currently only in Chinese, and the English part only has the v1 interface, which is still being translated.
The device data is "thing"
Hi, Just wondered if this is still a “thing”? With guidance I would be able to help with the coding.
@coolkit-carl There doesn't seem to be a way of getting a complete device list through the web socket?
@coolkit-carl There doesn't seem to be a way of getting a complete device list through the web socket?
Yes, it works with API, websocket is just to maintain two-way traffic.
@coolkit-carl going off topic here im sorry i don't know where else to ask. how can I send a request via the API to update the target temperature and humidity of the sonoff thermostats? I'm looking for the payload format particularly the payload.params = {} part... would you know? eg could be params.targetTemperature that needs to be sent? thanks
@coolkit-carl going off topic here im sorry i don't know where else to ask. how can I send a request via the API to update the target temperature and humidity of the sonoff thermostats? I'm looking for the payload format particularly the payload.params = {} part... would you know? eg could be params.targetTemperature that needs to be sent? thanks
Please tell me a device ID, I want to check the protocol of the device type it belongs to
@coolkit-carl its the TH10 and TH16 thermostat sensors.
@coolkit-carl its the TH10 and TH16 thermostat sensors.
Ok, I have found the relevant agreement documents. I am not sure if I can provide it to you. I need to ask my leader. (Expected to reply to you tomorrow)
@coolkit-carl its the TH10 and TH16 thermostat sensors.
Ok, I have found the relevant agreement documents. I am not sure if I can provide it to you. I need to ask my leader. (Expected to reply to you tomorrow)
i appreciate any help you can/are allowed to give!
It looks like (based on the old docs I could find) that the full device list is only available in the HTTP API, which is probably alright if you consider only populating the devices at the point the plugin is initialised. After that you can hit the WebSocket API to get the status for a device (I've got a branch that I'm working on with an experimental implementation of this, behind a feature flag).
This is going to require quite a bit of testing before it goes for a PR as I've refactored quite a bit of code to cut down on duplication, and I don't have all the devices I'd need to test this fully. Fans, temperature & humidity sensors are particularly worrying gaps.
@thepotterfamily generally "params" sent for an update looks to be the same as what you would get when you get the device status.
It looks like (based on the old docs I could find) that the full device list is only available in the HTTP API, which is probably alright if you consider only populating the devices at the point the plugin is initialised. After that you can hit the WebSocket API to get the status for a device (I've got a branch that I'm working on with an experimental implementation of this, behind a feature flag).
This is exactly how i have implemented it in my own fork of this project!
@thepotterfamily I did wonder after seeing your fork as a result of that PR someone created if we were heading in the same direction :)
I had started writing a new plugin from scratch in Typescript but then came back around to seeing how I could start with this plugin and incrementally refactor to get into a state where it could switch between the HTTP, WebSockets & Lan control APIs as desired.
@thepotterfamily I did wonder after seeing your fork as a result of that PR someone created if we were heading in the same direction :)
I had started writing a new plugin from scratch in Typescript but then came back around to seeing how I could start with this plugin and incrementally refactor to get into a state where it could switch between the HTTP, WebSockets & Lan control APIs as desired.
Ah if you ever feel like helping me out with my fork as well as this one... let me know!