[Idea] Automatically create sitemap and items from MQTT broker

Hello fellow OpenHABers.

I have an idea to make OpenHAB a little bit easier to use (for lazy guys like me) and I would love to have some feedback and/or suggestions before actually trying to implement it.

I have to say that I am no developer and my programming skills are n00bish at most.

Objective: to make openhab automatically update simple Sitemap and Items files after an MQTT client connects to the broker.
Example: I connect a switchable device to my local network and the device subscribes to a topic on my MQTT broker. The broker tells OpenHAB that a new device showed up and OpenHAB updates the Items and Sitemap files to add this new device.

Idea to Implement:
In my case, the MQTT (mosquitto) broker and the OpenHAB server are in the same ubuntu based single board computer. When a new switchable MQTT client connects, mosquitto adds the client’s info to a log file. I could make an item with the exec binding run a script that reads the log file from mosquitto, determine if a new device showed up and update the sitemap and items files accordingly.
I think the script could be written in java since the java runtime environment needs to be available anyways.

If anyone has a better idea to reach the objective, please let us hear you out.

Thank you in advance.

Please read about the mqtt homie convention :wink: