Skip to content
This repository has been archived by the owner on Dec 9, 2021. It is now read-only.

Unlink service does not work for me #13

Open
1v0dev opened this issue Dec 28, 2020 · 6 comments
Open

Unlink service does not work for me #13

1v0dev opened this issue Dec 28, 2020 · 6 comments

Comments

@1v0dev
Copy link

1v0dev commented Dec 28, 2020

I got the following config:

  - platform: musiccast_yamaha
    host: 192.168.0.52
    port: 5004
  - platform: musiccast_yamaha
    host: 192.168.0.53
    port: 5005

and in lovelace:

          - type: button
            name: Join Office
            show_state: false
            tap_action:
              action: call-service
              service: musiccast_yamaha.join
              service_data:
                entity_id: media_player.speaker_main
                master: media_player.receiver_main
          - type: button
            name: Only Receiver
            show_state: false
            tap_action:
              action: call-service
              service: musiccast_yamaha.unjoin
              service_data:
                entity_id: media_player.speaker_main

The Join Office button works fine and groups the speakers but the Only Receiver one with the unjoin service does nothing. I tried calling the service from the dev screen in HASS but nothing happens there as well. Any thoughts?

@ppanagiotis
Copy link
Owner

Hello. Can you please try with:

service: musiccast_yamaha.unjoin
entity_id: media_player.speaker_main

Try removing service_data

@1v0dev
Copy link
Author

1v0dev commented Dec 28, 2020

Hi, thanks for the support. Unfortunately, it does not work that way too. I tried with dev tools as well, calling the service does nothing. No errors in the HASS log too.
image

@1v0dev
Copy link
Author

1v0dev commented Dec 28, 2020

I will try creating an automation and calling that instead, to test if it works that way

@1v0dev
Copy link
Author

1v0dev commented Dec 28, 2020

I tried running this automation, but again no result:

alias: unlink test
description: ''
trigger: []
condition: []
action:
  - service: musiccast_yamaha.unjoin
    entity_id: media_player.speaker_main
mode: single

@1v0dev
Copy link
Author

1v0dev commented Jan 4, 2021

I did some debugging and found the issue. Looks like something is messing up in Python due to the parameter names in one line of your code - file "init.py" line 51:

masters = [entities for entities in entities
                       if entities.is_master]

Since entities is already used maybe it overrides something (I am no expert in Python though, so I may be wrong)
I changed it to this which fixed the issue for me:
masters = [e for e in entities if e.is_master]

You can close this issue.

@ppanagiotis
Copy link
Owner

I will try it too. And if it works as expected I will update the component. Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants