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
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.
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.
EDIT:
No issue here. Here’s my YAML (and JSON for Item and Link) - switches on and off fine.
Thing
UID: mqtt:topic:MosquittoMqttBroker:bPorchBulb
label: Bulb Porch
thingTypeUID: mqtt:topic
configuration:
payloadNotAvailable: offline
availabilityTopic: zigbee2mqtt/bPorchLight/availability
payloadAvailable: online
bridgeUID: mqtt:broker:MQTTBroker2
location: Porch
channels:
- id: power
channelTypeUID: mqtt:switch
label: Power
description: ""
configuration:
commandTopic: zigbee2mqtt/bPorchLight/set
stateTopic: zigbee2mqtt/bPorchLight/state
off: OFF
on: ON
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?
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 ?!
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
configuration:
availabilityTopic: wzog_lcu/status
payloadAvailable: online
bridgeUID: mqtt:broker:afc2aaab5a
location: Wohnzimmer
channels:
- id: ogwz_lcu_cct_group_1_state
channelTypeUID: mqtt:switch
label: CCT Group 1 - STATE
description: ""
configuration:
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.