Mapping for mqtt channel is not working

  • Platform information:
    • Hardware: Rpi 3
    • OS: raspbian/docker [openhab/openhab:latest]
    • openHAB version: 3.1.0
  • Issue of the topic:
    Mapping mqtt values at Channel level
 Bridge mqtt:broker:mm2 [ host="xxx.xxx.xxx.xxx", port=1883, clientID="xxxx", secure=false, username="xxx", password="xxx" ]
 {
  Thing topic topic1 "name" @"obj" {
        Channels:
                Type switch: ch_topic1 "ch1"  [stateTopic="mqtt/get/topic1", commandTopic="mqtt/set/topic1", ON=1, OFF=0]

  }
 } //broker:mm2

mqtt broker sees mqtt/set/topic1: ON

For some reason mapping from ON to 1 is not working

Watch your CAPS. This should say

on=1,off=0
1 Like

nop, cases do not help :frowning:
Recrated image (latest), even cleared data folders. Issue still there :frowning:

Rolled back to v3.0.2 and it seems to working again.
Cannot tell is it an issue of 3.1.0 docker image or it does not fully support file based config or something else. Now pulling back cofig data from git, will see result for all landscape

Anyway, for now 3.0.2 seems to working correctly. Will test a bit more

You may be hitting the bug where edits to Things files are not picked up by openHAB at save. Some people restart openHAB, I just do this.

Or yeah, might be a docker issue. All working fine for me installed in non-docker Ubuntu container, latest stable release 3.1 from apt.

I’m pretty sure you have to use quotes:

Bridge mqtt:broker:mm2 [ host="xxx.xxx.xxx.xxx", port=1883, clientID="xxxx", secure=false, username="xxx", password="xxx" ]
 {
  Thing topic topic1 "name" @"obj" {
        Channels:
                Type switch: ch_topic1 "ch1"  [stateTopic="mqtt/get/topic1", commandTopic="mqtt/set/topic1", on="1", off="0"]

  }
 } //broker:mm2
2 Likes