Using time left on timer for notification

I have a bedtime timer that will turn off the tv and set a boolean when completed. The automation is set to restart the timer if I click it again. Im trying to figure out a way to send an “android TV notification” to the tv when there is 1 minute in case I want to add more time.

I have not been able to figure this out. I think its crazy that the the real time countdown you see in the frontend cannot be used as an attribute. Im wondering if I have to bite the bullet and use Node Red for this.

It is a long time ago that I struggled timers and it probably doesn’t help you but slightly strangely if you pause a timer it will tell you in the attribute how long is left to run.

I have some timers for room occupancy and I have this comment at the top of them…

  #=== The timers are paused before starting because
  #=== the time remaining is not exposed after a
  #=== start event if the timer is already running
  #=== but it is if it is paused first.

I wonder now if I was referring to the UI and that is now not true.
Like I said it was a long time ago.

I do think timers are definitely one of the poor relations in HA.

Its so odd that its the “state” but you cant do anything with it. I think I saw a WTH post about it but nothing happened with it.

You can use the attribut finishes at or what it’s called.

{{ (as_timestamp(state_attr('timer.timer', 'finishes_at') - now().timestamp()) < 60 }}

As the trigger in the automation.
I can’t remember the exact name of the attribute so you need to look that up.

1 Like

Because what you see in the UI is not the timer’s attribute. It’s the result of a calculation performed by the frontend based on the timer’s finishes_at attribute (when it’s active) or the remaining attribute (when it’s paused).

The template provided by Hellis81 is a starting point. Minimally, you should change the operator from < to <= because the template will only update very minute, not every second (the presence of now() in the template ensures it updates every minute, on the minute, but not faster). You will also need to enhance the template because it will fail, with an error, when the timer is paused or idle because the finishes_at attribute doesn’t exist in those states.

Worth a try if enhancing the template is not something you want to do.

This begs a question I have long had.
Where are all the possible attributes of an entity created by an (core) integration documented?


(My other long standing unasked question is what do all the supported_features attributes tell us? But yes, that is even less relevant to the OP).