How to use the Chronometer mode of notify.device()

Just playing around with notifications and noticed on Android Notify.device has a Chronometer which can count up or down from a given timestamp. Pretty cool for time sensitive notifications.

In Developer Tools: the following gives me a nice count up timer against the notification.

message: '<b>The Mailbox has been opened</b>'
title: '<b>Mailbox Alert</b>'
  color: 'red'
  channel: 'Mailbox'
  importance: high
  icon_url: ""
  chronometer: true
  when: '1609572077'
  tag: 1

However, to get it to work as part of an automation I need to update the when: tag with a template.

In Developer Tools, the following gives me a UNIX timestamp which is valid.

{{ as_timestamp(now()) | round(0)  }}

But when I put it into my automation like so, it doesn’t work. The notification is displayed on my phone but the Chronometer isn’t there.

Any ideas what I am doing wrong?


Got it working… needed to put the template in 's :man_facepalming:

1 Like

How would I use it as a countdown from 15 sec to 0? Now it counts up.

@thecobra666 Try setting the when tag to

'{{ (as_timestamp(now()) + 15) | round(0) }}'

Note this will count down for 15 seconds and then start counting up. if you don’t want this (say you want it show timer expired when it gets to 0) you’ll need your automation to wait 15secs, cancel this notification and replace it with another that says Timer Expired.

1 Like

Thanks! This should really be included in the docs. A simple example instead of what is mentioned now.