Skip to content

alarm clock based on input_datetime #547

Answered by craigbarratt
phsdv asked this question in Q&A
Discussion options

You must be logged in to vote

First, have you confirmed the string f"once({input_datetime.alarm_time})" produces a correctly formatted time?

The main problem is that the alarm() function is destroyed as soon as update_alarm() returns, since there is no longer any reference to it in any scope, so there will no longer be any trigger. See the docs. You need to keep some reference to the closure function so it remains defined after the enclosing function returns, eg, by setting a global variable.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@phsdv
Comment options

Answer selected by phsdv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants