WTH displaying a timer helper

If I add an entity card to display a timer it shows idle or active, if I display the same timer in an entities card it displays idle or a countdown of time remaining. In neither case do I have any choice which to display. Same for the mushroom chips, I would prefer the countdown but again no option.

A huge second for this WHT. Note that the “Entities” card does countdown, but the “Entity” card does not. See this post. I discussed on GitHub in this issue.

Would love to see a countdown timer available in the Lovelace UI similar to the countdown timer on the Next Hub.

1 Like

What is even more puzzling to me, admittedly a newb, is that I can’t find the countdown as an item I can look at in any way but an entities card. Most values I can look at developer tools/states to visualize. This value seems hidden to me. This even keeps me from creating a template to display as I want.

its annoying but this is what I was able to figure out:

{% set f = state_attr('timer.lava_lamp_timer', 'finishes_at') %}
{{"" if f == None else (as_datetime(f) - now()).total_seconds() | timestamp_custom('%-H:%M:%S', false) }}

I agree though, this should be consistent and easy.

What I could hack to have both an action button and a timer

You need button-card and card-mod

              - show_name: true
                show_icon: true
                type: custom:button-card
                tap_action:
                  action: toggle
                entity: script.script_clim_chambre_cool_temp_turbo
                show_state: true
                triggers_update: timer.clim_chambre_auto_temp_turbo
                styles:
                  custom_fields:
                    timer_time:
                      - position: absolute
                      - right: 2%
                      - top: 2%
                      - font-size: 10px
                custom_fields:
                  timer_time:
                    card:
                      type: entities
                      entities:
                        - entity: timer.clim_chambre_auto_temp_turbo
                      card_mod:
                        style:
                          .: |
                            ha-card {
                              box-shadow: none !important;
                            }
                          hui-timer-entity-row$hui-generic-entity-row$: |
                            :host {
                              justify-content: flex-end !important;
                            }
                            state-badge {
                              display: none !important;
                            }
                            .info {
                              display: none !important;
                            }

I must be doing something wrong, when I enter this in the Developer tools/template it only updates every minute. I thought this was a feature of the template test enviroment so I entered it in my templates.yaml. Put it on screen with an entity card and there it only updates every miniute as well.

Any suggestions as to what I am doing wrong?

   - name: tea time remaining
      unique_id: 9ccff6f8-12ad-4977-8a18-cbb01ab085a8
      state: >
        {% set f = state_attr('timer.tea_timer', 'finishes_at') %}
        {{"" if f == None else (as_datetime(f) - now()).total_seconds() | timestamp_custom('%-H:%M:%S', false) }}

Thanks

That’s nominal behavior because the template employs now whose state changes every minute (not every second). It’s now’s state-change that causes the template to be evaluated every minute. You can’t increase the update frequency of now.

Easiest solution is to simply use an Entities card because it’s able to display a timer’s countdown (one-second resolution).

If you absolutely need a Template Sensor to report a timer’s remaining time (to the second), here’s a way to do it:

Thanks again for the reply, I was actually hoping to display the time remaining in a Mushroom Chip card. I’ll do without until the fine developers come to the rescue with a fix. I’m sure it’s not high on the list being such a small item.

And not worth the effort for me to manage a workaround either I guess.

Cheers!

1 Like