[SOLVED] OH3 MQTT Some channels not working

After upgrading to OH3, I’m experiencing an issue with the MQTT binding where some channels/items are not being updated when a message on the specified topic is published. For example, I have the following configuration:

Things file:

Bridge mqtt:broker:mosquitto [ host=“localhost”, secure=false, clientid=“openHAB” ]
{
Thing topic doorwaypir {
Channels:
Type switch : state “State” [ stateTopic=“doorwaysensor/pir/state” ]
Type switch : online “Online” [ stateTopic=“doorwaysensor/status” ]
}
}

Items file:

Switch doorwayPIR “Doorway PIR [%s]” (pirsensors,restoreOnStartup,rrd4j) {
channel=“mqtt:topic:mosquitto:doorwaypir:state”[profile=“transform:MAP”, function=“1on0off.map” ]
}
Switch doorwayPIRConnectionStatus “Doorway PIR Connection Status [MAP(onlineoffline.map):%s]” (rrd4j,devicesonline) {
channel=“mqtt:topic:mosquitto:doorwaypir:online”[profile=“transform:MAP”, function=“onlineoffline.map” ]
}

However, even though both channels and items are nearly identical, only the item doorwayPIRConnectionStatus gets updated when I publish a message.

I have also noticed that, strangely, in the UI, the profile definition for doorwayPIRConnectionStatus is not shown correctly, whereas for doorwayPIR it is:


Does anyone have any idea what might be causing this?

OH3 version? Changes to permit transform profile usage with Item types other than String types are recent.

I think this should be present in RC versions.

However, note that your MQTT channel types are switch type.
Naturally enough these interface with Items using openHAB ON/OFF states, not the MQTT payload.
You’re trying to do the transformation in the wrong place, you need to do it at the MQTT channel, not at the channel-Item link with a profile.

The MQTT binding includes shortcuts and defaults for mapping payloads to switch type channels, see binding docs for on= off= parameters.

Thanks for the fast response! OH3 version is 3.0.0 (upgraded via APT just yesterday). I changed the config files to remove the transformation at the channel-item link and instead use the on and off parameters in the channel definition, however it still does not work as expected. The UI still shows doorwayPIR as having a “MAP” profile, even though I deleted it in the text file. And publishing to its topic has no effect, regardless of the message (I tried 1, ON, and on). Publishing to the doorwayPIRConnectionStatus item now only works if I send 1 or 0, even though I defined the on and off parameters as “online” and “offline” in the channel definition.

Yep, oft times bindings and so on are sluggish at picking up in-flight edits. A reboot generally allows you to see what’s left.

After restarting OpenHAB, both items seem to now be working. Thanks for your help!