How to use painless mesh with node red

see https://github.com/gmag11/painlessMesh
this is mesh technology for esp8266 family of wifi microcontrollers is the a node available to be part of this mesh technology.

i am running a raspberry pi zero as a master which has a node red running on it . this then collects data and shows it on a dashboard . i am using mqtt nodes to handle this now. but this creates a dependency with router and rssi value is bad for distant client modules .So i am planning to move my esp8266 client's to mesh technology which makes them router independent.

a solution is to use esp32 or esp8266 to receive and pass data by uart to raspberry pi , but is there a clean solution.

I have not met this before, but it appears to be dedicated to ESP hardware, it seems it will only run on those devices.

Are you sure it is reliable? I see it has not been updated for two years, and there are a number of unaddressed issues at Issues · painlessMesh / painlessMesh · GitLab

I think you have already stated the best solution.

A device is either part of a mesh, which the device running Node-Red most likely wouldn't be... Or the closest one acts as a go-between to the device running Node-Red.

And as a mesh is generally meant as the communications backbone, the data itself would possibly be best using MQTT across the whole mesh anyhow.

Perhaps like this? (just from a quick Google... and it looks rather old, but again, just the first one that popped up)

https://www.arduino.cc/reference/en/libraries/esp8266-mqtt-mesh/

Here is a more current one...

Agree that the UART to Pi connection shouldn't be needed. Especially if you have a 1 or 2 ESP32's in the mix somewhere. They should be more than enough to act as MQTT hubs for the other devices.

Also noting that ESP devices already have a mesh network defined by Espressif so you might not need PainlessMesh.

ESP-WIFI-MESH | Espressif Systems