- Platform information:
- Hardware: Intel Core i3-6100T/16GB/256GB SSD
- OS: Ubuntu 22.04.3 LTS
- Java Runtime Environment: OpenJDK Runtime Environment Zulu17.46+19-CA (build 17.0.9+8-LTS)
- openHAB version: openHAB 4.1.1
- Issue of the topic: MQTT Configuration
First, thanks so much to the contributors of this project. It’s an incredible project and I know that folks have dedicated a great deal of time making it so wonderful. Thank you.
I am using zigbee2mqtt and zwavejsui. I have them setup with zigbee and zwave devices connected to them. I have a Mosquitto Eclispse MQTT server running, and zigbee2mqtt and zwavejsui are sending messages to the broker. I can see the messages whizzing by in MQTTX and MQTT Explorer. Fantastic. I’m pleased.
In OpenHAB, I’ve used the GUI to create the MQTT Broker Thing, and now it’s time to configure the Zwave and Zigbee Things. It’s really nice to click through the GUI to create the MQTT Generic Things for each device and create the channels. Nice. My code in the GUI looks something like:
label: F2_BonusRoom_Fan
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:8fd56e1f3c
channels:
- id: Dimmer
channelTypeUID: mqtt:dimmer
label: F2_BonusRoom_Fan
description: null
configuration:
min: 0
max: 99
commandTopic: zwave/nodeID_4/switch_multilevel/endpoint_0/targetValue/set
step: 5
stateTopic: zwave/nodeID_4/switch_multilevel/endpoint_0/currentValue
off: "0.0"
on: "99.0"
This works swimmingly.
One thing that I learned early on with OpenHAB is that I wanted my Items to be textual files, and that was a great decision. I have several hundred Items, and it’s -so- much easier to make wide/sweeping/repetitive edits than clicking through the GUI.
Up until this point, all of my Things have been created in the GUI and all my Items have been created with textual files.
My SpiderMan sense is suggesting that I’m going to want to have all these MQTT Things (and associated channels) to be defined in a textual .things file(s). (I suspect I’m going to want to make major changes to my MQTT Topics and I’ll want to make sweeping changes). I’m an MQTT rookie,
The problem in my mind (laziness?) is that I don’t particularly understand the Things documentation here: MQTT Things and Channels - Bindings | openHAB, and there are a million options in there that someday I’m sure I’ll understand (it took me two years to understand all of the components of an textual Item configuration.
I’ve figured out that the .things file should look something like this:
Thing mqtt:topic:F2_BonusRoom_Overhead_Light "F2_BonusRoom_Overhead_Light" (mqtt:broker:8fd56e1f3c)
{
Channels:
Type dimmer : dimmer "F2_BonusRoom_Overhead_Light"
[
stateTopic="zwave/nodeID_2/switch_multilevel/endpoint_0/currentValue",
commandTopic="zwave/nodeID_2/switch_multilevel/endpoint_0/targetValue/set",
min=0,
max=99,
step=5
]
}
It would be great if the Code segment in the GUI matched the .things code segment in the textual .things file. Or, in other words, I could click through the GUI and it would generate a textual .things file segment for me, rather than me having to plug through documentation and forums especially the first time, while learning, etc. Or another option would be to take the GUI Code segment and just plop it into a mythings.things.yaml file in the things folder.
I’m hoping that maybe I missed something in the documentation, and someone will tell me. Whoa! There is a much better way to solve this problem!
Appeciate the help as always!
SixO