Created
December 5, 2022 22:26
-
-
Save ryanneufeld/19f66f80d2a5b7ac0d43b9ba600ab1d2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias: Tooth Brushing Countdown (Approx 2mins) | |
trigger: [] | |
condition: [] | |
action: | |
- choose: | |
- conditions: | |
- condition: state | |
entity_id: input_boolean.tooth_brush_timer_state | |
state: "off" | |
sequence: | |
- service: select.select_option | |
data: | |
option: ToothBrush | |
target: | |
entity_id: | |
- select.toothbrushtimer_preset | |
- service: input_boolean.turn_on | |
data: {} | |
target: | |
entity_id: input_boolean.tooth_brush_timer_state | |
- repeat: | |
while: | |
- condition: numeric_state | |
entity_id: counter.tooth_seconds | |
value_template: "{{ state.attributes.maximum - state.state|int(0) }}" | |
above: 0 | |
- condition: state | |
entity_id: input_boolean.tooth_brush_timer_state | |
state: "on" | |
sequence: | |
- service: counter.increment | |
data: {} | |
target: | |
entity_id: counter.tooth_seconds | |
- service: number.set_value | |
target: | |
entity_id: number.toothbrushtimer_intensity | |
data: | |
value: >- | |
{{ states.counter.tooth_seconds.state|int(0) / | |
states.counter.tooth_seconds.attributes.maximum|int(0) * | |
100 | |
}} | |
- delay: | |
hours: 0 | |
minutes: 0 | |
seconds: 2 | |
milliseconds: 0 | |
- service: input_boolean.turn_off | |
data: {} | |
target: | |
entity_id: input_boolean.tooth_brush_timer_state | |
- service: select.select_option | |
data: | |
option: "Off" | |
target: | |
entity_id: | |
- select.toothbrushtimer_preset | |
- service: counter.reset | |
data: {} | |
target: | |
entity_id: counter.tooth_seconds | |
- conditions: | |
- condition: state | |
entity_id: input_boolean.tooth_brush_timer_state | |
state: "on" | |
sequence: | |
- service: input_boolean.turn_off | |
data: {} | |
target: | |
entity_id: input_boolean.tooth_brush_timer_state | |
- service: light.turn_off | |
target: | |
entity_id: | |
- light.toothbrushtimer | |
data: {} | |
- service: counter.reset | |
data: {} | |
target: | |
entity_id: counter.tooth_seconds | |
mode: restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment