-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
Volume up/down - steps to small with Sonos speakers #27
Comments
Hi @htvekov I released v2.2.1b1 with a fix for this bug. These are the instructions to try the code: Through HACSIf you go to ControllerX in HACS, you can select in the menu Show Beta and install v2.2.1b1. Then you will need to restart your AppDaemon server. Through filesYou can download the dev branch and copy the controllerx folder inside apps into /config/appdaemon/apps/. Then you will need to restart your AppDaemon server. There is a new attribute for media player controllers called "volume_steps" which is 10 by default. This value is how many steps need to be made to go from min to max. So if set to "2" and the volume is 0, it will go to 50% and with the second click to 100%. Let me know if this fixes the issue and it works as expected :) |
Hi @htvekov, Thanks for the feedback. I am glad that now works as expected and thanks for the appreciation. I am currently working on making a custom controller where you will be able to set the custom call services on controller actions through the yaml configuration (#12). With this, you will be able to map any action to a service (e.g. change the source for you media player). I will keep you updated on it. I will close this issue once I release v2.2.1. |
Hi' Xavi. Custom controller - I like it already !! 😎👍 |
This issue has been fixed in v2.2.1 |
Hi @htvekov , I have released v2.3.0b1 with support to custom controllers, now you can map controller events to predefined actions or HA services. Since there is no support for sources list yet on the media player controllers, you can define this with CallServiceController. This would be a configuration that let you control your media player and also adds the functionality for the source list. office_speaker:
module: controllerx
class: E1810MediaPlayerController
controller: sensor.office_controller_action
integration: z2m
media_player: media_player.office_speaker
actions:
- toggle
- brightness_up_click
- brightness_down_click
- arrow_left_click
- arrow_right_click
- brightness_up_hold
- brightness_up_release
- brightness_down_hold
- brightness_down_release
office_speaker_source_list:
module: controllerx
class: CallServiceController
controller: sensor.office_controller_action
integration: z2m
mapping:
arrow_left_hold:
service: media_player.select_source
data:
entity_id: media_player.office_speaker
source: DR P5 (Pop)
arrow_right_hold:
service: media_player.select_source
data:
entity_id: media_player.office_speaker
source: DR P6 Beat The If you hold the arrow left it should change to Let me know if this works as expected. Thanks @htvekov :) |
Hi' Xavi. Didn't even realise (until now), that you've also written on this issue. Thank you for the example 👍 I'll test in the weekend. Thank you once again, Xavi. Regards |
Perfect @htvekov! Let me know if this works as expected then and if you have any problems. I will try to implement a predefined action for the forward/backward source list, but I do no promise anything. Can you maybe let me know if source list is also available when the speaker is off or idle? I agree with you, HA automations are limited when it comes to complex situations, but this is why solutions like python script and AppDaemon exist, which I am glad for it. If you ever need help or you have any question with Python, you can ask me :) Regards, |
Hi' Xavi. I'll test your sample code tomorrow. But it would be REALLY cool if you at some point could find the time to implement Sonos source list choice 😎😎 Just made a quick test with my Sonos speakers. When paused/idle source list is available. If speaker is completely off, the change to source list will be applied when online again (as idle/paused). Didn't notice that source list was actually updated before I was using it for playing. But maybe I wasn't patient enough for states to update ? Wish you a lovely weekend, Xavi 🍻🍻😁 |
Just tested, Xavi. Test example for source list is working as expected 😊👍 |
Hi @htvekov I have some good news for you, Santa came late, but it came. I have implemented the following in v2.3.0b5:
example_app:
module: controllerx
class: CustomMediaPlayerController
controller: livingroom-controller
integration: z2m
media_player: media_player.livingroom_speaker
mapping:
arrow_left_click: previous_source
arrow_right_click: next_source Also, I added to the E1810MediaPlayerController the next and previous source when holding arrow left and right. So just with the following configuration, you have the next and previous source: office_controller:
module: controllerx
class: E1810MediaPlayerController
controller: <sensor id>
integration: z2m
volume_steps: 20
media_player: group.sonos_all
office_controller:
module: controllerx
class: E1810MediaPlayerController
controller: <sensor id>
integration: z2m
volume_steps: 20
media_player: group.sonos_all
actions:
- toggle
- brightness_up_click
- brightness_down_click
#- arrow_left_click
#- arrow_right_click
- brightness_up_hold
- brightness_up_release
- brightness_down_hold
- brightness_down_release
office_speaker_source_list:
module: controllerx
class: CallServiceController
controller: <sensor id>
integration: z2m
mapping:
arrow_left_click:
- service: media_player.select_source
data:
entity_id: group.sonos_all
source: DR P3
- service: light.turn_on
data:
entity_id: light.kontor_loft
flash: short
arrow_right_click:
- service: media_player.select_source
data:
entity_id: group.sonos_all
source: DR P4 Fyn 96.8 (Nyheder)
- service: light.turn_on
data:
entity_id: light.kontor_loft
flash: short One last thing, since the next and previous source is a predefined action, you cannot call a service (like turning on a light) after next and previous has been called since they are different custom controllers. However, you can turn the light at the same time as the source is changing by creating two app instances as you have done and then mapping in the same key two different actions but with different type of custom controller. I would really appreciate it if you could test both (number 1 and 2) configurations to know that it works as expected in your end. I have implemented it and I put everything under tests, but I do not have a speaker with a source list to test. Thank you and merry Christmas 😝 Note: I have converted the image to text with an OCR online, there might be some typos. Just for future reference, you can check here how to include code in markdown. Instead of "javascript" or "python", you can put "yaml". |
Hi' Xavi Holy crap - My saviour in shining Python armor ! 🚀🚀😎😎 Quick test on both 1. and 2. failed. As far as i can see in error log, it hasn't read source list properly or (can't find the separator ',') I'll write more extensively, when you've had the chance to check code. I've changed settings to one single speaker for test, as the Sonos group obviously doesn't have the states for 'source list' or anything else for that matter. Below error log for Custom Media Player controller example (1).
|
That could be because of the attribute is already a list, I thought it would be a string, this is why I splitted. I will try to fix that or you can go to that file as you have the path and comment that line with # and see if that fixes it. |
I'll check... |
Yep. Commenting line 43 in media_player_controller.py did it 👍😎 Custom Media Controller and E1810 Media Controller working as expected. Only issue is playing with Sonos Groups.
Hmm... Have to check what states are for a speaker pulled from a group and playing on its own ?? |
One last thing about sonos_group. |
Hi' Xavi. I forgot to test multiple service calls using same controller (trigger) and sharing same key mapping, but as different app instances and/or different classes. Thought that this should work, but it don't ? Perhaps I misunderstood how multiple service calls (using different apps with identical keys) should be used ?? Regards
|
Hi @htvekov, Regarding the Sonos group, how does it behave when the Sonos are grouped with the group integration. Could you please open a new issue for it and describe what does work and what does not? Let's see if we can find a generic solution for it, I cannot read the |
Hi again @htvekov, I observed the same as you (calling different actions in different app instances) and apparently that was a very nasty bug. I could fix it and I test it with a real example: livingroom_light:
module: controllerx
class: E1810Controller
controller: sensor.livingroom_controller_action
integration: z2m
light: light.livingroom
smooth_power_on: true
test:
module: controllerx
class: CallServiceController
controller: sensor.livingroom_controller_action
integration: z2m
mapping:
toggle:
- service: notify.telegram_test
data:
message: Test message 1
- service: notify.telegram_test
data:
message: Test message 2 With this configuration I can press the toogle button and it does the following:
These changes can be found in v2.3.0b6 as well as the fix for the "source_list" (Removing line 43 in media_player_controller.py). Let me know if this fixed the problem related to calling different actions with different app instances. Sorry for all the bugs related to this, but I really appreciate it that you are finding them :) |
Hi' Xavi. Multiple service calls, sharing same key, now works with latest beta v2.3.0b6 Don't worry about the bugs. I've never seen code that was flawless in first beta or beta no. #15 for that matter 😉 |
Regarding the Sonos 'issue' the main problem AFAIK is that Sonos implementation is unique, as they (still) can't be integrated with other speakers in a multiroom setting in eg. Google Home. My Sonos group is manually added. There's no automatic Group creation in HA and now autogenerated groups in HA are depricated all together very soon. So my Sonos group only contains the entities:
I'll open a new issue regarding Sonos, Xavi. |
Okay, we will leave this issue closed then and discuss the Sonos group in the new issue. Thanks @htvekov |
'Single tap' on button volume up/down only changing volume on device by 0.02
(Very slow. Need 50 'single taps' to get from zero volume to full volume).
When volume button (up/down) is pressed and held, volume only changes 7 or 8 'steps' (of 0.02) and then stops - Eg. from 0.16 to 0.30 (No continuous volume up/down).
Info: HA range for Sonos volume: 0.00 to 1.00 (with 2 decimals).
HA direct service call also adjust volume with same amount (0.02) as ControllerX.
AppDaemon: 4
Hass-core: 0.105.2
Device: Ikea remote E1810 / Sonos One/Play:5/Play:1 speakers. Only tested with single Sonos speakers (no groups)
Integration: z2m
Logs: None (No errors. Only slow volume adjusting 😉)
The text was updated successfully, but these errors were encountered: