Updating or downgrading the Gateway firmware¶
If you load the incorrect firmware you will brick your Gateway and you cannot access it anymore via the web interface. You have to use one of the other methods below to bring it back to life.
Do not perform a software update when you do not have physical access to the device. In case the update goes wrong, you need to use the USB connection on the Gateway. So if the Gateway is in a remote location, postpone the update until you are near the device.
EMS-ESP is under continuous development. There are often breaking changes in the code. This means that after an update some things work differently, or it does not behave in the way you expected anymore or some functions are deprecated. Please carefully read the changes on the repository before applying an update.
The Gateway as delivered to you is loaded with a recent version of the open-source EMS-ESP or EMS-ESP32 firmware from Proddy’s Github repository.
It is very easy to do firmware updates yourself via the web interface. Aside from stable releases you can also load beta versions (pre-releases) and you can also downgrade the firmware if needed.
When upgrading from v3.3 to v3.4 do the following steps after the update:
reload page in browser or close and reopen browser to update all scripts.
navigate to mqtt settings and disable mqtt-discovery, Click SAVE,
Wait 5 minutes (MINUTES not secondes),
Enable mqtt-discovery and click SAVE.
ww-entities are renamed to dhw, the above procedure ensures that the ww’s are removed and dhw’s are created.
Updating firmware via the web interface¶
To update the firmware first download the correct bin file from the firmware releases page of the correct software repository.
Now click on the ‘assets’ button. A number of files will appear. Select the bin file. If you have a Premium II or older Gateway, DO NOT upload this firmware, it will brick your device.
If you click on the (correct!) bin file, it will be downloaded to your pc. Now take note where this file is stored.
Next go to the Gateway web interface and select the firmware update page.
Click in the upload window and select the bin file you just downloaded and wait until the update is completed. Do NOT close the web page. After a minute or two refresh the page and now the new version should be displayed in the top left of the interface.
If you perform an update via the web interface, all settings are stored. However, sometimes settings may go corrupt and you have to configure EMS-ESP like new. EMS-ESP will default to the S32 board profile. If you have an E32 this will mean you’ll lose the Ethernet connection. You have to login via WiFi and manually changen the board profile to E32 again and reboot.
If your Gateway works fine and there are no significant new features, its not recommended to update the firmware just for the sake of updating. Some firmware versions are not stable, features might be missing, and it can give stability or other issues.
Using beta firmware¶
Its also possible to install beta versions via the web interface. However, in rare cases a wrong beta version may brick the Gateway and thus you cannot reach the web interface anymore. In that case you have to use Platform IO, NodeMCU/ESPFlasher flash tool or the Espressif ESPtool to write a stable firmware version to the Gateway. If you don’t know how to do this, its better to not install beta versions.
If for some reason you want to go back to a previous firmware version, use the method as described above to select a stable version on the firmware releases page and to upload it to the Gateway.
Building and loading firmware via Platform IO¶
Loading firmware via OTA (Over The Air)¶
You can update the firmware via a feature called OTA. This means ‘Over The Air’. You need to use espota.py (just Google it).
The basic command is:
espota.py --debug --progress --port 8266 --auth ems-esp-neo -i <IP address> -f <firmware.bin>
Uploading the firmware via ESP Flasher flashtool¶
First connect a USB cable to the PC and the Gateways’ internal USB connector. Set the correct COM port for the Gateway. If you do not know it find it with Device Manager. Sometimes there is no driver installed, or it is behaving incorrectly (Win10). The Gateway S32 has a Silabs CP2102 USB chip which is usually loaded correctly on Windows systems.
This method of flashing will also erase the whole flash and all settings. When the firmware update is ready, the board profile will be S32 by default and not E32. This means Ethernet is not working until you set it to E32 again. You have to change this to E32 in the web interface.
The 2022 model of the E32 has an internal micro USB port. Use this one to connect a cable to your pc.
The 2021 E32 model without a screw connector have no USB port. To program these E32 models, you need to insert the CH340 USB stick into the header on the Gateway board. See below.
Make sure you insert the USB stick like below. There is only one way it will fit nicely.
The CH340 driver is not always properly loaded in Windows 10. If no COM port shows up when you plugin the Gateway, the driver has failed to load. Reinstall the CH340 driver. Look at Sparkfun guide on installing the CH340 driver 4 for instruction on how to do so. Before installation remove the Gateway from the pc. After installation, reboot the pc.
E32 model 2021 has a small yellow jumper on the board. Set it over the two header pins. This jumper sets the chip into bootloader mode so you can load the firmware. After you have finished uploading the firmware, remove the jumper otherwise the Gateway will not reboot.
E32 Gateways with the internal USB port have an additional circuit to automatically set the E32 into bootloader mode. They do not have this jumper on board.
This CH340 stick or internal USB port can only be used for programming. After the firmware has been flashed, the Gateway will not start properly. Remove the CH340 stick or USB cable and connect it again to the service jack or the 12V power supply. Also do not forget to remove the yellow jumper otherwise the Gateway can’t boot.
If the LED does not blink at all, press the reset button on the Wemos. It should start blinking slowly. If it does not, the update failed.
If the update via the web interface has failed, try the NodeMCU flash tool, ESPTool or Platform I/O method. If that did not work or it is too difficult, contact me via the contact form on the webshop.
If Ethernet does not work anymore, you have to set the board profile to E32 and reboot.