Extract brita water card into a template

This commit is contained in:
2020-05-01 18:28:09 +03:00
parent 8c6c133c9d
commit 725c92a9f7
3 changed files with 53 additions and 72 deletions
@@ -48,31 +48,8 @@
- type: horizontal-stack
title: Brita
cards:
- type: custom:button-card
template: default
name: Pour water
entity: script.brita_pour_water
custom_fields:
remaining_liters: "[[[ return states['input_number.brita_remaining_liters'].state ]]]"
tap_action:
action: toggle
styles:
card:
- background: >
[[[
const remaining = states['input_number.brita_remaining_liters'].state;
const percent = 100 - (remaining / 150 * 100);
return 'linear-gradient(180deg, var(--paper-card-background-color) 0%, var(--paper-card-background-color)' + percent + '%, var(--primary-color) ' + percent + '%)'
]]]
- color: white
icon:
- color: white
custom_fields:
remaining_liters:
- position: absolute
- top: 5px
- right: 5px
- font-size: 12px
- type: custom:decluttering-card
template: brita_water_card
- type: custom:button-card
template: default
name: New filter