i have to admit, the MQTT part is not complicated at all but in the same time is hard to ignore the fact that trying to evolve your idea you will inevitably run in HA-like code rules and here’s why: if you want to keep a good device support you/me will have to split the ewelink login/devices part into a separated library (just like HA requires), after that there’s the devices exposing part to MQTT (again, just like HA) and last but not least you need to write some automation with these new toys (sounds familiar?)
i get why you choose to move everything into simpler scripts, i’ve done it the same for a while (before this i was controlling the ewelink devices with Alexa API but i decided to take it up a notch after i discovered HA, because it was too messy and hard to maintain)
also, i’m pretty sure by now someone else already forked this component for openhab and/or domoticz if not, i might take it up as a challenge once i’m content enough of the state of current component.
Hi @peterbuga
I thank you for your great work.
I am new here
all my Sonoff are working fine on Home Assistant
I know nothing about python language that’s why I am asking if it is possible to print the sonoff-debug >devices.json without hiding all secret data to keep it safe as a detail reference.
data = re.sub(r'"phoneNumber": ".*"', '"phoneNumber": "[hidden]",', data)
data = re.sub(r'"name": ".*"', '"name": "[hidden]",', data)
data = re.sub(r'"ip": ".*",', '"ip": "[hidden]",', data)
data = re.sub(r'"deviceid": ".*",', '"deviceid": "[hidden]",', data)
data = re.sub(r'"_id": ".*",', '"_id": "[hidden]",', data)
data = re.sub(r'"\w{2}:\w{2}:\w{2}:\w{2}:\w{2}:\w{2}"', '"xx:xx:xx:xx:xx:xx"', data)
data = re.sub(r'"\w{8}-\w{4}-\w{4}-\w{4}-\w{12}"', '"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"', data)
data = re.sub(r'"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z"', '"xxxx-xx-xxxxx:xx:xx.xxx"', data)
@peterbuga
I am using an application called BLYNK for years now because of its nice GUI.
to see my sonoff data on Blynk I change the sonoff original firmware to TASMOTA to be able to use MQTT publish and subscribe message protocol. Hacking the new ITEAD Studio - Sonoff S31
I am asking if there is an easy way to communicate with BLYNK app like you did with HA without changing the sonoff FW
thanks a lot
@Ze_Pico read the last 10+ or so replies from here regarding the MQTT part.
tl;dr: unless you want to fork the code and go in a direction similar with what @quarx started, i would not hold my breath for MQTT support (or better said MQTT-bridge) anytime soon.
i see you’re comfortable with flashing sonoff devices, why not stick with that?
@e-budianto could you explain what and how you done to solve this problem*? I´m have the same issue, I tried a lot of things/times (reinstall rpi2 and rp3, with hassio and raspbian + HA).
I really appreciate and thank you your help.
Note: I tried… pip3 install uuid / pip3 install websocket-client / change dns at resolv.conf. But not working yet.
requests.exceptions.ConnectionError: HTTPSConnectionPool(host=‘us-api.coolkit.cc’, port=8080): Max retries exceeded with url: /api/user/login (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x733416f0>: Failed to establish a new connection: [Errno -3] Try again’))
If pihole is blocking a connection, then the site you are trying to connect to is probably on your pihole’s blacklist, ie it is a known advert or tracking domain/host.
@nickrout thank you.
At this point I don’t want understand, I’ll just accept!
I did not have the pihole instaled. So I instaled and add “us-api.coolkit.cc” as whitelist and after that, everything works.
glad you finally make it!, we have same error message but slightly different case, in my case is because i was running pihole and change dns routing of my router to my pihole, this component somewhat considered i was using proxy, and it couldn’t access internet, but I can access coolkit from web browser, so definitely not because of whitelist/blacklist problem. In you case it seems somewhere has blocked access to us-api.coolkit.cc
Hi gents, I have just upgraded to 0.89 and it looks like the custom components folder structure has changed. I tried to move the whole set of scripts inside a “sonoff” directory but it did not make the trick. Any clues?
your request it’s a highly unusual one around here
next, i might say something terrible stupid or maybe drop the answer you’re looking for!
while developing this component i realised that the ewelink app at every login queries the attached devices for new update data under this format:
one could craft a request reporting a lower version of the FW for a specific device, in order to get a download fw-url for that device (i tested it and it works! what’s even funnier is that i can get the last update url even for devices that are not in my account using the pre-known deviceid). what baffles me is why there are 2x download urls and how they are supposed to get downloaded (and used), i need the headers to know how to send the “digest” auth (the download request from the device needs to be captured. basically one needs to dump current fw and try to update, if that doesn’t work restore the dump and start over with a new capture method)
i don’t have a super-basic-cheap usb-ttl to do all the steps above, nor i have much of intention to do it (i do have have a raspberry pi but not have the required cables/headers )
if this one can be cracked in theory everyone could return to original firmware making the above tutorials sort of obsolete (sorry @Ze_Pico) just imagine that
ps: in case you don’t know your deviceID or you don’t have it attached in your eWeLink account anymore, you can open the physical device and should be written somewhere in there (just checked on one device of mine)
anyone else interested in restoring original firmware?