[SOLVED] MQTT 2.4 - Problem with two channels

Hi team,

I’ve got a fairly fresh install of openHAB 2.4 and MQTT 2.4.

I’m in the process of setting up my Yamaha Amp to be controlled via MQTT from a touch panel in my kitchen and have come across a small issue with two of the channels - Radio Preset and Volume.

Using MQTT I am able to perform the following on the Amp:

  1. Turn Power Off/On
  2. Turn Mute Off/On
  3. Select the input - TUNER / CD

But, I cannot do these:
Set the Volume
Set the Radio Preset

Using MQTT.fx I can publish the setting to the topic and the logs show it received. My BasicUI sitemap updates with the new setting, but once the Yamaha thing refreshes in openHAB it resets to the previous setting. So the new published MQTT setting is not actually set on the Amp.

I think it’s something to do with publishing a number to the MQTT topic…but I’m just not sure.

When I use the BasicUI sitemap to make the changes it does it correctly on the Amp and publishes the updated setting to the MQTT topic also, and I can see the numbers correctly in the topic on MQTT.fx

Any ideas on where to start? Is it a transform of some sort?

Thanks for any assistance.

Cheers,
Mike

Can you post your items, things and channels configs, please?

Is this about using paper UI on one hand to change an MQTT channel item and BasicUI on the other hand?

You should also consider using OH 2.5M1 for MQTT.

Here’s the item config for the amp:

// ZONE 3 - Living Room

Switch      Yamaha_Z3_Power           "Power [%s]"              <switch>             (Yamaha_RXV3900,Z3)    { channel="yamahareceiver:zone:26237000_9894_11db_9976_00a0de4c9e95:Zone_3:zone_channels#power", channel="mqtt:topic:KitchenPanel:Amp_OnOff" }
Dimmer      Yamaha_Z3_Volume          "Volume [%.1f %%]"        <soundvolume>        (Yamaha_RXV3900,Z3)    { channel="yamahareceiver:zone:26237000_9894_11db_9976_00a0de4c9e95:Zone_3:zone_channels#volume", channel="mqtt:topic:KitchenPanel:Amp_Vol" }
Switch      Yamaha_Z3_Mute            "Mute [%s]"               <soundvolume_mute>   (Yamaha_RXV3900,Z3)    { channel="yamahareceiver:zone:26237000_9894_11db_9976_00a0de4c9e95:Zone_3:zone_channels#mute", channel="mqtt:topic:KitchenPanel:Amp_Mute"}
String      Yamaha_Z3_Input           "Input [%s]"              <video>              (Yamaha_RXV3900,Z3)    { channel="yamahareceiver:zone:26237000_9894_11db_9976_00a0de4c9e95:Zone_3:zone_channels#input", channel="mqtt:topic:KitchenPanel:Amp_Input" }
Number      Yamaha_Z3_Preset          "Preset [%d]"             <video>              (Yamaha_RXV3900,Z3)    { channel="yamahareceiver:zone:26237000_9894_11db_9976_00a0de4c9e95:Zone_3:playback_channels#preset", channel="mqtt:topic:KitchenPanel:Amp_Station"}

Here’s the Kitchen Panel Thing:
image

And then the Channels attached to it:

Then the Channel config for the Preset Station and Volume


Cheers,
Mike

Hi David,

The behaviour is the same using PaperUI control, or the BasicUI sitemap.
Both of those will control the Amp correctly and send the messages to the MQTT Topic.

But, trying to publish from MQTT back into openHAB doesn’t work for just the Preset Station and Volume.

I’ll check out OH 2.5M1

Thanks.

Cheers,
Mike

No change of behaviour with OH 2.5M1.

Cheers,
Mike

You have connected via the Yamaha binding and via MQTT.? Why?

I get it!!
You intend to use the incoming state change as a command on the Yamaha binding!!

The MQTTv2 binding can do that but only on Switch channels with a parameter called: postCommand:

image

@David_Graeff

Could the paperUI be extended for other channels types to include the postCommand parameter, please?

@mikebl
In the mean time you will have to use proxy items:
One item with the yamaha binding
One item with the MQTT binding
And a rule to pass the updated value on MQTT as a command to the Yamaha:

Dimmer      Yamaha_Z3_Volume          "Volume [%.1f %%]"        <soundvolume>        (Yamaha_RXV3900,Z3) { channel="yamahareceiver:zone:26237000_9894_11db_9976_00a0de4c9e95:Zone_3:zone_channels#volume" }
Dimmer      Yamaha_Z3_Volume_MQTT          "Volume [%.1f %%]"        <soundvolume>        (Yamaha_RXV3900,Z3) {channel="mqtt:topic:KitchenPanel:Amp_Vol" }
rule "Yamaha Volume"
when
    Item Yamaha_Z3_Volume_MQTT changed
then
    Yamaha_Z3_Volume.sendCommand(Yamaha_Z3_Volume_MQTT.state)
end
2 Likes

Sure. I thought that’s the case already in snapshots. Can someone of you open an issue? I’ll forget otherwise.

Cheers

1 Like

I am not running snapshots until it gets more stable. The ESH changes broke my system.
Can anyone confirm that the “is command” parameter is available for all channel types in the paperUI with the new snapshots before I submit an issue. Thanks

I have just fixed that. The dimmer and number channels were missing that option.

3 Likes

Thanks very much for your assistance @vzorglub

I had to make a slight tweak to the rules, but it’s all up and running now.

I needed to add in .toString otherwise the rule didn’t work.

rule "Yamaha Volume"
when
    Item Yamaha_Z3_Volume_MQTT changed
then
    Yamaha_Z3_Volume.sendCommand(Yamaha_Z3_Volume_MQTT.state.toString)
end

Thanks guys.

Cheers,
Mike

1 Like