Squeezebox add alarms support - switch platform (1 of 2)
Proposed change
Add support for enabling, disabling, adding, and delete alarms in the Squeezebox integration.
Like spotify, we represent the alarm as a switch entity that can be flipped on or off, with state attributes that indicate the time, volume, and other settings of the alarm.
Type of change
- [ ] Dependency upgrade
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New integration (thank you!)
- [X] New feature (which adds functionality to an existing integration)
- [ ] Deprecation (breaking change to happen in the future)
- [ ] Breaking change (fix/feature causing existing functionality to break)
- [ ] Code quality improvements to existing code or addition of tests
Additional information
- This PR fixes or closes issue: fixes #
- This PR is related to issue:
- Link to documentation pull request:
Checklist
- [X] The code change is tested and works locally.
- [X] Local tests pass. Your PR cannot be merged unless tests pass
- [X] There is no commented out code in this PR.
- [X] I have followed the development checklist
- [X] I have followed the perfect PR recommendations
- [X] The code has been formatted using Ruff (
ruff format homeassistant tests) - [X] Tests have been added to verify that the new code works.
If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated for www.home-assistant.io
If the code communicates with devices, web services, or third-party tools:
- [ ] The manifest file has all fields filled out correctly.
Updated and included derived files by running:python3 -m script.hassfest. - [ ] New or updated dependencies have been added to
requirements_all.txt.
Updated by runningpython3 -m script.gen_requirements_all. - [ ] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
To help with the load of incoming pull requests:
- [ ] I have reviewed two other open pull requests in this repository.
Hey there @pssc, @petes-uk, mind taking a look at this pull request as it has been labeled with an integration (squeezebox) you are listed as a code owner for? Thanks!
Code owner commands
Code owners of squeezebox can trigger bot actions by commenting:
-
@home-assistant closeCloses the pull request. -
@home-assistant rename Awesome new titleRenames the pull request. -
@home-assistant reopenReopen the pull request. -
@home-assistant unassign squeezeboxRemoves the current integration label and assignees on the pull request, add the integration domain after the command. -
@home-assistant add-label needs-more-informationAdd a label (needs-more-information, problem in dependency, problem in custom component) to the pull request. -
@home-assistant remove-label needs-more-informationRemove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.
Before merging this needs:
- [x] Docs PR
- [x] https://github.com/home-assistant/core/pull/127739
- [x] https://github.com/home-assistant/core/pull/127695
cc @wollew
Nice - I use alarms quite a bit, and this will be nice :-) I can now add turning alarms on and off to part of my away functions. thanks for this one.
Also, please split adding a platform from adding services
Hi @rajlaud. Seems to work nicely - picked up my existing alarms and their state correctly and allowed me to switch them on and off.
One thing that's missing is that there's a player level switch in LMS to override the individual settings and turn them all off - it doesn't switch the individual states, it just overrides them.
I use this as part of my away settings - if we're away, I turn on a number of alarms to play music in different rooms at different times - chat radio in the kitchen in the morning etc.. But, I tend to leave the individual alarms on. Currently, turning the switches on and off wouldn't actually turn the alarms on because they're overriden. I think you need another switch "Kitchen All Alarms" to reflect the player level setting if any alarms are defined for that player.
Looks like that is implemented as a player preference: https://lyrion.org/reference/cli/alarms/#alarm-related-player-preferences.
I see the use case but the name "All Alarms" is confusing to me - it makes me think it is a switch to flip the state of all of the individual alarms on or off. That is how an entities card in HA would function - if you flip the switch at the top, it flips all of the individual switches to match.
Instead, this really functions like a mute switch, right? It prevents any alarms for sounding on that player despite the setting of the individual switch.
Any suggestions on a clearer name? "Player 1 Allow Alarms to Sound"?
Hmm - I see what you mean... You'd almost want to something like Player 1 Mute Alarms, but then yes and no would be the wrong way around compared to LMS, which could be confusing. The nice bit about the way it works is that it doesn't actually change the underlying alarms - so when you turn them back on, only those that were individually enabled beforehand are on. So, Allow Alarms to Sound seems fine to me, but ideally only show this entity if the player has an alarm.
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes. Thank you for your contribution!
Hey @rajlaud, is there anything I can do to help get this merged?
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes. Thank you for your contribution!
Bump
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. If you are the author of this PR, please leave a comment if you want to keep it open. Also, please rebase your PR onto the latest dev branch to ensure that it's up to date with the latest changes. Thank you for your contribution!