Thanks for pointing that out. Must have been a copy and paste error. I’d have to dig for the Pi Hole version, but here is a sprinkler version.
Automation
alias: Sprinkler Timer
description: ""
trigger:
- platform: state
entity_id:
- input_boolean.sprinklers_on
to: "on"
condition: []
action:
- service: timer.start
data:
duration: "{{ states('input_number.sprinkler_number') | int*60 }}"
target:
entity_id: timer.sprinkler_timer
- service: switch.turn_on
target:
entity_id:
- switch.back_yard_main
data: {}
- service: homeassistant.update_entity
target:
entity_id: switch.back_yard_main
data: {}
- delay:
hours: 0
minutes: 0
seconds: "{{ states('input_number.sprinkler_number') | int*60}}"
milliseconds: 0
- service: switch.turn_off
target:
entity_id:
- switch.back_yard_main
data: {}
- service: input_boolean.turn_off
data: {}
target:
entity_id:
- input_boolean.sprinklers_on
mode: single
Script
alias: Sprinkler Timer Finish
sequence:
- service: timer.finish
metadata: {}
data: {}
target:
entity_id: timer.sprinkler_timer
- service: switch.turn_off
data: {}
target:
device_id: bb9a5ee6cfed42eecfcf9ba0f166e19c
entity_id: switch.back_yard_main
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.sprinklers_on
mode: single
icon: mdi:timer-off-outline
Card Code
type: custom:stack-in-card
cards:
- type: custom:mushroom-title-card
title: Sprinklers
- type: custom:layout-card
layout_type: custom:grid-layout
layout:
grid-template-columns: 15% 15% 70%
margin: '-10px 0px 0px 0px'
cards:
- type: custom:mushroom-template-card
entity: input_boolean.sprinklers_on
icon: mdi:sprinkler-variant
tap_action:
action: toggle
confirmation:
text: Are you sure you want to start the timer?
hold_action:
action: call-service
confirmation:
text: Are you sure you want cancel the timer?
service: script.sprinkler_timer_finish
icon_color: transparent
card_mod:
style: >
ha-card {
border: none !important;
--icon-symbol-size: 40px;
background:none;
}
ha-state-icon { {% if is_state('input_boolean.sprinklers_on', 'on')
%}color: lime !important;
animation: sprinkle 4s ease-in-out infinite
{%else%}
color: red !important;
{% endif %}
}
@keyframes sprinkle {
0%, 10%, 20%, 30%, 40%, 60%, 70%, 80%, 90%, 100% { clip-path:
inset(0 40% 0 40%); transform: rotate(0deg); }
1%, 16%, 31%, 46% { clip-path: inset(0 0 0 0); transform:
rotate(0deg); }
}
- type: custom:button-card
entity: timer.sprinkler_timer
name: Time Left
show_name: true
show_state: true
show_label: false
show_icon: false
height: 40px
styles:
img_cell:
- background-color: rgba(var(--color-theme),0,05)
- border-radius: 50%
- place-self: center
- width: 20px
- height: 20px
card:
- background-color: '#3d5afe02'
- border: none
- border-radius: 14px
- font-size: 12px
- font-weight: normal
- height: 70px
- color: |
[[[
if(states['input_boolean.sprinklers_on'].state == 'off') return 'red'
else return 'lime';
]]]
- align_self: middle
name:
- font-size: 12px
- padding-bottom: 2px
- color: |
grey
- font-weight: normal
- type: custom:mushroom-number-card
entity: input_number.sprinkler_number
tap_action:
action: toggle
layout: horizontal
display_mode: slider
card_mod:
style:
mushroom-shape-icon$: |
.shape {
background: none !important;
--shape-color:none;
}
mushroom-number-value-control$:
mushroom-slider$: |
.slider {
position: absolute !important;
width: 96% !important;
left: 12px;
height: 44px !important;
margin-top:2px;
--bg-color: rgba(169, 169, 169, 0.2);
--main-color: {{ 'rgba(0, 255, 0, .42)' if is_state(switch.back_yard_main', 'on') else 'rgba(255, 0, 0, .2)' }} ;
}
.: |
ha-state-icon {
color: transparent;
}
ha-card {
border: none !important;
background: none;
}
mushroom-state-info$: |
.container {
flex-direction: row !important;
position: absolute !important;
width: 79%;
top: 17px;
align-items: baseline;
}
.primary {
color: transparent !important;
position: relative;
flex-shrink: 1;
flex-grow: 1;
}
.primary:after {
content: "{{states('input_number.sprinkler_number')| int(0)}} Min ";
position: absolute;
color: {{ 'lime' if is_state('switch.back_yard_main', 'on') else 'red' }} ;
left: -1px;
font-weight: 400;
top: 3px;
width: max-content;
z-index: 2
}
.secondary {
color: transparent !important;
position: relative;
flex-shrink: 1;
flex-grow: 0;
}
.secondary:after {
content: "{{ 'ON' if is_state('switch.back_yard_main', 'on') else 'OFF' }} ";
position: relative ;
color: {{ 'lime' if is_state('switch.back_yard_main', 'on') else 'red' }} ;
font-weight: 400;
top: 2px;
right: 10px;
padding-right: 10px;
z-index: 2;
}
card_mod:
style: |
ha-card {
background-image: url("/local/pics/wood.png");
border: none;
}