Closed klein0r closed 2 years ago
dns-sd -B _ewelink._tcp
(on MacOS)
returns
Timestamp A/R Flags if Domain Service Type Instance Name
18:07:10.715 Add 2 5 local. _ewelink._tcp. eWeLink_1000900d70
Since I know the instance
dns-sd -L "eWeLink_1000900d70" _ewelink._tcp.
(on MacOS)
returns
18:14:12.328 eWeLink_1000900d70._ewelink._tcp.local. can be reached at eWeLink_1000900d70.local.:8081 (interface 5)
txtvers=1 id=1000900d70 type=diy_plug apivers=1 encrypt=false iv=NTczMDkwMjEzMTMxOTEyNQ== seq=7 data1=\{\"switch\":\"off\",\"startup\":\"off\",\"pulse\":\"off\",\"sledOnline\":\"on\",\"pulseWidth\":500,\"rssi\":-68\}
But this tells me port 8081 (which is not responding by using curl to communicate with the HTTP api)
Did you check the original code as reference ? https://github.com/itead/Sonoff_Devices_DIY_Tools/blob/master/code/lan_ewlink_api.py#L456 ??
Yes of course. But nothing is responding. Even switching on and off results in a timeout...
Do not power down the equipment! Swiping third-party firmware requires networking (used to unlock devices) Does your hotspot have Internet access? You can open the tool and try again.
@ZZLinvec I've tested every possible combination. Both devices have Internet Access, mDNS and ping is working.
Everything seems to be correct, but the HTTP-API is not responding. The DIY mode is way to complicated right now. I'm a software developer and I was not able to flash a new firmware with your tools within 5 hours. How should a "normal" user achieve that? I will use the normal header pins now. That process is finished within minutes.
You still can't control it with tools?
I can switch it on and off with the tools. But I'm not able to flash new firmware...
During the upgrade, the device needs to connect to the server. Whether the current hotspot is connected to the network?
During the upgrade, the device needs to connect to the server.
Seriously? Why?! But yes, there was a working internet connection available.
Conclusion: The DIY mode is totally over engineered. Don't try to use it - to many pitfalls. Just use the normal pin headers to flash it within seconds...
Conclusion: The DIY mode is totally over engineered. Don't try to use it - to many pitfalls. Just use the normal pin headers to flash it within seconds...
Yeah, Sonoff - please make DIY useful!
I should have read this early. This sonoff "diy" mode is just a pain in the arse... @ZZLinvec
I'm going to switch to shelly.... price difference is small but time is priceless.
Please tell me what kind of device or function you want
@rradar
@ZZLinvec Easy. The DIY-Jumper is a great idea. After setting that jumper, just start the sonoff in access point mode and offer a html website to set
No additional tools, no cloud account necessary, easy to use and it will work on any operating system
{"downloadUrl": "http://files.haus-automatisierung.com/sonoff-minimal.bin","sha256sum":
I had the hardest time flashing this device as well. I had to read the source code before I got that eureka moment.
YOU MUST RE-HOST the flash binary on an HTTP server on your local network to flash the device. It WILL NOT flash from an internet source!!!!!! And the device will not give you any indication that was the issue!
https://github.com/itead/Sonoff_Devices_DIY_Tools/blob/master/code/lan_ewlink_api.py#L101 def set_ota_flash(self,info):Set the firmware download address on the device LAN**
My Steps
To unlock the device and per the source code "equipment is no longer under warranty"
$ curl -X POST -d '{"deviceid":"","data":{}}' http://192.168.1.22:8081/zeroconf/ota_unlock
Verify look for otaUnlock = true
$ curl http://192.168.1.22:8081/zeroconf/info -XPOST --data '{"deviceid":"","data":{}}'
{"seq":24,"error":0,"data":"{\"switch\":\"off\",\"startup\":\"stay\",\"pulse\":\"off\",\"pulseWidth\":500,\"ssid\":\"XXX\",\"otaUnlock\":true}"}
Please note: JSON "data" element is a string not an object per the 1.4 spec. So, any parsing needs to support both data: "{}" and data: {} formats. For an example see the Perl lib https://metacpan.org/pod/Power::Outlet::SonoffDiy
$ curl http://192.168.1.22:8081/zeroconf/ota_flash -XPOST --data '{"deviceid":"","data":{"downloadUrl":"http://192.168.1.4/tasmota/tasmota-lite.bin","sha256sum":"adda99154658eb1d5c263abfd10c572f45e1cc813e37e3390e879e1b670cb9f0"}}'
{"seq":2,"error":0}
Other sites say do NOT use sonoff-minimal.bin. So, I would not use that either.
thanks @mrdvt92 I was going through the same process and you saved me a lot of time.
I agree with the all above it works really bad...! Just imagine this doesn't work, the json parser :)
curl http://$device_url/zeroconf/ota_flash -X POST \
-d '{"deviceid": "$device_id",
"data": {"downloadUrl": "http://$server_ip:38181/tasmota.bin" , \
"sha256sum": "$shasum" } \
}'
Though
curl http://$device_url/zeroconf/ota_flash -XPOST \
-d '{"deviceid":"$device_id","data":{"downloadUrl":"http://$server_ip:38181/tasmota.bin","sha256sum":"$shasum"}}'
worked at least I got {"seq":5,"error":0}
, I removed all the spaces, lol... Maybe at least ITEAD should care about the docs more.
@dennybaa Seriously? That would explain why I was unable to flash a new firmware with my curl request...
Are you developing a bash script for the flashing process?
Are you developing a bash script for the flashing process?
I was thinking about building a Perl script (Perl runs on everything) that would do something like this:
script.pl [-u url] $sonoffDiy_id_address
I think the hardest part would be ensuring the Perl web server supports the "range" requirement. If that's really needed. I only have one mini left with SonofDiy firmware, And, since it's a one-way street, there is no way to go back to re-test.
I also have updated the documentation on my fork on Github
@klein0r Hey. Yes here it's https://gist.github.com/dennybaa/bfa002e5b3acd38b8f68e4555aaf8eac. In fact there was a problem with the payload. Anyways the flash API method does not validate the JSON and the process hangs forever( I was able to flash 1 of 5 sonoff minis successfully, 4 of them were bricked after the DIY flash, so I had to solder lol and use tasmotizer to flash :)) So DIY mode is really buggy. Be prepared for a brick. PS. all of the devices had stock 6.3.0.
I found a solution that seems to work
Place your binary file(s) on a public accessible network folder on the network and select the binary from that network share !
I finally did it. I am on a M1 Mac, so i can not use DIY Tools (some videos i saw did it using that tool).
What i had to do, is to create a local server on my machine that Accepts the range header. That was the tricky part. Find a tool that accepts that header out of the box.
I just made a Node.js express server to serve the static tasmota-lite.bin
file. That should do the trick.
I created a server
folder and inside:
mkdir server
cd server
npm install express
touch index.js
Then i created a index.js
file with this:
const express = require('express');
const app = express();
const PORT = 3000;
app.get('/', (req, res) => {
res.send('Hello World!');
});
app.use(express.static('public'));
app.listen(PORT, () => console.log(`Server listening on port: ${PORT}`));
Then I started the server:
node index.js
Finally, i created a public
folder inside my server
folder with the tasmota-lite.bin
file. Then i just used POSTMAN to request the sonofff to update the firmware:
Note: That 172.20.10.6 was mi local network IP. I was connected to my iPhone on a network called sonoffDiy
and password 20170618sn
on both my computer and the sonoff mini R2. I did not tried to make this process conneted in my wifi network, but i think it should work as well.
I`ve just created a Node.js Tasmota installer :)
Check it out: https://github.com/freshworkstudio/node-tasmota-installer
Just run on your machine and follow the wizard:
npx tasmota-installer
hi, i had problem in turn basic R3 into a DIY mode. I did all steps to get into DIY mode but it didn't respond. I deleted the device in eWeLink App. I did all steps again and tachannnnnnn , it works Maybe was that all your problem like klein0r
hi, i had problem in turn basic R3 into a DIY mode. I did all steps to get into DIY mode but it didn't respond. I deleted the device in eWeLink App. I did all steps again and tachannnnnnn , it works Maybe was that all your problem like klein0r
unbelievably, this worked. it seems that deleting the ewelink app resets the device to factory settings. I was able to flash finally using the tool from @gonzunigad on my Mac. Thank you for that tool! it rocks
Just received my new Sonoff R3. After that:
That's it. But that seems to be the dead end. Issues:
curl -d '{"sequence": "1561217426","deviceid": "1000900d70","encrypt": false,"data": {"downloadUrl": "http://files.haus-automatisierung.com/sonoff-minimal.bin","sha256sum": "c22c9d136e3d449e317e9cee4f538bb0fb1b1c9b5c187ecb0a78378d2d410c6e"}}' -H "Content-Type: application/json" -X POST http://192.168.179.21:8081/zeroconf/ota_flash
What is the correct port? Port 80 and 8081 is not responding.