Alarm state format
See original GitHub issueProblem
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:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 removeutc
time 😃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 keepdate_time_utc
.fire_time
andlocal_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
orlast_triggered
attribute inautomation
use fully qualified ISO format. As well as popularweather.darksky
.