ct-Open-Source / tuya-convert

A collection of scripts to flash Tuya IoT devices to alternative firmwares
MIT License
4.63k stars 498 forks source link

sonoff-minimal shouldn't be installed. #2

Closed SynAckFin closed 5 years ago

SynAckFin commented 5 years ago

The sonoff-minimal firmware isn't intended as an initial install. The documentation on the site states:

sonoff-minimal.bin = The Minimal version allows intermediate OTA uploads to support larger versions and does NOT change any persistent parameter. This version should NOT be used for initial installation.

I think the minimal gets all of its configuration information from the previous install of a sonoff-tasmota firmware but since at this point there is no previous install it wont do anything and as a result the device may get bricked.

Jason2866 commented 5 years ago

Yes, very bad idea! Never use minimal for initial flash! No settings can be saved or changed in minimal It is just a intermediate version to get the possibility to flash firmwares > 500k Use for initial flash http://thehackbox.org/tasmota/release/020300/sonoff-classic.bin Did make a PR https://github.com/ct-Open-Source/tuya-convert/pull/3

ctandi commented 5 years ago

Hello again,

I've added the minimal image because I had in mind that SonOTA used it as a temporary firmware after removing the original Sonoff firmware. Does the classic image create an access point after first-flash? This is quite important, since a lot of devices do not have a button and if, it's rarely connected to GPIO 0.

SynAckFin commented 5 years ago

Copied from #6

The sonoff-classic firmware goes into WPS config when it does not have any access point SSID and not into AP mode. This will cause problems for users whose router doesn't support this.

The sonoff.bin v6.4.1 firmware is to large and will be rejected.

I had the same issues when developing my own OTA process. In the end I had to go back to previous versions of sonoff.bin and settled on sonoff.bin v6.2.1 which is small enough to be loaded.

I would recommend you did the same.

SynAckFin commented 5 years ago

PS. Great job, once the choice of final firmware has settled down I'll be recommending your solution over mine.

ctandi commented 5 years ago

I still have to do our news page on this matter so I haven't got time to check this out: Is there a way to compile Tasmota so that it opens an Access Point after flash?

At first, I compiled the Arduino-Webupdater example, but in a softAP configuration. With that installed, I uploaded the sonoff-minimal (as it was stated in SonOTA that this would be a good way to go) which led to mixed results. I was able to configure it with an access-point and it would connect to it, but the first reboot it created an access-point again with the configuration I had made for the webupdater. Though the code running was that of Tasmota. I haven't had the time to get behind this issue.

SynAckFin commented 5 years ago

The firmware source code has a file called sonoff/my_user_config.h and here is a section of it:

#define WIFI_CONFIG_NO_SSID    WIFI_WPSCONFIG    // Default tool if wifi fails to connect and no SSID is configured
                                                 //   (WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_SERIAL)
                                                 //   *** NOTE: When WPS is disabled by USE_WPS below, WIFI_WPSCONFIG will execute WIFI_MANAGER ***
                                                 //   *** NOTE: When WIFI_MANAGER is disabled by USE_WEBSERVER below, WIFI_MANAGER will execute WIFI_SMARTCONFIG ***
                                                 //   *** NOTE: When WIFI_SMARTCONFIG is disabled by USE_SMARTCONFIG below, WIFI_SMARTCONFIG will execute WIFI_SERIAL ***

I believe that if you change it from WIFI_WPSCONFIG to WIFI_MANAGER then that will make creating an access point default behaviour when there is no SSID. NOTE: I have not tested this but will have a go at downloading and compiling it to see.

SynAckFin commented 5 years ago

I looked at the code but haven't tried any custom builds. @Jason2866 pointed out the sonoff-basic is up to date and is small enough to be flashed (and I've tested it). I've looked at the differences between the sonoff-basic and the standard sonoff and basic disables the following:

So it seems to be a good choice for the initial firmware.

ctandi commented 5 years ago

Thanks for helping us out with all that information. @merlinschumacher and I are still working on the newspages for the next issue. We'll get to this once we're done.

tburchhardt commented 5 years ago

I'm not sure this is related, but 3 hours ago (got everything fresh from the repository, including the sonoff-classic) I bricked 2 devices with a plain

curl http://10.42.42.42/flash3

one is a Blitzwolf SHP2, the other a Lingan SWA 1 … everything was working fine, for the latter I first did a "undo" which worked fine, restarted the process and after the "flash3" it's dead now, so is the SHP2 for which I didn't even try the "undo" first.

SynAckFin commented 5 years ago

The sonoff-classic attempts to connect to your network using WPS. This means you have to push that connect button on your WiFi access point and power your device on.

tburchhardt commented 5 years ago
      The sonoff-classic attempts to connect to your network using WPS. This means you have to push that connect button on your WiFi access point and power your device on.

Well, at least the device should react when I press the button even if not connected to the WIFI, not?

On both devices the LEDs are off (for the SHP2 the LED at least blinks for a split second when plugging it in) and nothing happens when I press the button.

SynAckFin commented 5 years ago

The button on the device may or may not have any effect. Its the button on your WiFi router that allows to connect devices that you have to press.

tburchhardt commented 5 years ago

I'm quite sure everyone who's fiddling around with that stuff here pretty well knows how to turn on WPS, absolutely no lecture needed here.

However, since I'm not that much experienced with the Tasmota firmware, I wasn't aware that button and LED don't work out of the box after flashing and since the guide I was following stated that I should see a new SSID and I didn't plus LED/button weren't working, I had to assume the devices were bricked.

Apparently at least the SHP2 wasn't, WPS did the trick and I got to configure it… still need to check the SWA 1, but will have to reassemble it first, already prepared it for flashing manually. ;-)

Thanks for the help, the Wiki should be updated once the sonoff-classic is put back on and tell people that instead of looking for a sonoff-xxxx SSID they have to use WPS to connect.