d_sellers1

Drumming Automation

Jun 21st, 2023
1,422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.03 KB | None | 0 0
  1. type: custom:mushroom-template-card
  2. entity: input_boolean.tester ###needs an input_boolean helper. Add to automation turning this on/off
  3. secondary: >-
  4.   Last changed:   {% set t = ((as_timestamp(now()) -
  5.   as_timestamp(states.input_boolean.tester.last_updated)) | int) %}   {% if t <=
  6.   10 %} Just now  {% elif t <= 60 %} {{ t }} seconds  {% elif t < 3600 %}
  7.     {{ (t / 60) | int }} min {{ (t % 60) }} sec
  8.   {% elif t >= 3600 %}
  9.     {{ (t / 3600) | int }} hr {{ (t / 60) | int }} min {{ (t % 60) }} sec
  10.   {% else %} error  {% endif %}
  11. primary: '{{ ''Stop drumming'' if states(entity) == ''on'' else ''Start drumming'' }}'
  12. icon: '{{ ''mdi:music-box'' if states(entity) == ''on'' else ''mdi:music-box-outline'' }}'
  13. icon_color: '{{ ''green'' if states(entity) == ''on'' else ''red'' }}'
  14. tap_action:
  15.   action: call-service
  16.   service: automation.trigger
  17.   service_data:
  18.     entity_id: automation.start_drumming
  19. double_tap_action:
  20.   action: call-service
  21.   service: automation.trigger
  22.   service_data:
  23.     entity_id: automation.stop_drumming
Advertisement
Add Comment
Please, Sign In to add comment