Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sound mode support (media_player frontend) #815

Closed
wants to merge 4 commits into from

Conversation

starkillerOG
Copy link
Contributor

@starkillerOG starkillerOG commented Jan 18, 2018

Added frontend support for an drop down box select for the sound mode (also updated with status).
This is general support for all media_player components.
This box is not shown in media_players that did not (yet) implement sound mode support in the backend.
I implemented the sound mode support (backend) for the denonavr platform and that one works perfictly.
I will make a pull request for the backend soon (still dooing some cleanup).

I tested this code and it works on Hassbian on my pi.

On the home assistant chat I heard that other platforms like onkyo and sonos could also implement sound mode support and probably most receivers could support this.

Backend pull request:
home-assistant/core#13706
Documentation pull request:
home-assistant/home-assistant.io#4470

- this is part of the added sound mode support to the home assistant backend
Changed icon of the new input select.
Tested the code and it works, for other media players that did not implement sound mode support the input select is nicely hidden (not present).
For the Denonavr platform it works and sound mode is updated and can be changed in the front pannel.
@starkillerOG
Copy link
Contributor Author

sound_mode_support

@starkillerOG
Copy link
Contributor Author

sound_mode_support_2

@starkillerOG
Copy link
Contributor Author

@balloob @c727 Could one of you maybe revieuw this PR and then merge it?

return isOff || !supportsSelectSoundMode;
}

computeSelectedSoundMode(stateObj) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not used

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed it

@@ -45,6 +45,15 @@
margin-left: 10px;
}

iron-icon.sound-mode-input {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as source-input. You should combine them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I combined both

- combine style classes of sound mode and source.
- remove unused computeSelectedSoundMode
@starkillerOG
Copy link
Contributor Author

@c727 I commited the changes you proposed, can you now merge this PR?

@starkillerOG
Copy link
Contributor Author

@c727 I tested the new changes and it seems to work with those unused parts of the code removed.

@c727
Copy link
Contributor

c727 commented Jan 31, 2018

I can't do this, you have to wait for Andrey, armills or balloob

@starkillerOG
Copy link
Contributor Author

@andrey-git @armills @balloob, could one of you merge this PR?

@@ -106,6 +106,18 @@
</paper-listbox>
</paper-dropdown-menu>
</div>
<!-- SOUND MODE PICKER -->
<div class='controls layout horizontal justified'
hidden$='[[computeHideSelectSoundMode(isOff, supportsSelectSoundMode)]]'>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dom-if it instead

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know exactly what you mean but I guess you mean to use a "dom-if" property in the

instead of using the hidden$.
Again I am not an expert in how this works and what the diffrence is.
But the rest of the file is using the hidden$ property.

Basically I made a copy of the Source input, so everything is done in a similar way as the already implemented Source input.

Would it not be better to keep everything the same as the rest of the file for now.
Maybe someone else who does no what the diffrence is and nows how to use these properties correctly can change it for the whole file at once (also for the SourceInput, Power and Volume).

@@ -359,6 +397,27 @@
this.callService('select_source', { source: sourceInput });
}

handleSoundModeChanged(soundModeIndex, soundModeIndexOld) {
var soundModeInput;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to predeclare variables.

Just use const when you assign it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All handle's are done with var instead of const throught this file.
honestly I don't know the exact diffrence but I think it might be better to keep the file uniform and do the same thing as done in the rest of the file.

Basically I made a copy of the Source input, so everything is done in a similar way as the already implemented Source input.

@starkillerOG
Copy link
Contributor Author

@andrey-git Do you agree to keep the document uniform?
Or shall I try to implement the sugested changes (const and dom-if)?

@starkillerOG
Copy link
Contributor Author

@andrey-git Shall I try to implement the suggested changes or do you agree with my previous comment?

Implemented changes suggested by @andrey-git
@ghost

This comment has been minimized.

@balloob balloob closed this May 4, 2018
@balloob
Copy link
Member

balloob commented May 4, 2018

Closed as new supported features need to be discussed in the architecture repo first as per https://developers.home-assistant.io/docs/en/entity_index.html#changing-the-entity-model

@github-actions github-actions bot locked and limited conversation to collaborators Jul 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants