Combine squeezebox action with mqtt action

Hi,
I’ve some squeezeboxes connected with serveral amplifiers. I’ld like to switch my amplifiers, when squeezebox starts playing.
mqtt works fine, I can switch the amplifier with a switch item. But this combined item doesn’t work:

Switch sq_schlafen_power    "Power"  { squeeze="schlafen:power", mqtt=">[mysensor:MyMQTT/23/3/V_LIGHT:command:ON:1], >[mysensor:MyMQTT/23/3/V_LIGHT:command:OFF:0]" }

This item should switch on/off my amplifier via MQTT, but it doesn’t. At the moment it just works, when I switch both separately. Sure, I can use a rule, but shouldn’t this action combination not work, as well?

Has anybody a hint for me? What am I doing wrong? Should it work or do I investigate the wrong way?

Thanks in advance,
Michael

It does look like it ought to work, that when you manually toggle the switch it should send a OnOffType command to both bindings. I would be very surprised if the comma in the mqtt="…" string were an issue, but just in case, you could replace the mqtt string with ">[mysensor:MyMQTT/23/3/V_LIGHT:command:*:MAP(offon.map)]" and make the file configurations/transform/offon.map containing

OFF=0
ON=1

But I don’t have intense faith that that will make a difference.

@watou Thanks for your hints, but unfortunately it happend what you expected :frowning: Nothing!
I tried to remove the comma, no chanced behaviour. I used your MAP-solution … here i saw a strange behaviour, just the ON messages arrived. It never switched OFF, dont ask me why. I double checked the item, but I could just switch ON.
I can not exclude that it is my fault, but I didn’t find any difference between my past item definition (combination squeezebox and knx) and the new definition (combination squeezebox und MQTT).
Hmmm, I solved this by a rule. If you think it’s a bug, I can support you maybe with further information, if not, then leave it. For me it’s OK now. Thanks!

I scanned the internalReceiveCommand code for both bindings and nothing jumps out at me as a possible cause for this, what appears to be some kind of bug. But I’m glad you found a workaround!

It bothers me that we don’t know why this didn’t work for you. One thought I had to try to find the answer would be to swap out the mqtt binding for a different binding, like http or exec, in the following item:

Switch sq_schlafen_power    "Power"  { squeeze="schlafen:power", mqtt=">[mysensor:MyMQTT/23/3/V_LIGHT:command:ON:1], >[mysensor:MyMQTT/23/3/V_LIGHT:command:OFF:0]" }

and see if changing the switch’s state causes commands to be sent to both bindings. If not, then this would possibly implicate the squeezebox binding in some way, so we could narrow focus onto the likely component.

I hate mysteries! :mag: :mag: :mag:

I know exacly, what you mean. I hate mysteries as well, but as non-developer that all is much mysterie for me :smile:
Well, I followed your advice and combined squeezebox and exec action like:

Switch sq_schlafen_power    "Power"   { squeeze="schlafen:power", exec=">[ON:/opt/usr/openhab/scripts/squeezebox.sh ON] >[OFF:/opt/usr/openhab/scripts/squeezebox.sh OFF]" }

This worked!
==> /opt/usr/openhab/logs/openhab.log <==
2015-09-16 16:40:44.049 [INFO ] [.o.b.exec.internal.ExecBinding] - executed commandLine ‘/opt/usr/openhab/scripts/squeezebox.sh ON’

==> /opt/usr/openhab/logs/events.log <==
2015-09-16 16:40:44.068 - sq_schlafen_power received command ON
2015-09-16 16:40:44.309 - sq_schlafen_power state updated to ON

==> /opt/usr/openhab/logs/openhab.log <==
2015-09-16 16:40:50.822 [INFO ] [.o.b.exec.internal.ExecBinding] - executed commandLine ‘/opt/usr/openhab/scripts/squeezebox.sh OFF’

==> /opt/usr/openhab/logs/events.log <==
2015-09-16 16:40:50.841 - sq_schlafen_power received command OFF
2015-09-16 16:40:50.858 - sq_schlafen_power state updated to OFF

Did the squeeze= binding run as well as the exec binding when you manually changed the state of the sq_schlafen_power item? I can’t tell from the log. I don’t know what to suggest other than making your mqtt= string as close to the example as possible.

Yes, the squeezebox played music and stopped, when I changed the item.