Heos Group support

Hi @tormagj: could you share your custom component? Want to do some testing if you like…

Thanks
Cadish

Of course! I’m still learning github too, so bare with me if I’m doing this wrong, but I put my little hack here:

1 Like

How can I group/ungroup speakers? :roll_eyes:
Can I do it via a service, or do I need to use the GUI?

hi! the services should work, but I did most of the testing with the mini media card that I linked to above. check the grouping option in the installation guide. let me know if it’s working for you!

I get this error when I’m trying to group through the GUI

Unable to join: Missing Command arguments (3)

Hum, strange. Just tested it here again, and working fine both with mini-mediacard and by using services. Here’s my card setup

cards:
  - type: vertical-stack
    cards:
      - type: custom:mini-media-player
        entity: media_player.heos5_office
        artwork: cover
        source: icon
        toggle_power: false
        hide:
          power_state: false
          icon: true
        speaker_group:
            platform: heos
            show_group_count: true
            entities:
              - entity_id: media_player.heos5_office
                name: HEOS5 Office
              - entity_id: media_player.heos1_kitchen
                name: HEOS1 Kitchen
              - entity_id: media_player.heos1_flex
                name: HEOS1 Flex
              - entity_id: media_player.heos_stue
                name: HEOS LivingRoom

And here is how it looks (notice the +1 on the name after I grouped two of the speakers):
image

Does your setup look somehow similar?

You could also group your speakers with the HEOS app and then call the service ‘heos.groupinfo’ which will basically just print some debugging groupinfo in the log, like this:

2019-11-27 21:12:11 INFO (MainThread) [custom_components.heos.services] HEOS Groups are: ['name: heos5_office + heos1_flexmembers: heos5_office,heos1_flex']

Had more or less the same config, but copy-pasted yours now (with my entities of course), and still the same error…

That’s weird. Do you find any details in the log indicating that the component is not properly loaded? Or perhaps some more info on what goes wrong?

No, no other details in the log, except for the general one

2019-11-27 21:33:37 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for heos which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

BTW, I’m also logged in into my Heos device, as I can see its favorites etc…

Ok. I can’t think of anything obvious right now, but probably something silly I guess. I installed the mini-media card via HACS, but I guess that shouldn’t matter. Do you have the latest version of both card and Home assistant? By the way, I’m running hass.io but I guess that shouldn’t matter as well as long as it is the latest Pyheos in the background.

Did you try to call the heos.join service manually?

Hummmm! I got the same message when I tried to call the service with incorrect parameters for the call:

2019-11-27 22:28:48 DEBUG (MainThread) [pyheos.connection] Command failed 'heos://group/set_group?sequence=489&pid=': {'command': 'group/set_group', 'result': 'fail', 'message': 'eid=3&text=Missing Command arguments&sequence=489&pid='}
2019-11-27 22:28:48 ERROR (MainThread) [custom_components.heos.services] Unable to join: Missing Command arguments (3)

That happened for me when I used the default example data for calling the service, or in other words when the names couldn’t be found and mapped into a playerid (number) which the Heos system needs.

Following my setup in previous posts, I call the service like this - then its working.
image

Yes indeed, really strange. I also am running hassio and have the mini-media card installed via HACS too.

Heos.join service is giving me the exact same error…

Yeah… See my latest post, can it be something funny with the names? Any special characters??

Do you have your logger level set to errors only? Perhaps it helps to set it to DEBUG because I have some info put into debug that I used when I was working on it (like you see on my post).

I’ve changed it to DEBUG, and this is what I get in the logs now:

2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, groupname: 1e verdieping
2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, devices_in_group: ['1e verdieping']
2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, self.name: Living Room
2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Rebuilding group info, no groups found for this device: Living Room
2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, groupname: 1e verdieping
2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, devices_in_group: ['1e verdieping']
2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, self.name: Dining Room
2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Rebuilding group info, no groups found for this device: Dining Room
2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, groupname: 1e verdieping
2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, devices_in_group: ['1e verdieping']
2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, groupname: 1e verdieping
2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, devices_in_group: ['1e verdieping']
2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, self.name: Living draagbaar
2019-11-27 22:42:00 INFO (MainThread) [custom_components.heos.media_player] HEOS Rebuilding group info, no groups found for this device: Living draagbaar
2019-11-27 22:43:58 ERROR (MainThread) [custom_components.heos.services] Unable to join: Missing Command arguments (3)
2019-11-27 22:43:59 ERROR (MainThread) [custom_components.heos.services] Unable to join: Missing Command arguments (3)

Here’s my log when it is successful:

2019-11-27 22:31:47 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection.139758131676496] Received {'type': 'call_service', 'domain': 'heos', 'service': 'join', 'service_data': {'master': 'media_player.heos5_office', 'entity_id': 'media_player.heos1_flex'}, 'id': 45}
2019-11-27 22:31:47 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=heos, service=join, service_data=master=media_player.heos5_office, entity_id=media_player.heos1_flex>
2019-11-27 22:31:47 DEBUG (MainThread) [pyheos.connection] Command executed 'heos://group/get_groups?sequence=513': '{'command': 'group/get_groups', 'result': 'success', 'message': 'sequence=513'}'
2019-11-27 22:31:47 DEBUG (MainThread) [pyheos.connection] Command under process 'group/set_group': '{'heos': {'command': 'group/set_group', 'result': 'success', 'message': 'command under process&sequence=514&pid=615580468,-764010704'}}'
2019-11-27 22:31:48 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, groupname: HEOS5_office + HEOS1_flex
2019-11-27 22:31:48 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, devices_in_group: ['HEOS5_office', 'HEOS1_flex']
2019-11-27 22:31:48 INFO (MainThread) [custom_components.heos.media_player] HEOS Group info, self.name: HEOS1_flex
2019-11-27 22:31:48 INFO (MainThread) [custom_components.heos.media_player] HEOS Rebuilding group info, groupname: HEOS5_office + HEOS1_flex
2019-11-27 22:31:48 INFO (MainThread) [custom_components.heos.media_player] HEOS Rebuilding group info, grouplist: ['media_player.heos5_office', 'media_player.heos1_flex']

I’m not sure at all, but it could perhaps be something in my dirty code that doesn’t handle spaces in names or something? I’ll see if I am able to test it with other names on my devices later on. Not even sure it is relevant, but that’s the only difference I see right now.

Maybe my code is confusing entity name and friendly name as well, I see mine are identical (except for the leading media_player and some upper/lower case stuff that I remember I had to tweak in the code by forcing lower. Could be something like this that makes the code not recognize it.

Sounds like a possible cause… Let me know if I can test something…

I tried to rename my ‘HEOS5_office’ to ‘HEOS5 office’ with a space, then I got an error. So I guess there’s something there. So much for bullet proof code :slight_smile: If you don’t mind testing, you could try to change your friendly name (I did it in the HEOS app and hassio updated automatically. Try to set it as the same entity name in hassio, perhaps it magically works.

I’ll try to improve the code later.

Yes with names without spaces it works, but not always. I didn’t manage to group 3 together. Will test later again