pymusiccast
pymusiccast copied to clipboard
Unlink service does not work for me
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?
Hello. Can you please try with:
service: musiccast_yamaha.unjoin
entity_id: media_player.speaker_main
Try removing service_data
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.
I will try creating an automation and calling that instead, to test if it works that way
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
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.
I will try it too. And if it works as expected I will update the component. Thank you!