Controlling squeezebox media player with KNX wall switch

Hi,

I’m quite new to home assistant and trying to control my squeezebox media servers with my KNX wall switches. The goals I want to achieve is as follows:

  1. Use KNX switches to change volume ( I think I knew how to achieve this, but I haven’t tried so far)
  2. Show current playlist on the screen of the wall switch (Here I’m currently stuck)
  3. Use KNX Wall switch, to iterate through available playlists (I did’t try this so far, because of 2.)

Thats my current state:
I created a small python script, which I can execute by hand with the UI. The Script queries the last loaded playlist from the squeezebox player. This seems to work so far.
After that a new state is created in the entity of the squeezebox player to store the playlist information. Here I’m not sure if this does work. Here is the python script.

entity_id = 'media_player.kitchen'

hass.services.call("squeezebox", "call_query", { "entity_id": entity_id, "command": "playlist", "parameters": ['playlistsinfo']})
result = hass.states.get(entity_id).attributes['query_result']

if 'id' in result:
   inputStateObject = hass.states.get(entity_id)
   if inputStateObject :
     inputState = inputStateObject.state
     inputAttributesObject = inputStateObject.attributes.copy()
     inputAttributesObject['current_playlist'] = result
     hass.states.set(entity_id, inputState, inputAttributesObject)
     logger.info("attributes %s", inputAttributesObject)

In addition I configured the KNX switch, so that I can send text to it, which it does display. As a value for the text, I used the newly created attribute like follows:

knx:
  expose:
    - type: string
      address: "5/2/0"
      entity_id: "media_player.kitchen"
      attribute: media_player.kitchen.current_playlist.name

I don’t get an error, but the switch is not displaying the playlist. As a simplification I removed the “attribute” line to just display the current state on the switch. Since then it does display “playing”. Because of that I assume, that displaying text does work in general.
Can you give me a hint, what I’m doing wrong?

Jeremia

Can’t help you with 2). But 1 and 3 can be done by listening to a knx_event (add the used GAs to event_filter) and sending DPT1 telegrams from the switch.

For 1. you’re propably right, but for 3. I think I first need 2. To iterate through the playlists and show them on the switch.

Does nobody has an Idea? Do you need more information?

Hi Jeremia,

i know its an old Thread, but as i am in the same Situtation now.

Did you get this to work?

Hi,
I‘m also in the same situation now, but over all quite new in HA.

Have you found a solution?

I don‘t have a solution for controlling the playlist, but On/Off and volume is working fine.

Sounds great!
As I‘m quite new in HA, can you describe how it has to be done?
Could you share the yaml code, or a screenshot?

I would appreciate your help!

The solution is heavily dependent on the wall switch which you use. I have some of the Enertex Meta switches.
On the switch I used a dim control. With short press on the plus and minus signs I turn the player on/off. In my case I receive the short press signal with HA and send a message with mqtt to a distant relay to power a player and an amp.
After booting, the player just plays whatever it did play last time. Usually this is network radio.

Changing volume was a lot more difficult in my case, because i had to translate the values from the knx dim control to something useful for the media player and present this information as value between 0 and 100 back on the dim control.