Need help to define item and rule while using MQTT and NikoHome Control binding

  • Platform information:
    • Hardware: PC running Openhab2 + Synology NAS running Mosquitto MQTT
    • OS: Windows 10
    • Java Runtime Environment: not sure
    • openHAB version: openHAB 2.5.0 Build #1637
  • Issue of the topic: Using MQTT Dash on my smartphone to publish topic “droevaert/command” with payload “1” or “0” towards my MQTT server on Synology NAS. Intention is to switch Wallplug-TV ON and OFF, sounds simple.
    I configured a MQTT binding and defined a channel DroevaertLED. Toggling on my smartphone I see Logging info displayed, so the receiving of MQTT messages works. Unfortunately I do not succeed in capturing this payload and translate it into a proper rule. Can someone help me a bit.
  • Please post configurations (if applicable):
  • Items configuration related to the issue
    Number MQTT_droevaert_LED {mqtt="<[broker:droevaert/command:state:default]"}
    Switch Wallplug_FF_LR_TV “Wallplug TV” { channel=“nikohomecontrol:onOff:440e00ee0727:43:switch” }
    • Sitemap configuration related to the issue
    • Rules code related to the issue
      rule “Test1 Leeslamp via MQTT”
      Thing “mqtt:broker:e7016092:DroevaertLED” changed
      logInfo (“MyRule”,“My rule triggered!”)
      logInfo (“Received command”,receivedCommand.toString)
      if (MQTT_droevaert_LED.state as Number == 1){
      if (MQTT_droevaert_LED.state as Number == 0){
    • Services configuration related to the issue
  • If logs where generated please post these here using code fences:
    mqtt:broker:e7016092:DroevaertLED triggered 1
    mqtt:broker:e7016092:DroevaertLED triggered 0

Your Item is defined using MQTT 1.x version syntax. If you have the MQTT 2.5 binding installed, you need to create Things and Channels to subscribe to the topic and then link your Item to that Channel. You are doing a mix of all sorts of things which don’t make much sense.

Also, please use How to use code fences.

See the MQTT Docs, and there are tons of examples and related threads you can use if you search the forum for MQTT 2.5.