I have a bluesound speaker configured in my HA system as a media_player. The thing is that I would like to create a volume slider for the speaker in one of my groups.
What I have done is to create the following:
A input_slider
Automation for slider- > speaker
Automation for speaker -> slider
The problem is that when I am using the automation below, it ends up in a loop where the slider updates the speaker, the speaker updates the slider with the old value, and the volume goes up and down in a never ending loop.
This stops the loop behavior, but instead it throws an error in the log. (Also, the slider is not 100% reliable with this wait_tempalate present, but that might be something else.)
2017-09-25 20:22:31 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: 'input_slider' is undefined
2017-09-25 20:22:31 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: 'input_slider' is undefined
Do any you have any suggestion on how I can fix this issue? My goal is to get a standalone slider for the speaker, so I can place it in any of the groups I want.
Thanks in advance. Any help is much appriciated.
Henrik
I didn’t really manage to get it working properly using input sliders and automations. The closest I got was a solution that worked most of the times, but occasionally ended up in a loop where it was updating it self, making it more or less useless.
What I ended up with at last was to just have a one-way sync from HA -> media player. It solves my use case, but if i change the volume directly on the media_player, it is not reflected in HA. In my case that is not a big problem, so I stopped investigating further.
I do remember to have seen someone using appdaemon and a python-script to do this kind of bidirectional functionality. (Bidirectional input slider fo media player).
Looks like the link to the github repo is broken, but maybe @tinmice could share the code again?
I’ve actually solved this problem, while it’s not the cleanest solution it does indeed work.
I have duplicates of every state regarding the speaker I want to control.
So I have volume_state and volume_slider.
When the speaker updates it’s state via the control or buttons, the volume_state and the volume_slider is changed. Now this will trigger state change for the volume_slider, but no change request will be sent to the speaker since in the state_change automation I have if volume_state != volume_slider as a condition.
I have in my pipeline to write an extensive guide on how to hack the Logitech Z906 system with an ESP. I’m planning to write it this fall or winter so hopefully you can get more answers then!
Still working on the guide I’m afraid, it’s hard to find time. Currently I’m sorting out some bugs that got introduced when the software libraries used in the project got updated.
The plan is still to write it sometime this fall or winter. I’ll let you know in this threat the second it’s public.