esphome: name: 8266-test-module friendly_name: 8266 Test Module esp8266: board: esp01_1m # Enable logging logger: # Enable Home Assistant API api: encryption: key: "" ota: password: "" wifi: ssid: !secret wifi_ssid password: !secret wifi_password # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "8266-Test-Module" password: "" captive_portal: globals: - id: gas_impulses type: int restore_value: false # if set to false, the value will be 0 at reboot initial_value: '9754' binary_sensor: - platform: gpio id: gas_impulse internal: true pin: number: GPIO4 mode: INPUT_PULLUP inverted: true filters: - delayed_off: 0.10 s on_press: then: - lambda: id(gas_impulses) += 1; sensor: - platform: pulse_meter name: "Gas Used" id: pulse_gas_meter unit_of_measurement: 'm³/min' internal_filter: 0.10 s timeout: 2 min state_class: measurement device_class: gas icon: mdi:meter-gas #accuracy_decimals: 2 pin: number: GPIO5 mode: INPUT_PULLUP inverted: true filters: # 1 imp / 0.1 m³ = 10 imp / m³ (in my case); gas_imp_value = 10; - lambda: return x * (1.0 / 100); - platform: template name: "Boiler Consumption Total" id: boiler_gas_consumption_total unit_of_measurement: 'm³' icon: mdi:meter-gas-outline state_class: total_increasing device_class: gas accuracy_decimals: 2 lambda: return id(gas_impulses) * (1.0 / 100); update_interval: 10 s