Gaser: Unterschied zwischen den Versionen

Zeile 16: Zeile 16:
  
  
[[Datei:gaser_pipicow.jpg]]
 
[[Datei:gaser_pipicow_top.jpg]]
 
  
== Hardware ==
+
==Hardware==
  
* Reed-Sensor
+
*Reed-Sensor
* Raspberry Pi Pico W
+
*Raspberry Pi Pico W
* Jumperwire
+
*Jumperwire
* Heißkleber
+
*Heißkleber
  
  
== Software ==
+
<gallery>
 +
Datei:gaser_pipicow.jpg
 +
Datei:gaser_pipicow_top.jpg
 +
</gallery>
 +
 
 +
==Software==
  
 
esphome
 
esphome
  
 
  <nowiki>
 
  <nowiki>
esphome:
+
  esphome:
  name: gaser
+
    name: gaser
 
+
 
rp2040:
+
  rp2040:
  board: rpipicow
+
    board: rpipicow
  framework:
+
    framework:
    # Required until https://github.com/platformio/platform-raspberrypi/pull/36 is merged
+
      # Required until https://github.com/platformio/platform-raspberrypi/pull/36 is merged
    platform_version: https://github.com/maxgerhardt/platform-raspberrypi.git
+
      platform_version: https://github.com/maxgerhardt/platform-raspberrypi.git
 
+
 
# Enable logging
+
  # Enable logging
logger:
+
  logger:
 
+
 
# Enable Home Assistant API
+
  # Enable Home Assistant API
api:
+
  api:
  encryption:
+
    encryption:
    key: "changeme"
+
      key: "changeme"
 
+
 
ota:
+
  ota:
  password: "ch"
+
    password: "ch"
 
+
 
wifi:
+
  wifi:
  ssid: !secret wifi_ssid
+
    ssid: !secret wifi_ssid
  password: !secret wifi_password
+
    password: !secret wifi_password
  use_address: 10.1.42.247
+
    use_address: 10.1.42.247
  # Enable fallback hotspot in case wifi connection fails
+
    # Enable fallback hotspot in case wifi connection fails
  ap:
+
    ap:
    ssid: "Gaser Fallback Hotspot"
+
      ssid: "Gaser Fallback Hotspot"
    password: "changeme"
+
      password: "changeme"
 
+
 
globals:
+
  globals:
  - id: total_pulses
+
    - id: total_pulses
    type: int
+
      type: int
    restore_value: True
+
      restore_value: True
    initial_value: '0'  # hier kann der Gaszählerstand in Pulsen initialisiert werden. Also Zählerstand 1234,56 m3 zu 12345 bei einem G4 mit Puls 0.1
+
      initial_value: '0'  # hier kann der Gaszählerstand in Pulsen initialisiert werden. Also Zählerstand 1234,56 m3 zu 12345 bei einem G4 mit Puls 0.1
binary_sensor:
+
  binary_sensor:
  - platform: gpio
+
    - platform: gpio
    id: internal_pulse_counter
+
      id: internal_pulse_counter
    pin:
+
      pin:
      number: GPIO28
+
        number: GPIO28
      mode: INPUT_PULLUP
+
        mode: INPUT_PULLUP
    name: "Live-Impuls"
+
      name: "Live-Impuls"
    filters:
+
      filters:
      - delayed_on: 10ms
+
        - delayed_on: 10ms
    on_press:
+
      on_press:
      then:
+
        then:
        - lambda: id(total_pulses) += 1;
+
          - lambda: id(total_pulses) += 1;
        - output.turn_off: led  # optional: für eine LED, die den Gaszählerpuls visualisiert
+
          - output.turn_off: led  # optional: für eine LED, die den Gaszählerpuls visualisiert
    on_release:
+
      on_release:
      then:
+
        then:
        - output.turn_on: led  # optional: für eine LED, die den Gaszählerpuls visualisiert
+
          - output.turn_on: led  # optional: für eine LED, die den Gaszählerpuls visualisiert
sensor:
+
  sensor:
  - platform: template
+
    - platform: template
    name: "Gasverbrauch"
+
      name: "Gasverbrauch"
    device_class: gas
+
      device_class: gas
    unit_of_measurement: "m³"
+
      unit_of_measurement: "m³"
    state_class: "total_increasing"
+
      state_class: "total_increasing"
    icon: "mdi:fire"
+
      icon: "mdi:fire"
    accuracy_decimals: 2
+
      accuracy_decimals: 2
    lambda: |-
+
      lambda: |-
      return id(total_pulses) * 0.1;
+
        return id(total_pulses) * 0.1;
# Optional: Diese LED soll blinken, sobald ein Signal vom Gaszähler erkannt wird
+
  # Optional: Diese LED soll blinken, sobald ein Signal vom Gaszähler erkannt wird
output:
+
  output:
  - platform: gpio
+
    - platform: gpio
    pin: LED
+
      pin: LED
    id: 'led'
+
      id: 'led'
 
+
 
</nowiki>
+
  </nowiki>

Version vom 2. März 2024, 21:03 Uhr

Crystal Clear action run.png
gaser

Status: stable

Gaser counter.png
Beschreibung Gaszähler Impulse auslesen
Autor: raphii wu|wu
PayPal Spenden für Gaser

Description

Der 'Gaser' ist ein kompaktes Gerät, das an Gaszählern befestigt wird, um Verbrauchsimpulse zu erfassen und den Gasverbrauch digital zu schätzen. Der Raspberry Pi Pico W ist mit ESPhome geflasht und im Home Assistant eingebunden. Unser Gaszähler hat einen Magnet an der ersten Dezimalstelle sitzen, der den Reed-Sensor beim Umschlagen auslöst.


Hardware

  • Reed-Sensor
  • Raspberry Pi Pico W
  • Jumperwire
  • Heißkleber


Software

esphome

  esphome:
    name: gaser
  
  rp2040:
    board: rpipicow
    framework:
      # Required until https://github.com/platformio/platform-raspberrypi/pull/36 is merged
      platform_version: https://github.com/maxgerhardt/platform-raspberrypi.git
  
  # Enable logging
  logger:
  
  # Enable Home Assistant API
  api:
    encryption:
      key: "changeme"
  
  ota:
    password: "ch"
  
  wifi:
    ssid: !secret wifi_ssid
    password: !secret wifi_password
    use_address: 10.1.42.247
    # Enable fallback hotspot in case wifi connection fails
    ap:
      ssid: "Gaser Fallback Hotspot"
      password: "changeme"
  
  globals:
    - id: total_pulses
      type: int
      restore_value: True
      initial_value: '0'  # hier kann der Gaszählerstand in Pulsen initialisiert werden. Also Zählerstand 1234,56 m3 zu 12345 bei einem G4 mit Puls 0.1
  binary_sensor:
    - platform: gpio
      id: internal_pulse_counter
      pin:
        number: GPIO28
        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
      unit_of_measurement: "m³"
      state_class: "total_increasing"
      icon: "mdi:fire"
      accuracy_decimals: 2
      lambda: |-
        return id(total_pulses) * 0.1;
  # Optional: Diese LED soll blinken, sobald ein Signal vom Gaszähler erkannt wird
  output:
    - platform: gpio
      pin: LED
      id: 'led'