diff --git a/Gaszaehler.yaml b/Gaszaehler.yaml new file mode 100644 index 0000000..d9c2d49 --- /dev/null +++ b/Gaszaehler.yaml @@ -0,0 +1,74 @@ +esphome: + name: gaszaehler + friendly_name: gaszaehler + +esp8266: + board: esp01_1m + +# Enable logging +logger: + +# Enable Home Assistant API +api: + encryption: + key: "y6nV0x4PNt2d21qCeNEcatMiL4jQhnTQfsTKs8AP+sI=" + +ota: + - platform: esphome + password: "b90b4f3ab4a2d6afdcc80745409c5a2f" + +wifi: + ssid: !secret wifi_ssid + password: !secret wifi_password + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Gaszaehler Fallback Hotspot" + password: "NB2PMC3nIrgw" + +captive_portal: +# geklaut von https://be-jo.net/2022/02/home-assistant-gaszaehler-mit-esphome-auslesen-flashen-unter-wsl/ + +globals: + - id: total_pulses + type: int + restore_value: False + initial_value: '218244' # hier kann der Gaszählerstand initialisiert werden 2082663 + +binary_sensor: + - platform: gpio + id: internal_pulse_counter + pin: + number: GPIO5 + mode: INPUT_PULLUP + name: "Live-Impuls" + filters: + - delayed_on: 10ms + on_press: + then: + - lambda: id(total_pulses) += 1; + - output.turn_off: led # optional: für eine LED, die den Gaszählerpuls visualisiert + on_release: + then: + - output.turn_on: led # optional: für eine LED, die den Gaszählerpuls visualisiert + +sensor: + - platform: template + name: "Gasverbrauch" + device_class: gas + update_interval : 10s + unit_of_measurement: "m³" + state_class: "total_increasing" + icon: "mdi:fire" + accuracy_decimals: 2 + lambda: |- + return id(total_pulses) * 0.01; + +# Optional: Diese LED soll blinken, sobald ein Signal vom Gaszähler erkannt wird +output: + - platform: gpio + pin: GPIO0 + id: 'led' + + +