question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add property to active timers JSON that is the exact time a timer will expire

See original GitHub issue

Feature request:

Add property to active timers JSON that is the exact time a timer will expire.

Background

I need the exact time each timer will expire (not just the next timer). It seems like the raw JSON data should be enough to get the answer, but I’m always off by a few seconds when I try to calculate it myself. I would be nice if the raw JSON has a property (e.g., expireTime) that would be the exact time the timer was to expire. This would be the same value that is getting returned for the entity itself but add this value to the raw JSON of each timer so that its available for not just the “next timer” but for all active timers.

Example of Issue

Below is the output of a template (run via the Developer Tools–>Template page). Note that the calculated values is 2 seconds different then the value returned from the entity. 14:23:36 vs 14:23:38

 From raw JSON data:
key: 230ac9db-fe6d-37f4-acac-5b553c2e738f
expireTime: 2020-09-30 14:23:36
---
From the next timer value:
States: 2020-09-30T14:23:38-06:00

Here is the template:

{% set timers = state_attr('sensor.front_room_dot_next_timer', 'sorted_active') | from_json %}
{% for timerTokenData in timers %}
 {% set timerData = timerTokenData[1] %}
From raw JSON data:
key: {{ timerTokenData[0] }}
expireTime: {{ ((timerData.createdDate + timerData.remainingTime )/1000) | timestamp_local   }}
{% endfor %}
---
From the next timer value:
States: {{ states('sensor.front_room_dot_next_timer') }}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
alandtsecommented, Oct 2, 2020

Thanks merged it in. It’s in dev. Probably release it this weekend.

With that I assume this issue is closed. Let me know if you think otherwise.

0reactions
kkellnercommented, Oct 2, 2020

Created PR https://github.com/custom-components/alexa_media_player/pull/966. This PR adds a new attribute to notification sensors called process_timestamp. The value of this attribute provides access to HA templates allowing very accurate calculations of all future timers.

I verified alarms, notifications, timers to ensure nothing broke.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Timers REST API Reference | Alexa Skills Kit
Use the Timers REST API to create, pause, resume, and cancel timers in your skill. On timer expiration, Alexa can play an audible...
Read more >
Using 'expire' as a timer - Solutions - openHAB Community
Expire timer will stop if the Item state is changed to the expire target ... track of open Timers so they can be...
Read more >
34.4 Using the Timer Service - Java Platform, Enterprise Edition
For single-action or interval timers, the expiration of the timer can be expressed as either a duration or an absolute time. The duration...
Read more >
How to start timer accoirding to server response - Stack Overflow
It will fetch Employee name and Countdown timer time in a minute. But it is not splitting json object properly. It is showing...
Read more >
Session Timers in the Session Initiation Protocol (SIP) RFC 4028
This value is called the minimum timer. Session Expiration: The time at which an element will consider the session timed out, if no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found