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?