«», ( ). — , , ( — 3 10 ).
, GND GPIO .
ESPHome :
binary_sensor:
- platform: gpio
name: "WaterCounter"
id: counter
pin:
number: GPIO2
mode: INPUT_PULLUP
Home Assistant :
(counter),
(, «» ). — counter, ESPHome, sensor, counter ( ).
2 — , «». , , .
( automations.yaml )- alias:
trigger:
- entity_id: binary_sensor.watercounter
platform: state
from: 'on'
to: 'off'
action:
- data:
entity_id:
- counter.my_water_counter
service: counter.increment
- alias: 1
trigger:
- entity_id: binary_sensor.watercounter
platform: state
from: 'on'
to: 'off'
condition:
- condition: state
entity_id: switch.sistema_poliva_liniia_1
state: 'on'
action:
- data:
entity_id:
- counter.my_water_line1, counter.my_water_line1t
service: counter.increment
configuration.yaml +
sensor:
- platform: template
sensors:
water_counter:
unit_of_measurement: 'M3'
value_template: "{{ (states('counter.my_water_counter')| float)/1000 }}"
counter:
my_water_counter:
initial: 2.667
step: 10
my_water_line1:
name: " 1 ()"
initial: 0
step: 10
my_water_line1t:
name: " 1 ()"
initial: 0
step: 10