OH3 simple Switch on GUI

Hi there,
I´ve set up a new OH3 instance to start new from scretch.
Now i try to link a simple lightbulb to OH3.
What i have done:

  • set up MQTT Broker -->online
  • set up MQTT Generic think -->online
  • set up Channel (switch ON/OFF)
  • link Switch Item

When i switch the item… the ON Command will be processed but not the “OFF” Command.
In the log, i see the ON Command:

=> /var/log/openhab/events.log <==
2020-12-29 11:26:34.939 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'TESTONOF' received command ON

By switching to OFF nothing happens.

what could be the problem?

Are you sending 2 separate commands to the device? Without knowing the device difficult to say what the on/off is…could be on/off 1/0 or could be momentary - like a pull cord so only 1 command

Its a Tradfri Bulb connected via Zigbee2mqtt.

On OH2 I use text configuration for this bulb and it works fine.
Things Config:

Bridge mqtt:broker:mosquitto [host="localhost", secure=false]
Thing topic EG_WZ_Boden "Wohnzimmer Boden" @ "Wohnzimmer"
            Type switch : state "state" [ stateTopic = "zigbee2mqtt/EG_WZ_Boden/state", commandTopic = "zigbee2mqtt/EG_WZ_Boden/set/state", on="ON", off="OFF" ]
            Type dimmer : brightness "brightness" [ stateTopic = "zigbee2mqtt/EG_WZ_Boden/brightness", commandTopic = "zigbee2mqtt/EG_WZ_Boden/set/brightness", min=0, max=255, step=1 ]
            Type number : linkquality "linkquality" [ stateTopic = "zigbee2mqtt/EG_WZ_Boden/linkquality" ]
            Type colorHSB : colorHSB    "COLORHSB"   [stateTopic = "zigbee2mqtt/EG_WZ_Boden/color", commandTopic="zigbee2mqtt/EG_WZ_Boden/set", transformationPatternOut="JS:HSBtoRGB.js" ]

Switch WZ_Boden_S "Boden Lampe ON/OFF [%s]" <light> (gWZ) [ "Lighting" ]{channel="mqtt:topic:mosquitto:EG_WZ_Boden:state"}

On OH3 i want to try the GUI Config instead of text files.

Can you show us the YAML of your Generic Thing and Channel?

Not suggesting that this is the issue as you say it worked in OH2, but to just switch the bulb on or off it should be sufficient to send ON or OFF to

UID: mqtt:topic:014dd05770:EG_WZ_Boden
label: EG_WZ_Boden
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:014dd05770
location: Büro
  - id: brightness
    channelTypeUID: mqtt:colorHSB
    label: Helligkeit
    description: ""
      commandTopic: zigbee2mqtt/EG_WZ_Boden/set/brightness
      colorMode: HSB
      stateTopic: zigbee2mqtt/EG_WZ_Boden/brightness
      on: "100"
    channelTypeUID: mqtt:switch
    label: EG_WZ_BODEN_ONOFF
    description: ""
      commandTopic: zigbee2mqtt/EG_WZ_Boden/set/state
      postCommand: true
      stateTopic: zigbee2mqtt/EG_WZ_Boden/state
      off: "0"
      on: "1"

For testing I imported my text files (things and items). It’s the same there. The OFF switch is not executed. The brightness e.g. I can regulate easily.

Which bulb are you using?

this one :
IKEA LED1624G9 control via MQTT | zigbee2mqtt.io

The zigbee2mqtt page suggests using ON and OFF, not 1 and 0. Have you tried that?


just double check that you really need this.

Might also be worth using something like MQTT Explorer or mqtt.fx to see what the broker is receiving.

That’s the problem. The broker does not receive anything. No (OFF) command is issued by OH3.

Yeah, I’m clutching at straws here! I’m going to try porting one of my similar bulbs over to OH3 later today, using the UI exclusively. I’ll let you know if I hit the same issue.


No issue here. Here’s my YAML (and JSON for Item and Link) - switches on and off fine.


UID: mqtt:topic:MosquittoMqttBroker:bPorchBulb
label: Bulb Porch
thingTypeUID: mqtt:topic
  payloadNotAvailable: offline
  availabilityTopic: zigbee2mqtt/bPorchLight/availability
  payloadAvailable: online
