Skip to content

Instantly share code, notes, and snippets.

@bessarabov
Created October 15, 2020 13:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bessarabov/b068578db61c9e0e6ed81070f0b11b7f to your computer and use it in GitHub Desktop.
Save bessarabov/b068578db61c9e0e6ed81070f0b11b7f to your computer and use it in GitHub Desktop.
input_number:
water_counter:
min: 0
max: 100000000
step: 10
unit_of_measurement: liter
icon: mdi:water
current_water_counter:
mode: box
min: 0
max: 100000000
unit_of_measurement: liter
icon: mdi:water
automation:
- id: increase_water_counter
alias: Increase water counter
trigger:
- platform: state
entity_id: binary_sensor.0x00158d0004470939_contact
to: 'off'
action:
- service: input_number.increment
data:
entity_id: input_number.water_counter
- id: set_water_counter
alias: Set water counter
trigger:
action:
- service: notify.bessarabov
data_template:
message: "Установка счетчика воды. Было: {{ states('input_number.water_counter') | int }} Стало: {{ states('input_number.current_water_counter') | int }} Разница: {{ states('input_number.current_water_counter') | int - states('input_number.water_counter') | int }}"
- service: input_number.set_value
data_template:
entity_id: input_number.water_counter
value: "{{ states('input_number.current_water_counter') | int }}"
utility_meter:
hourly_water:
source: input_number.water_counter
cycle: hourly
daily_water:
source: input_number.water_counter
cycle: daily
monthly_water:
source: input_number.water_counter
cycle: monthly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment