i’m using a custom:button-card to control my garden hose. i’ve managed to get the formatting right to change the color based on the state of this hose. i’m trying to get the label to display the remaining time and no matter what i do, i can’t get it to work. the hose integration provides me the start time, and i’m using a template sensor to calculate the remaining time, but i can’t get the remaining time to show as the label. it either gives me an error when i try to load the overview or the button disappears entirely. i’m stuck on how to fix it. any help would be super appreciated, i’ve spent literal hours on this
template:
- platform: template
sensors:
garden_irrigation_run_time:
friendly_name: Garden Irrigation Run Time
value_template: >
{{ ( now() - state_attr('switch.garden_irrigation_zone','started_watering_station_at') ) }}
button:
type: custom:button-card
layout: name_state
show_label: true
tap_action:
action: call-service
service: input_boolean.toggle
service_data:
entity_id: input_boolean.garden_irrigation
name: Garden Irrigation
icon: mdi:watering-can
entity: switch.garden_irrigation_zone
label: >
[[[return state(sensor.garden_irrigation_run_time) ]]]
state:
- value: "on"
styles:
card:
- background-color: "#2389da"
icon:
- color: "rgb(221,221,221)"
- value: "off"
styles:
card:
- background-color: "#1D1D1D"