I started some project recently, just to reduce number of modifications after each configuration change on ESP device or in home network. I may not be the easiest solution on the earth but it works for me, so maybe it will work for you Take a look at https://github.com/adrb/mqradar
Would you have link to how to setup mDNS? - I am struggling with the same issue and do not want fixed ip for my mqtt broker.
MDNS is pretty simpleā¦ if youāve got the ESP8266mDNS library included in your sketch, just do a:
MDNS.begin("hostname");
I usually set my hostnames to a project prefix, and the chipId, so:
String hostname="ProjectPrefix-" + String(ESP.getChipId());
Thatāll create a projectprefix-aaaaaa.local in MDNS (whatever the chipId is) ā ensuring every device is unique.
I also use the SSDP protocol to expose the units to SSDP-aware systems (like Windows Explorer), which makes them show up in the Network area under āOther Devicesā. The nice thing about that is you can also expose the management URL for it, so when I double click on their icons in Explorer, it just opens right up.
SSDP is trickier, though ā the ESP library for it is buggy and doesnāt publish the metadata correctly, so they donāt show up in Windows. I had to write my own code to do it. (But they will be found by the UPnP discovery code in OpenHab, if you write your own binding.)
What I have done in many of my ESP devices is to actually make them call OH /rest/item to create the thing/item themselves. No need for other configuration/paperui inbox, etc. Just make a GET call to /rest/items/someName and if it returns 404, you need to make a PUT reqeust to create it. Once that receives a 201 (created) you can start POSTing states to it. This is usually how I do it.
Not sure if this is really related but I created a simple ESPNow gateway that other esp devices can use to transmit messages in a very basic json format that are then routed to OH by whatever technology you like (I use MQTT). New devices only need to know the gateway address.
Pros:
no wifi required if your gateway uses an Ethernet connection (mine does)
You only need to change the gateway when OH connection changes
Cons:
No encryption between sensors and ESPNow gateway
Not really plug and play but easy enough with MQTT binding. However your own gateway could of course be made smarter
Gateway is a single point of failure