A collection of ini-files, scripts and links to smarten your gas or water-meter with arendst/Tasmota
- You have a gas or water meter equipped with a reed contact (or a similar device) to count pulses.
- You are willing to custom build TASMOTA
- Your home automation software speaks MQTT
- An ESP8266 based development board, such as the WEMOS-D1-mini.
The ini-file can be adapted to support other microcontrollers such as the ESP32. - A Micro-USB-Charger (for production use)
- a gas meter or water meter with a pulse output (such as a reed contact)
- A microcontroller case for the ESP8266 such as this one.
- Clone TASMOTA from GitHub
- Copy
user_config_override.h
from this repository intotasmota/
-subdirectory of your github-clone (replace the existing file). - Customize WiFi-settings, most importantly (
STA_*
) and MQTT-host (MQTT_HOST
) - If you want to customize
user_config_override.h
in a way that your own default script is compiled into the binary, useflatten_script.sh
to generate a string for the#PRECONFIGURED_SCRIPT
definition. - Build TASMOTA and flash ESP with your favourite IDE (such as PlatformIO 😉 )
- Connect reed-sensor to
D4 (GPIO2)
andGND
- Connect power (USB-Charger, for instance)
- Open Webbrowser and browse to
http://tasmoreed/
- Set initial value for the current meter reading ("Zählerstand") and the amount of volume flow per impulse (in case of water: liter/pulse)
- Make further customizations with the script-editor or settings page.
- If you need to reset the counter, open Tasmota-console and enter
Counter1 0
- By default TASMOREED publishes its data to
/tele/water/SENSOR
Variables for meter reading, volume flow per pulse and pulse counter are permanent variables and will be restored after a power-down or reboot...
The script provides 4 different sensor results:
total
: the present meter reading (should be equal to the physical meter)flow60s
: volume flow of the past 60 secondsflow60m
: volume flow of the past 60 minutes. The calculations are based on a moving window approach, the result is recalculated every minute.flow24h
: volume flow of the past 24 hours. The calculations are based on a moving window approach, the result is recalculated every 60 minutes.
Please note that
- Data will only be published, if either of the 4 values change.
- a value of
-1
indicates an invalid result (should only be published within the first 24 hours after a reboot or a previously edited script...)
Flow values can be used to detect a leaking hose pipe and trigger an alarm, for example.
Check issues on this repository.