nielsfaber / alarmo

Easy to use alarm system integration for Home Assistant
1.31k stars 119 forks source link

Arming countdown timer as attribute #1001

Closed PaulFLeadbeater closed 4 days ago

PaulFLeadbeater commented 1 month ago

Checklist

Proposal

Alarmo lovelace card shows a countdown timer when arming. I want to use the actual 'seconds remaining' number as an announcement. Can we have this number published as an attribute, so it can be used in automations?

Additional info

[some example of how the new functionality should look like]

nielsfaber commented 1 month ago

Alarmo entities already have a delay attribute which can be used for this purpose. However this attribute does not count down, this would mean that the entity needs to change state every second, which is absolutely not a good practise in HA. But you can write an automation which triggers on the alarmo entity changing (or the delay attribute changing), and have this automation repeat a loop until the delay time expires (using a template you can use the delay time from alarmo in your automation).

PaulFLeadbeater commented 1 month ago

Hi Neil, I follow your reasoning on this, I have created a script which does a loop countdown; the difficulty with this is that it is not synchronized with the actual Alarmo time. What I am trying to do is to is to grab whatever Alarmo uses to generate the countdown gauge numbers and use that data in my announcement. I assume that somewhere in the code the 'number of seconds left' parameter is created, to feed into the countdown display. It's this bit of information I'm looking for. Is it buried too deep for us to get at?

nielsfaber commented 1 month ago

the difficulty with this is that it is not synchronized with the actual Alarmo time

Why is this not synchronized? I would expect the script to be triggered within a second of the alarm entity changing its state, is that not the case for you?

I assume that somewhere in the code the 'number of seconds left' parameter is created

No. Within Alarmo there is only a timer set to execute a function after the set time. There is no need to keep count of the seconds remaining in the integration side, as said it is not good design practise to update the entity at such interval. In the alarmo-card there is also a countdown timer displayed, here the remaining time is also calculated using the total delay.

PaulFLeadbeater commented 1 month ago

Thanks Neils, I now understand how Alarmo runs it's timer. What l am trying to do is to trigger my countdown from Alarmo's trigger (no problem there), make an announcement over Echo speaker, delay for (say 5 seconds) then make another announcement. l don't known if the time to run my announcement script will keep my timer at the same value as Alarmo's - I have experimented and got my timer to be slightly ahead or behind the Alarmo time; hence my wanting to use whatever is in the Alarmo timer as my control. I guess I could just keep adjusting my script to see if I can get it match?

github-actions[bot] commented 1 week ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days