Utility meter and Esphome

Hi,

you should use the following YAML format for your filters

filters:
  - lambda: |-
      static float total_value = 0.0;
      total_value += x * 0.01;
      return total_value;
1 Like

Thanks for the reply. I thought thatā€™s what I had.

Wordblindness is topping me seeing the difference.

Add an indent under the lambda line.

Hy

Please can you tell me the name of magnetic sensor what you use?
How can i conected with d1mini?

Thx a lot

Hello, if the question regarding hardware was for me. I gave the answer Iā€™m a earlier post (September 2019)

i used a Wemos D1 with a A3214LUA-T Hall Effect Switch

I also gave all the explanation regarding the connections to the esp8266.

If needed I can post a picture of my connection pcb.

Hy ā€¦Thx a lot for answerd me ā€¦Apologize for my english.

Can you post one picture how connections with wemos 1 mini and the yaml file?

Thx a lot

I buy this sensor for amazon https://www.amazon.es/gp/product/B07CNDHTJP/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&th=1 i conected with the wemos gnd+3.3v+data(D1) but i dont receive anything

[07:03:44][D][sensor:131]: ā€˜Cubic meters usedā€™: Sending state 0.00000 mĀ³ with 3 decimals of accuracy
[07:03:54][D][pulse_counter:159]: ā€˜Cubic meters usedā€™: Retrieved counter: 0.00 pulses/min
[07:03:54][D][sensor:131]: ā€˜Cubic meters usedā€™: Sending state 0.00000 mĀ³ with 3 decimals of accuracy
[07:04:04][D][pulse_counter:159]: ā€˜Cubic meters usedā€™: Retrieved counter: 0.00 pulses/min
[07:04:04][D][sensor:131]: ā€˜Cubic meters usedā€™: Sending state 0.00000 mĀ³ with 3 decimals of accuracy
[07:04:14][D][sensor:131]: ā€˜Total mĀ³ā€™: Sending state nan mĀ³ with 3 decimals of accuracy
[07:04:14][D][pulse_counter:159]: ā€˜Cubic meters usedā€™: Retrieved counter: 0.00 pulses/min
[07:04:14][D][sensor:131]: ā€˜Cubic meters usedā€™: Sending state 0.00000 mĀ³ with 3 decimals of accuracy

Hi! Do you have any idea why template platform in your example returns NAN and pretty much doesnt work anymore in HA 2021.12.xx?
It has driven me nuts not being able to get your example working. Any template sensor fails to reference other sensor values with your lambda example

- platform: template
...
  lambda: |-
      static float total_value = 0.0;
      total_value += **id(gaz).state**;
      return total_value;
...