rianadon / timer-bar-card

A progress bar display for Home Assistant timers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

double_tap_action is triggered when tapping once

AlexC opened this issue · comments

Describe the bug
The following configuration uses "double_tap_action" to add 5 minutes onto a timer, however if I double tap it will execute the script twice. If I tap just once, then the script is executed once. This only appears to affect mobile devices, desktop browser is fine.

As tap_action is set to none, I would expect a single tap to not execute anything.

Additionally, if I do have a tap_action, I have noticed that the tap_action will trigger when tapping the icon, however if you tap (once) the timer bar then it will trigger the double_tap_action

Your card configuration

type: custom:timer-bar-card
entity: timer.light_bedroom
name: Bedside
invert: true
tap_action:
  action: none
hold_action:
  action: none
double_tap_action:
  action: call-service
  service: script.timer_add_5min
  data:
    timer_entity: timer.light_bedroom
mushroom:
  icon_color: orange

Script in case that helps:

fields:
  timer_entity:
    name: Timer entity
    description: Timer entity to add time to
    required: true
sequence:
  - service: timer.start
    data:
      duration: >
        {% set timer_finished_at = state_attr(timer_entity, 'finishes_at') %} {%
        if timer_finished_at == None %}
          {% set end_time = now() %}
        {% else %}
          {% set end_time = strptime(timer_finished_at, '%Y-%m-%dT%H:%M:%S%z') %}
        {% endif %}

        {{ ((end_time - now()).total_seconds() | int) + 300 }}
    target:
      entity_id: "{{ timer_entity }}"
alias: timer.add_5min
mode: single

Debug information
Please add debug: true to your configuration and either take a screenshot or paste the output here!

Sorry for the long delay in replying. In the latest version of the card, I've taken out all the custom action-handling code and deferred to the built-in Home Assistant actions handler. That should hopefully fix any bugs with actions for now and for the future.

Please let me know if this is still an issue with the latest version!

Sorry for the long delay in replying. In the latest version of the card, I've taken out all the custom action-handling code and deferred to the built-in Home Assistant actions handler. That should hopefully fix any bugs with actions for now and for the future.

Please let me know if this is still an issue with the latest version!

Sounded promising though unfortunately in the latest version the issue remains. Let me know if you can replicate it, or if you need me to work out a different/simpler config to aid this.

Using version v1.30.2, I can confirm a similar behavior that is probably related.
I am using the timer with a tap action that toggles an input boolean of another entity via a service call.

type: custom:timer-bar-card
entity: timer.heat_shot_timer
name: Heat Boost
icon: mdi:fire
invert: true
mushroom:
tap_action:
  action: call-service
  service: input_boolean.toggle
  target:
    entity_id: input_boolean.heat_shot_toggle

As expected, clicking on the icon calls the service once, but clicking on the timer while it is running triggers the service three times in my case.