bridgeUID: mqtt:broker:MQTTBroker2
location: Porch
  - id: power
    channelTypeUID: mqtt:switch
    label: Power
    description: ""
      commandTopic: zigbee2mqtt/bPorchLight/set
      stateTopic: zigbee2mqtt/bPorchLight/state
      off: OFF
      on: ON


  "link": "",
  "state": "OFF",
  "stateDescription": {
    "pattern": "%s",
    "readOnly": false,
    "options": []
  "editable": true,
  "type": "Switch",
  "name": "BulbPorch_Power",
  "label": "Power",
  "category": "lightbulb",
  "tags": [
  "groupNames": []


  "channelUID": "mqtt:topic:MosquittoMqttBroker:bPorchBulb:power",
  "configuration": {},
  "itemName": "BulbPorch_Power"

Just to check - did you manually go into the YAML and try to change anything, such as anything with UID in the parameter name?

Dear hafniumzinc,
thanks for your attention and your very good tuturial.
Unfortunately the OFF Command don´t works.

I configured everything again exactly according to your instructions in OH3. The dimmer works fine, but the OFF command does not. Only the ON command.
The following appears in the log when you turn it on:

==> /var/log/openhab/openhab.log <==
2020-12-30 09: 32: 53.472 [WARN] [ab.binding.mqtt.generic.ChannelState] - Command '131' is not supported of type 'OnOffValue': No enum constant org.openhab.core.library. types. OnOffType. 131

Does that help?

Today I will try a bulb from another manufacturer.

Well, that doesn’t look right. Do you have a Switch Channel with a state topic pointing to anything which can receive a number?

It’ll be interesting to see if this helps - looks like if the messages never reach the broker (in fact, never get generated by openHAB) then it’s an openHAB issue.

From your first post you’re using a completely new install of OH3? Not an upgrade? What’s your Java version? Are you using openhabian?

Forgot the failure message. Because my bulb does not have a “availabilty” topic, i try to use “linkquality” instead. I change it back to the settings:

payloadNotAvailable: offline
  availabilityTopic: zigbee2mqtt/EG_Buero_Decke/availability
  payloadAvailable: online

The failure in the log is gone.

Your Question regarding my install:
I use a RaspberryPI4 with Raspberry Pi OS Lite.
I purge the openhab2 install. Install Zulu 11, set it to default and install openhab via APK.

Nearly identical to me then, except I didn’t have an older OH2 (I wiped the card) and I’m using a 3B. Here’s how I installed openHAB and Java.

Unfortunately, I don’t know what else to suggest at this stage. My setup is exactly as described in the tutorials. Anything I suggest would be a complete shot in the dark!

Ok, we’re getting closer to the goal. Now it’s getting interesting:
I opened the control surface with Safari browser on my iPhone. This is where the commands come through. It works! I open the same setting on the Windows PC with Chrome and Edge. It does not work!
Apparently a problem with the GUI ?!

Interesting! I’d have a look at the currently open issues on GitHub, and if one doesn’t describe what you’re seeing then open a new issue:

I can confirm this behavior on my Openhab 3 installation.

I upgraded from openhab 2.5 to Openhab 3.

I got the following MQTT Channel:

UID: mqtt:topic:wzog_lcu
label: ogwz_lcu
thingTypeUID: mqtt:topic
  availabilityTopic: wzog_lcu/status
  payloadAvailable: online
bridgeUID: mqtt:broker:afc2aaab5a
location: Wohnzimmer
  - id: ogwz_lcu_cct_group_1_state
    channelTypeUID: mqtt:switch
    label: CCT Group 1 - STATE
    description: ""
      postCommand: false
      qos: 1
      formatBeforePublish: '{"state":"%s"}'
      commandTopic: wzog_lcu/light/cct_group_1/command
      stateTopic: wzog_lcu/light/cct_group_1/state
      transformationPattern: JSONPATH:$.state
      off: OFF
      on: ON

If i switch the corresponding switch item inside “Basic UI > Settings > Items” on my Windows PC i get the follwoing Karaf output:

13:45:45.401 [INFO ] [openhab.event.ItemCommandEvent       ] - Item 'ogwz_lcu_CCT_Group_1_STATE' received command ON
13:45:45.402 [INFO ] [openhab.event.ItemStatePredictedEvent] - Item 'ogwz_lcu_CCT_Group_1_STATE' predicted to become ON

I only see a log output when switching on, if i switch of there is no output in Karaf , neither an error reported, and accordingly i also don´t see a message published on the mqtt topic.

Now thanks to your hint, i opened BasicUI on Chrome on my Android phone, and voila both on and off command are visible in Karaf and also messages are published to the mqtt topic.

Did you already report that issue?