Hi everyone,
I have a gas meter based on a reedsensor and an ESP8266.
My ESP configuration looks like this:
globals:
- id: total_pulses
type: int
restore_value: false
initial_value: '367104'
binary_sensor:
- platform: gpio
id: internal_pulse_counter
pin:
number: GPIO5
mode: INPUT_PULLUP
name: "Gas-Impulszähler (ESPHome)"
filters:
- delayed_on: 10ms
on_press:
then:
- lambda: id(total_pulses) += 1;
sensor:
- platform: template
name: "Gaszählerstand [m³]"
device_class: gas
unit_of_measurement: "m³"
state_class: "total_increasing"
icon: "mdi:counter"
accuracy_decimals: 2
lambda: |-
return id(total_pulses) * 0.01;
ESP_LOGD("Gaszähler TAG", "Pulse bisher: %d", id(total_pulses));
- platform: template
name: "Gaszählerstand [kWh]"
device_class: gas
unit_of_measurement: "kWh"
state_class: "total_increasing"
icon: "mdi:counter"
accuracy_decimals: 2
lambda: |-
return id(total_pulses) * 0.01 * 11.5;
ESP_LOGD("Gaszähler TAG", "Pulse bisher: %d", id(total_pulses));
If I add the m³ sensor to the energy board it looks good.
If I add the kWh sensor, I get:
So somehow the Gas consumption accepts this sensor, but complaints about the wrong unit.
Any suggestions?
EDIT:
It seems though, that the energy dashboard is reporting anyway.