Skip to content

Instantly share code, notes, and snippets.

@bessarabov
Created August 3, 2020 16:43
Show Gist options
  • Save bessarabov/f1a8254ca37d3fb2f0a09769f821d195 to your computer and use it in GitHub Desktop.
Save bessarabov/f1a8254ca37d3fb2f0a09769f821d195 to your computer and use it in GitHub Desktop.
- type: 'custom:bar-card'
entities:
- entity: sensor.water_filter_1_usage
name: Filter 1
icon: 'mdi:filter'
decimal: 1
- entity: sensor.water_filter_2_usage
name: Filter 2
icon: 'mdi:filter'
decimal: 1
- entity: sensor.water_filter_3_usage
name: Filter 3
icon: 'mdi:filter'
decimal: 1
- type: entities
show_header_toggle: false
entities:
- entity: input_text.water_filter_1_name
- entity: input_datetime.water_filter_1_install_date
- entity: input_number.water_filter_1_capacity
- entity: input_number.water_filter_1_install_counter_value
- type: divider
- entity: input_text.water_filter_2_name
- entity: input_datetime.water_filter_2_install_date
- entity: input_number.water_filter_2_capacity
- entity: input_number.water_filter_2_install_counter_value
- type: divider
- entity: input_text.water_filter_3_name
- entity: input_datetime.water_filter_3_install_date
- entity: input_number.water_filter_3_capacity
- entity: input_number.water_filter_3_install_counter_value
input_text:
water_filter_1_name:
water_filter_2_name:
water_filter_3_name:
input_datetime:
water_filter_1_install_date:
has_date: true
has_time: false
water_filter_2_install_date:
has_date: true
has_time: false
water_filter_3_install_date:
has_date: true
has_time: false
input_number:
water_filter_1_capacity:
min: 0
max: 100000000
step: 1
unit_of_measurement: liter
icon: mdi:filter
mode: box
water_filter_2_capacity:
min: 0
max: 100000000
step: 1
unit_of_measurement: liter
icon: mdi:filter
mode: box
water_filter_3_capacity:
min: 0
max: 100000000
step: 1
unit_of_measurement: liter
icon: mdi:filter
mode: box
water_filter_1_install_counter_value:
min: 0
max: 100000000
step: 1
unit_of_measurement: liter
icon: mdi:filter
mode: box
water_filter_2_install_counter_value:
min: 0
max: 100000000
step: 1
unit_of_measurement: liter
icon: mdi:filter
mode: box
water_filter_3_install_counter_value:
min: 0
max: 100000000
step: 1
unit_of_measurement: liter
icon: mdi:filter
mode: box
sensor:
- platform: template
sensors:
water_filter_1_usage:
unit_of_measurement: '%'
value_template: "{{ 100 * (states('input_number.water_counter') | float - states('input_number.water_filter_1_install_counter_value') | float) / ( states('input_number.water_filter_1_capacity') | float ) }}"
water_filter_2_usage:
unit_of_measurement: '%'
value_template: "{{ 100 * (states('input_number.water_counter') | float - states('input_number.water_filter_2_install_counter_value') | float) / ( states('input_number.water_filter_2_capacity') | float ) }}"
water_filter_3_usage:
unit_of_measurement: '%'
value_template: "{{ 100 * (states('input_number.water_counter') | float - states('input_number.water_filter_3_install_counter_value') | float) / ( states('input_number.water_filter_3_capacity') | float ) }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment