Add support for home assistant's STATE_OFF#1041
Merged
Merged
Conversation
Contributor
Author
|
I forget if this needed new tests to be made for it since we only talked about this verbally a few days ago and I have since fed my brain into a taffy puller with the various things I've been touching lately Let me know what changes this needs, if any, and I'll make a rapid release so it can be used with the upcoming hacs_amplipi update |
linknum23
reviewed
Apr 4, 2025
| """ Indicate no source connection, simulated in SW by muting zone for now """ | ||
|
|
||
| ZONE_OFF = -2 | ||
| """ Indicate that a zone is set to STATE_OFF within home assistant """ |
Contributor
There was a problem hiding this comment.
Suggested change
| """ Indicate that a zone is set to STATE_OFF within home assistant """ | |
| """ Indicate that a zone is set to STATE_OFF used for tracking a power off state for external interfaces that treat a zone as a media player with an on/off button. Used for integrations such as home assistant. Use the following mapping to use as an on/off indicator: | |
| - ON: source_id != ZONE_OFF | |
| - OFF: source_id == ZONE_OFF | |
| To turn off: set to ZONE_OFF. | |
| To turn back on: set to SOURCE_DISCONNECTED (to wait for the user to change an input) or set to any valid source id to start playing something. | |
| """ |
Contributor
There was a problem hiding this comment.
That probably needs a touch of rework but gets the general concept past.
Contributor
Author
There was a problem hiding this comment.
I've added a less verbose version in my recent commit, see here:
"""
Indicate that a zone is considered off for the purpose of external interfaces such as home assistant
ON = source_id != ZONE_OFF
OFF = source_id == ZONE_OFF
To turn off: set to ZONE_OFF
To turn on: set to SOURCE_DISCONNECTED or any valid source_id
"""
8d655bb to
4fc239f
Compare
linknum23
approved these changes
Apr 18, 2025
Contributor
linknum23
left a comment
There was a problem hiding this comment.
As discussed this looks good!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change intend to accomplish?
Support
STATE_OFFfor use with home assistant media_player entitiesChecklist
./scripts/test