Show timer duration in Bubble card

Hi, i made a bubble card to control my ceiling fan. i use a tuya smart IR remote and i used the tuya app to setup scenes to make the remote compatible with HA. I created a some scripts in HA to create this timer function. I want to know if it’s possible to show the remaining time of a timer. for example in this seperator where it says ‘time remaining’

1 Like

Depending on how you created the timer, it should be an entity you can display in the card. Did you use a Helper - Timer to to create the timer?

That can be displayed as a entity

07-09-42-37-217 - chrome

type: entities
entities:
  - entity: timer.nanoleaf_morning

In the above example the timer is triggered at a time of day via a automation

This doesnt work the time remaing attribute is shown as static

i think you’d have to do something a little custom. can use the “finishes_at” attribute of the timer an subtract now() from that to get the remaining time. however do you need it to update at 1 second granularity? if so, that becomes somewhat challenging as i think the dashboard cards by default update on minute granularity when you use now(). you could hack it by creating a sensor that has the remaining time and updating its state every second. but that’s pretty unadvisable. if you only need minute level granularity, then using the finishes_at attribute as described above could work…

Can you share code for this card?

Here you go, I use an Auto-Entities card to show all the timers running

type: custom:auto-entities
card:
  type: entities
  title: Timers
  show_header_toggle: false
  state_color: true
filter:
  exclude:
    - state: idle
    - attributes:
        current: '= 0'
  include:
    - domain: timer
show_empty: true
sort:
  ignore_case: true
  method: last_triggered
  numeric: false

Which display which timers are running

image

1 Like