Config/Auto create OH-Items, can I set mqtt-topic through thing-configuration?

I have experimented with the HABApp-possibility to create openhab-items through thing.yml and thinking about of how I would like to use this possibility.

Lets us a shelly dimmer 2. I intend to use HABApp to interact with the device directly through MQTT. As a minimum I like HABApp create following OH-items for a shelly-dimmer-2-thing.

A. OH-SwitchItem (oh_item_name_state) to store On/Off-state
B. OH-DimmerItem (oh_item_name_brightness) to store Brightness-state
C. An OH-string (oh_item_name_mqtt_topic) that can hold something like “shellies/shellydimmer2-3494547406C9”

image

This way I could init the HABApp-rule with one item only (oh_item_name), and figure out path for switch/brightness and mqtt-topic internally.

The question is how/if its possible from HABApp/Config to read the the properties of the channels ie the “stateTopic”?

image

You can directly create the items through textual thing configuration.
There is no need for a rule.

If you have the openHAB items these can used to interact with mqtt.
I don’t understand why you additionally want to use MQTT from HABApp.

Think I got that from an old (many years?) reply of yours(?) in the gigantic habapp-thread. Interacting directly HABapp to mqtt would cut some time (however probably negligible in the range of 10-20ms?), but also add in complexity. If your recommendation is to go through the openhab-mqtt then that will also be my way. And I recognize this will give a cleaner solution. Thanks!

If you already have the openHAB MQTT thing than it definitely makes sense to use that.

1 Like

As my oh-things/items at the moment is a bit of a mess (inconsistent), im thinking to redo that part. Sorry for asking but you dont happen to have a python-script that parses a yml to create the oh-.things files? If not I think it would be a good project for me to further learn some python.

Concept would then be to edit the oh-things.yml file to add/remove devices, auto-create the .things-files and manually move files to openHAB-folder. Then have HABApp autocreate Items based on those things-files…

No - sorry

HABApp can already create items based on the things so you don’t have to do anything there.
It works independently of thing files so you can use it now.

I know, tested it and liked it! But it also requires or maybe better “benefits from” consistent naming and defining of the oh-things/channels which for me at present state is not up to the needed standard. I will attempt to do a python-script for this.