This is a ESPHome based custom firmware for Gasleser, a reed sensor for Gas Meters.
TLDR: Either
- download firmware from the releases page, connect via USB-C, flash via web.esphome.io
or
- use yaml directly in your existing ESPHome to flash your device.
WARNING:
Consider backing up your original firmware first (e.g. using
esptool read-flash), otherwise there's no way back.
- Resilient inpulse counting
- Trivial home assistant integration
- Setting total value, impulse directly via web-interface or home assistant
You can either flash a pre-built release, or download and edit the gasleser.yaml in your existing esphome.
If you just want to download the firmware and flash it directly, download the firmware.bin from
releases page and skip to step 3.
Otherwise, download and edit the following values in yaml file:
Ithe substitut ions section at the very top:
wifi_ssid&wifi_password: Your WiFi credentials.api_key: Generate a key (e.g. here) and paste it. This is important for encryption with Home Assistant.web_password: A password of your choice for accessing the device via a browser.
If you are not using Home Assistant and want to send data via MQTT to a broker (ioBroker, NodeRED, etc.):
- Enter your broker IP in
mqtt_broker. - Remove the hashtags
#before themqtt:block (lines 47-52) to uncomment it.
Connect the ESP32-C6 to your computer. Important: Hold down the reset button while plugging in the USB cable and keep holding it for 2-3 seconds to ensure the chip enters flash mode.
Choose one of the following methods:
- Option A: Via Browser (Easiest)
- Go to web.esphome.io.
- Click Connect and select the COM port of your ESP.
- Select Install and upload the firmware downloaded from the releases page.
- Option B: Via Home Assistant
- Install the official ESPHome Add-on from the Home Assistant Add-on Store if you haven't already.
- Go to the Add-on dashboard -> + New Device.
- Select "Open ESPHome Web" (if connected via USB to the server) or prepare the config and select "Install" -> "Plug into this computer" (if on your PC).
- Option C: Fallback (If Web Installer/Reset fails)
If the browser does not recognize the chip or the upload hangs, use the command line tool
esptool:
- Compile the firmware in ESPHome and select Download -> Modern Format (.bin) (factory format).
- Install esptool on your PC (usually via Python:
pip install esptool). - Flash the file manually via command line (replace
COMXwith your actual port):
esptool.py -p COMX write_flash 0x0 gas-meter-factory.bin
Once flashed and connected to WiFi, you don't need to re-program the device to set the counter. You can do this directly in your browser:
- Open your browser and go to
http://gas-meter.local(or the IP address of the ESP). - Log in (Username:
admin, Password: The one you set inweb_passwordabove). - You will see the sensor values and two input fields:
- Gas Meter Factor: Enter how many m³ equal one pulse here (usually
0.01or0.1). This value is saved permanently. - Set Gas Meter Total: Go to your basement, check the physical meter (e.g. 12345.67), and type exactly that number into the field. Press Enter/Set.
The device will immediately adopt this value as the starting point for Gas Total and count up from there. Thanks to restore_value: true, this value is preserved even after a power outage.