Repository navigation
Alarm clock, working implementation #898
Replies: 5 comments 3 replies
|
That is a proper piece of work, thank you for building it and for asking before opening the PR. I want the feature. Before you shape the PR, four things decide how it has to look, and three of them are scars rather than preferences. The alarm has to survive a restart. The sleep timer deliberately does not persist: it lives in RAM, because making it durable would cost a flash write every bedtime and the failure it guards against is the harmless direction, a speaker that stays on. An alarm is the opposite. One that forgets itself because the agent restarted at 3am is worse than none, so it has to go to NAND, written only when it actually changes. The speaker has no clock battery. After a power cut it comes up believing it is 2015, and STR repairs that from an HTTP Date header ( Deep standby is sacred. Nothing may keep a speaker awake to watch the time, which I take it your Go timer already respects, and it is worth confirming in the PR because it is the rule everything in this area is measured against. Your own test tonight, whether the agent still fires after a long idle period, is exactly the right one. The phone page carries 13 languages. New strings need at least English and German; I can fill the rest. Two questions on shape. Does an alarm belong to the speaker or to the group, i.e. should waking the bedroom speaker also start the ones grouped with it? And does a missed alarm, box unreachable, network down, fire late or get skipped? I would skip it, because a station starting at 09:40 because the box was offline at 07:00 is a small horror, but you have run it in your own bedroom and I have not. Open the PR when you are ready. Agent side and phone side in one is fine; the desktop UI can follow, the phone is where people set an alarm anyway. |
|
Open the PR, all four answers are the shape I want. Your instinct on the permanent group is right, it will fire the whole group as things stand. Per speaker is the behaviour I want, so the alarm should start the master with the group re-form suppressed. If that is awkward from where your scheduler sits, say so in the PR and I will take that half. |
|
The feature is in and the shape is right. Four days of silence from me on a PR that answered all four constraints is not a good look. Two things you could not see. CI has never run on it, because a first PR from a fork waits behind an "Approve and run" click that is mine. I have just pressed it, so those 2952 lines are being built for the first time right now. And main moved 46 commits under you, so two files conflicted; that is resolved and pushed to your branch, tests green on the merged tree. Do not chase a main that moves daily. Two things to settle before it merges. An alarm saved or re-enabled within five minutes after its own time fires immediately, because the grace window cannot tell "the agent restarted" from "the user just pressed Save". And with no alarms set the runner still ticks every 30 seconds on every speaker in the fleet, which is wear I would rather not add. The Makefile fix riding along in 5363a48 is a real bug on main right now. Worth pulling out and merging on its own, ahead of the feature. |
|
All three in a day. Thank you. The remembered-list approach to the grace window is better than what I had in mind. It separates "the user just saved this" from "the agent restarted" by what the runner has actually seen, not by a clock, so there is no window left to tune and nothing to get wrong on a slow boot. And a scheduler that sleeps until there is something to do is exactly right for something that runs on every speaker in a fleet, on hardware where an idle timer is real wear. Thanks for taking the CodeQL note too. User input in a log line is the kind of thing that only bites much later. You pulled the Makefile fix out as #967, and I have checked it here. Both stamps come out identical across a build now, which is the whole point of the freeze. CI is running on it for the first time, and on the alarm clock as well. Once those are green, #967 goes to main on its own and the alarm clock follows. |
|
All three in a day. Thank you. The remembered-list approach to the grace window is better than what I had in mind. It separates "the user just saved this" from "the agent restarted" by what the runner has actually seen, not by a clock, so there is no window left to tune and nothing to get wrong on a slow boot. And a scheduler that sleeps until there is something to do is exactly right for something that runs on every speaker in a fleet, on hardware where an idle timer is real wear. Thanks for taking the CodeQL note too. User input in a log line is the kind of thing that only bites much later. You pulled the Makefile fix out as #967, and I have checked it here. Both stamps come out identical across a build now, which is the whole point of the freeze. CI is running on it for the first time, and on the alarm clock as well. Once those are green, #967 goes to main on its own and the alarm clock follows. |
Uh oh!
There was an error while loading. Please reload this page.
I have built a working alarm clock and would like to know whether you want it, and in what shape. It is running on my SoundTouch 10 and SoundTouch 20 right now. I have not opened a PR, because you ask for a discussion first on anything non-trivial, and because after reading #390 I think the UI might need a different shape.
The scheduler runs on the agent and wakes the speaker up at a set weekday and time to play a chosen preset at a set volume. It just stores a slot, rather than a station.
I have only implemented the controls for the alarm in the mobile version, so there's no desktop version yet.
The alarm function works on both the SoundTouch 10 and 20, but I still have to test whether the agent wakes itself after a long time of inactivity, I will report that tomorrow morning.
Let me know if you have any questions :)
All reactions