Skip to content

Commit

Permalink
bugfix totals
Browse files Browse the repository at this point in the history
  • Loading branch information
mhendriks committed Feb 28, 2024
1 parent c5d43e0 commit face737
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions p1-dongle-pro-h2o-v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ api:
id: reboot
- service: set_water_total
variables:
set_value: int
new_total: int
then:
- globals.set:
id: totalWaterUsage
value: !lambda 'return set_value;'
- pulse_meter.set_total_pulses:
id: h2o_pulse
value: !lambda 'return new_total;'

globals:
- id: totalWaterUsage
Expand All @@ -54,7 +54,7 @@ dashboard_import:

# Enable logging
logger:
level: ERROR
level: DEBUG

dsmr:
uart:
Expand Down Expand Up @@ -106,24 +106,12 @@ sensor:
internal_filter_mode: EDGE
icon: mdi:flash-outline
accuracy_decimals: 0
# total:
# name: "Water Total"
# id: h2o_total
# state_class: total_increasing
# icon: mdi:water
# unit_of_measurement: L
# accuracy_decimals: 0
- platform: template
name: "Watermeter total"
state_class: "total_increasing"
device_class: "water"
icon: mdi:water
update_interval: 1s
unit_of_measurement: L
accuracy_decimals: 0
lambda: |-
if (id(h2o_pulse).state > 0) id(totalWaterUsage) += 1;
return id(totalWaterUsage);
total:
name: "Water Total"
state_class: total_increasing
icon: mdi:water
unit_of_measurement: L
accuracy_decimals: 0

- platform: dsmr
# energy_delivered_lux:
Expand Down

0 comments on commit face737

Please sign in to comment.