core icon indicating copy to clipboard operation
core copied to clipboard

Squeezebox add alarms support - switch platform (1 of 2)

Open rajlaud opened this issue 1 year ago • 8 comments

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:

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 running python3 -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:

rajlaud avatar Oct 08 '24 13:10 rajlaud

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 close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign squeezebox Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

home-assistant[bot] avatar Oct 08 '24 13:10 home-assistant[bot]

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

rajlaud avatar Oct 08 '24 13:10 rajlaud

cc @wollew

rajlaud avatar Oct 08 '24 13:10 rajlaud

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.

peteS-UK avatar Oct 08 '24 13:10 peteS-UK

Also, please split adding a platform from adding services

joostlek avatar Oct 08 '24 13:10 joostlek

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.

image

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.

peteS-UK avatar Oct 08 '24 16:10 peteS-UK

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"?

rajlaud avatar Oct 08 '24 16:10 rajlaud

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.

peteS-UK avatar Oct 08 '24 17:10 peteS-UK

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!

github-actions[bot] avatar Dec 07 '24 19:12 github-actions[bot]

Hey @rajlaud, is there anything I can do to help get this merged?

wollew avatar Dec 09 '24 13:12 wollew

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:

Learn more about our pull request process.

home-assistant[bot] avatar Jan 17 '25 11:01 home-assistant[bot]

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!

github-actions[bot] avatar Mar 18 '25 22:03 github-actions[bot]

Bump

peteS-UK avatar Mar 18 '25 23:03 peteS-UK

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!

github-actions[bot] avatar May 18 '25 00:05 github-actions[bot]