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.

Alarm state format

See original GitHub issue

Problem

In #47 alarm state format was changed from unix timestamp to formatted string which is nice and makes it more readable. But I think it should also include time zone because it’s a local time.

Before March 28 I live in UTC and can’t check this but Sweden uses CET and I believe if in template editor in developer tools you try this, these timestampts won’t be equal:

Converted timestamp: {{ as_timestamp(states("sensor.<google_home_name>_alarms")) }}
Fire time: {{ state_attr("sensor.<google_home_name>_alarms", "alarms")[0]["fire_time"] }}

This makes it harder to use state in automations.

Solution

Add time zone to TIME_STR_FORMAT. %z should be compatible with ISO datetime format. It should look like 2021-03-04 13:41:04+0100

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
leikoiljacommented, Mar 4, 2021

Both of those sounds really nice. Let’s split those into two issues. One to sort the alarms, another to fix the state format. The tricky part with alarms is that they can be single or repetitive, that integration does not cater for yet(#25). Let’s keep this issue to fix state to provide ISO time, we ll keep local_time for UI references and remove utc time 😃

1reaction
KapJIcommented, Mar 4, 2021

But anyway adding time zone to local_time is a good idea, this can save people from figuring out why their timestamp is wrong 😃 Also in this case I don’t see why to keep date_time_utc. fire_time and local_time should be enough.

Probably local_time without time zone can be useful for UI but I think sensor should only provide data and lovelace cards can render it the way they prefer.

For example, standard sun.sun or last_triggered attribute in automation use fully qualified ISO format. As well as popular weather.darksky.

Read more comments on GitHub >

github_iconTop Results From Across the Web

set-alarm-state — AWS CLI 1.27.35 Command Reference
Temporarily sets the state of an alarm for testing purposes. When the updated state differs from the previous value, the action configured for...
Read more >
set-alarm-state — AWS CLI 2.4.18 Command Reference
Temporarily sets the state of an alarm for testing purposes. When the updated state differs from the previous value, the action configured for...
Read more >
Alarm Display Fields (Alarm Format Fields) | System Model
Alarm Display Fields ; {State,n}. State of the event. The value of this field indicates the action that triggers the event, similar to...
Read more >
Template Alarm Control Panel - Home Assistant
Defines a template to set the state of the alarm panel. Only the states armed_away , armed_home , armed_night , armed_vacation , arming...
Read more >
aws cloudwatch set-alarm-state - Fig.io
Options ; --state-reason-data <string>, The reason that this alarm is set to this specific state, in JSON format. For SNS or EC2 alarm...
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