Publish devices to MQTT using homie - automatically

Hello community,
sorry for probably dump question. Is there a way to publish all my devices, currently connected to OH to publish them via MQTT using homie convention - automatically?

I know that I may do it manually via script, but for ~100 devices and each having several properties, it will be quite a job (and I hope if I add/remove device it will automatically un/subscribe that device).

Thanks,
Zimo

You might be better off describing what you are trying to achieve.
Homie devices announce themselves to the MQTT broker, and anyone else who is listening for Homie topics.

Are you trying to use openHAB as a simulator or gateway, announcing fake Homie devices (that OH could populate with data from real devices of some other technology), for the benefit of some other service?

The short answer is no.

Options include:

  • writing an external script that works with OH’s SSE and REST API to translate all the Items to MQTT and the Homie convention.

  • writing Rules in openHAB to do the same (see MQTT 2.5 Event Bus for an example of something similar).

  • writing a binding

Notice though the amount of work is completely independent of the number of Items you have. You either use Group membership, Item tagging, Item metadata, or use the API to get all of the Items. The amount of work you need to do is the same for 1 Item and for 1000 Items.

I have two gateways - one is openhab with zwave uzb, so most devices are zwave devices which do not propagate themself to MQTT.
Second one is Homey where I have some zwave, some zigbee and some legacy RF devices.

both gws are quite far from each other so I decided not to extend one network, but I decided to use two gateways instead and integrate them via MQTT.

Homey has app which is called MQTT-hub which publishes all devices to broker - so currently I was able to do one side of integration. However I was asking about other side - if there is some automated solution as in Homey.

as @rlkoshak said - it is not. S
o thank you both for help, and I’ll probably try to do it via script (or manually if I fail).

BR