Skip to content

Commit

Permalink
Fixes to get both web-based flash tool and OTA updates to work
Browse files Browse the repository at this point in the history
  • Loading branch information
dkerr64 committed Dec 13, 2024
1 parent bd3a096 commit cd63f37
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 74 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to `homekit-ratgdo` will be documented in this file. This pr

* Feature: Beeps during time-to-close delay
* Feature: Vehicle presence, arriving, departing sensing, and parking assist laser
* Bugfix: Web-based flash installer now working
* Bugfix: OTA update from GitHub now working
* Bugfix: Blue LED was not blinking
* Bugfix: Device name not initialized to default on startup
Expand Down
58 changes: 18 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
> [!IMPORTANT]
> This firmware is for the new ESP32-based RATGDO v32 (disco) series device. It does not work on the original ESP8266-based RATGDO v2.5 devices.
> This firmware is for the new ESP32-based RATGDO DISCO series device. It does not work on the original ESP8266-based RATGDO v2.5 devices.
> Information for the original devices can be found [here](https://github.com/ratgdo/homekit-ratgdo)
>
> **THIS IS EARLY FIRMWARE still under test.
> Future updates MAY include breaking changes reqiring a flash erase and re-upload.**
Expand Down Expand Up @@ -39,18 +40,17 @@ planned features, or to suggest your own.

## How do I install it?

Connect your RATDGO-DISCO to a computer with a USB cable and use the [online browser-based flash tool](https://ratgdo.github.io/homekit-ratgdo32/flash.html) to install the firmware.

> [!NOTE]
> The installation process is still being improved. You may need to reload the flasher tool page
> after each of the following steps in order to proceed.
> The browser must be able to access a USB serial device. Some browsers block USB access. The Google Chrome browser is known to work and is recommended.
For each of the following steps, use the [online browser-based flash tool](https://ratgdo.github.io/homekit-ratgdo32/flash.html):
After installing you must set the WiFi network and password. Using a laptop, phone or tablet search for WiFi network named _Garage Door ABCDEF_ where the last six characters are a unique identifier. Once connected use a browser to access http://192.168.4.1 and wait for it to display a list of WiFi networks to join.

* Install the HomeKit-RATGDO firmware, and then *wait 20 seconds*.
* Connect the RATGDO to WiFi
* Click "Visit Device", and then begin the process of adding a device to HomeKit. Scan the QR code,
or manually enter the setup code `2510-2023`.
After selecting the WiFi network the device will reboot and you can connect to it using a browser on your network at the address http://Garage-Door-ABCDEF.
Once the device is running you can change the name and add it to HomeKit by scanning the QR code.

That's it!
> [!NOTE] The manual setup code is `2510-2023`.
> [!IMPORTANT]
> If you experience very slow or poor connection accessing the ratgdo device web page then try moving the device further away from the garage door opener. Several users have reported that this can improve reliability of the connection. We do not know why this is the case but may suggest some RF interference between the door opener and the ratgdo device.
Expand Down Expand Up @@ -242,19 +242,10 @@ If you encounter a flash CRC error then please [open an issue](https://github.co

### esptool

[Espressif](https://www.espressif.com) publishes [esptool](https://docs.espressif.com/projects/esptool/en/latest/esp8266/index.html), a command line utility built with python. Esptool requires that you connect a USB serial cable to the ratgdo device. If you are able to install and run this tool then the following commands may be useful...

```
sudo python3 -m esptool -b 115200 -p <serial_device> verify_flash --diff yes 0x0000 <firmware.bin>
```
The above command verifies that the flash memory on the ratgdo has an exact image of the contents of the provided firmware binary file. If a flash CRC error was reported then this command will fail and list out the memory locations that are corrupt. This information will be useful to the developers to assist with debugging. Please copy it into the GitHub issue.

```
sudo python3 -m esptool -b 115200 -p <serial_device> write_flash 0x0000 <firmware.bin>
```
The above command will upload a new firmware binary file to the ratgdo device which will recover from the flash CRC error. This is an alternative to using the [online browser-based flash tool](https://ratgdo.github.io/homekit-ratgdo/flash.html) described above.
[Espressif](https://www.espressif.com) publishes [esptool](https://docs.espressif.com/projects/esptool/en/latest/esp8266/index.html), a command line utility built with python. Esptool requires that you connect a USB serial cable to the ratgdo device.

Replace _<serial_device>_ with the identifier of the USB serial port. On Apple MacOS this will be something like _/dev/cu.usbserial-10_ and on Linux will be like _/dev/ttyUSB0_. You should not use a baud rate higher than 115200 as that may introduce serial communication errrors.
> [!NOTE]
> The ESP32-based ratgdo firmware comprises multiple files. It is strongly recommended to use the [online browser-based flash tool](https://ratgdo.github.io/homekit-ratgdo32/flash.html) described above rather than use this command directly
## Command Line Interface

Expand Down Expand Up @@ -342,8 +333,7 @@ Uploads a new firmware binary file to the device and reboots. It can take some

### How can I tell if the ratgdo is paired to HomeKit?

Use the [online browser-based flash tool](https://ratgdo.github.io/homekit-ratgdo/flash.html), and follow the
"Visit Device" link. If you see a big QR code, the ratgdo is _not_ paired.
Connect a browser to your device at its IP address or host name (e.g. http://Garage-Door-ABCDEF). If you see a big QR code, the ratgdo is _not_ paired.

### I added my garage door in the Home app but can't find it

Expand All @@ -361,8 +351,7 @@ more details in the issue thread, but the short story is to consider changing th

### How do I re-pair my ratgdo?

Use the [online browser-based flash tool](https://ratgdo.github.io/homekit-ratgdo/flash.html), and follow the
"Visit Device" link. If you see a big QR code, the ratgdo is *not* paired. Click the _Reset HomeKit_ or _Un-pair
From the ratgdo device home page click the _Reset HomeKit_ or _Un-pair
HomeKit_ button, and then delete the garage door from within the HomeKit app (or vice versa, order
does not matter). Reseting or Un-pairing HomeKit will cause the ratgdo device to reboot. You can then re-pair the
device by adding it again as normal.
Expand Down Expand Up @@ -404,18 +393,10 @@ If you enable NTP time server then the actual UTC/GMT time of system logs is sho
HomeKit-RATGDO uses [PlatformIO](https://platformio.org/platformio-ide) for builds. You'll want to
install PlatformIO first.

After you've checked out this repo:

```
git clone [email protected]:ratgdo/homekit-ratgdo.git
```

Initialize the submodules from the root of the repo:
Check out this repo:

```
cd homekit-ratgdo
git submodule init lib/secplus/
git submodule update
git clone --recurse-submodules https://github.com/ratgdo/homekit-ratgdo32.git
```

The [`x.sh`](https://github.com/ratgdo/homekit-ratgdo32/blob/main/x.sh) script is my lazy way of not
Expand All @@ -424,11 +405,8 @@ having to remember PlatformIO-specific `pio` commands. The important ones are `r

## Who wrote this?

This firmware was written by [Brandon Matthews](https://github.com/thenewwazoo), with lots of
inspiration from the [esphome-ratgdo](https://github.com/ratgdo/esphome-ratgdo) project and critical
dependence on the [secplus decoder library](https://github.com/argilo/secplus).

Ongoing reliability improvements by [Jonathan Stroud](https://github.com/jgstroud/), and webpage design and implementation by [David Kerr](https://github.com/dkerr64)
This firmware was written by [David Kerr](https://github.com/dkerr64), with lots of help from contributors:
[Jonathan Stroud](https://github.com/jgstroud/) and [Donavan Becker](https://github.com/donavanbecker)

Special credit goes to the Chamberlain Group, without whose irredeemably stupid decision to [close their API to third parties](https://chamberlaingroup.com/press/a-message-about-our-decision-to-prevent-unauthorized-usage-of-myq),
this firmware would never have been necessary.
Expand Down
69 changes: 39 additions & 30 deletions docs/flash.html
Original file line number Diff line number Diff line change
@@ -1,42 +1,50 @@
<!DOCTYPE html>
<html>
<body>
<h1>ratgdo web installer for homekit integrations</h1>
<script
type="module"
src="https://unpkg.com/esp-web-tools@9/dist/web/install-button.js?module"
></script>
<style type="text/css">
* {
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}
</style>

<p>Write some expository text here. What do people need to know? Perhaps some pretty pictures
would be nice. People love pictures of things.</p>

<h4>MQTT:</h4>
<p>If you want to use <b>MQTT</b> instead of HomeKit, check out the <a href="https://paulwieland.github.io/ratgdo/" target="_blank">MQTT port</a> & <a href="https://github.com/PaulWieland/ratgdo">GitHub Repo</a>.</p>
<h4>ESP Home:</h4>
<p>If you want to use <b>ESPHome</b> with Home Assistant instead of HomeKit, check out the <a href="https://ratgdo.github.io/esphome-ratgdo/" target="_blank">ESPHome port</a> & <a href="https://github.com/ratgdo/esphome-ratgdo">GitHub Repo</a>.</p>
<body>
<h1>RATGDO DISCO web installer for HomeKit integrations</h1>
<script type="module" src="https://unpkg.com/esp-web-tools@9/dist/web/install-button.js?module"></script>
<style type="text/css">
* {
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}
</style>
<h4>HomeKit:</h4>
<p>This installer is for the ESP32-based RATGDO-DISCO board. It will not work with the original ESP8266-based RATGDO
board, for that you need to use the original
<a href="https://ratgdo.github.io/homekit-ratgdo/flash.html">ratgdo installer</a>
</p>
<p>Set WiFi network SSID and Password after installation by connecting a device to the RATGDO's hotspot, named
<i>Garage Door ABCDEF</i> (where last six characters are unique) and connect a browser to IP address
http://192.168.4.1
</p>
<h4>MQTT:</h4>
<p>If you want to use <b>MQTT</b> instead of HomeKit, check out the <a href="https://paulwieland.github.io/ratgdo/"
target="_blank">MQTT port</a> & <a href="https://github.com/PaulWieland/ratgdo">GitHub Repo</a>.</p>
<h4>ESP Home:</h4>
<p>If you want to use <b>ESPHome</b> with Home Assistant instead of HomeKit, check out the <a
href="https://ratgdo.github.io/esphome-ratgdo/" target="_blank">ESPHome port</a> & <a
href="https://github.com/ratgdo/esphome-ratgdo">GitHub Repo</a>.</p>

<p>For a comparison of available features for the different firmware options, please refer to the <a href="https://paulwieland.github.io/ratgdo/01_features.html">feature matrix</a>.</p>
<p>For a comparison of available features for the different firmware options, please refer to the <a
href="https://paulwieland.github.io/ratgdo/01_features.html">feature matrix</a>.</p>

<h4>Drivers</h4>
<p>If you can't connect to your ratgdo board make sure you have the right driver installed for the type of board you have.</p>
<ul>
<li>ratgdo v2.5i uses a CH340 USB to Serial chipset. [<a href="https://www.wch-ic.com/downloads/CH341SER_EXE.html" target="_blank">driver download</a>]</li>
<li>Most D1 Minis use an FTDI USB to Serial chipset. [<a href="https://ftdichip.com/drivers/vcp-drivers/" target="_blank">driver download</a>]</li>
</ul>
<h4>Drivers</h4>
<p>If you can't connect to your ratgdo board make sure you have the right driver installed for the type of board you
have.</p>
<ul>
<li>ratgdo v2.5i uses a CH340 USB to Serial chipset. [<a
href="https://www.wch-ic.com/downloads/CH341SER_EXE.html" target="_blank">driver download</a>]</li>
<li>Most D1 Minis use an FTDI USB to Serial chipset. [<a href="https://ftdichip.com/drivers/vcp-drivers/"
target="_blank">driver download</a>]</li>
</ul>

<h3>This may take a while!</h3>
<p>The setup process may take as long as a full minute, so please be patient.</p>

<esp-web-install-button
manifest="manifest.json"
></esp-web-install-button>
<esp-web-install-button manifest="manifest.json"></esp-web-install-button>
<script>
const button = document.querySelector('esp-web-install-button');
const button = document.querySelector('esp-web-install-button');
button.overrides = {
checkSameFirmware(manifest, improvInfo) {
const manifestFirmware = manifest.name.toLowerCase();
Expand All @@ -46,4 +54,5 @@ <h3>This may take a while!</h3>
};
</script>
</body>
</html>

</html>
4 changes: 2 additions & 2 deletions src/www/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ async function checkVersion(progress) {
if (latest) {
console.log("Newest version: " + latest.tag_name);
const asset = latest.assets.find((obj) => {
return (obj.content_type === "application/octet-stream") && (obj.name.startsWith("homekit-ratgdo"));
return (obj.content_type === "application/octet-stream") && obj.name.startsWith("homekit-ratgdo32") && obj.name.includes("firmware");
});
serverStatus.downloadURL = "https://ratgdo.github.io/homekit-ratgdo32/firmware/" + asset.name;
msg = "You have newest release";
Expand Down Expand Up @@ -631,7 +631,7 @@ async function firmwareUpdate(github = true) {
clearInterval(aniDots);
if (showRebootMsg) {
// Additional 10 seconds for new firmware copy on first boot.
countdown(rebootSeconds + 10, rebootMsg + "<br>RATGDO device rebooting...&nbsp;");
countdown(rebootSeconds, rebootMsg + "<br>RATGDO device rebooting...&nbsp;");
} else {
document.getElementById("updateDotDot").style.display = "none";
document.getElementById("updateDialog").style.display = "block";
Expand Down
4 changes: 2 additions & 2 deletions src/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,9 @@
<footer>
<div class="footer">
<p style="margin:0px;">For documentation and support see the <a
href="https://github.com/ratgdo/homekit-ratgdo">GitHub</a>
href="https://github.com/ratgdo/homekit-ratgdo32">GitHub</a>
page.<br>Copyright (c) 2023-24 <a
href="https://github.com/ratgdo/homekit-ratgdo/graphs/contributors">homekit-ratgdo
href="https://github.com/ratgdo/homekit-ratgdo32/graphs/contributors">homekit-ratgdo
contributors.</a><br>Licensed under terms of the <a
href="https://www.gnu.org/licenses/gpl-3.0.en.html">GPL-3.0
License.</a>
Expand Down

0 comments on commit cd63f37

Please sign in to comment.