Gaser: Unterschied zwischen den Versionen
Wu (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung Markierung: visualeditor-switched |
Wu (Diskussion | Beiträge) Keine Bearbeitungszusammenfassung Markierung: visualeditor-switched |
||
| (Eine dazwischenliegende Version desselben Benutzers wird nicht angezeigt) | |||
| Zeile 10: | Zeile 10: | ||
[[Category:Software]] | [[Category:Software]] | ||
[[Category:Hardware]] | [[Category:Hardware]] | ||
[[Category:Infrastruktur]] | |||
[[Category:Homeassistant]] | |||
== Description == | == Description == | ||
| Zeile 16: | Zeile 18: | ||
== 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 | |||
rp2040: | 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 | # Enable logging | ||
logger: | logger: | ||
# Enable Home Assistant API | # Enable Home Assistant API | ||
api: | api: | ||
encryption: | |||
key: "changeme" | |||
ota: | ota: | ||
password: "ch" | |||
wifi: | 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: | 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: | 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: | 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 | # Optional: Diese LED soll blinken, sobald ein Signal vom Gaszähler erkannt wird | ||
output: | output: | ||
- platform: gpio | |||
pin: LED | |||
id: 'led' | |||
</nowiki> | </nowiki> | ||
Aktuelle Version vom 2. März 2024, 19:16 Uhr
Status: stable | |
|---|---|
| Beschreibung | Gaszähler Impulse auslesen |
| Autor: | raphii wu|wu |
| PayPal | |
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'

