Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFiManager and painlessMesh together #850

Open
kbssa opened this issue Mar 15, 2019 · 20 comments
Open

WiFiManager and painlessMesh together #850

kbssa opened this issue Mar 15, 2019 · 20 comments
Labels
Documentation Flagged for docs Example Good First Issue PR for newbs

Comments

@kbssa
Copy link

kbssa commented Mar 15, 2019

Anyone here have tried to combine WiFiManager and painlessMesh or at least know that is it feasable to use both in the same code.

My application really needs the WiFiManager captive portal like, but I have no idea on how to implement it with the painlessMesh.

If anyone coulp point me to the right direction, I would appreciate a lot.

@pranjal-joshi
Copy link

I also have similar requirements.
My logic is to attempt a direct connection with wifi station firstly. If wifi is unable to connect then switch to mesh mode.
It would be great to hear about updates about this from you!

@pranjal-joshi
Copy link

@kbssa Have you succeeded in using both of them together? I found that WiFiManager is very buggy to use. So i used ESPAsyncWebServer lib to create my own web server and with the help of ArduinoJson, I am writing my config on the SPIFFS of ESP8266!
Hope this helps! :)

@tablatronix
Copy link
Collaborator

What is painless mesh ?

@pranjal-joshi
Copy link

pranjal-joshi commented Jun 2, 2020

What is painless mesh ?

@tablatronix
painlessMesh is a library that creates a mesh network of ESPs so that they can communicate with each other without router.
Link to the painlessMesh library

@tablatronix
Copy link
Collaborator

So why would you use this with wm if its not networking based?
Or even how would you ?

@pranjal-joshi
Copy link

So why would you use this with wm if its not networking based?
Or even how would you ?

Certainly it can be used along with external WiFi networks as well. As ESP provides MODE_AP_STA, My design is considers connecting to a WiFi network to access MQTT broker directly. But if WiFi is weak or unavailable due to range issues, I will enter into mesh mode so that I can send MQTT packets over the mesh to a node which is also connected to internet, thus effectively considering that node as a bridge node of the mesh network.

@tablatronix
Copy link
Collaborator

I still do not get it, its 2 seperate things, what would prevent them from working togather?
Its the same as using 2 libraries.

@pranjal-joshi
Copy link

pranjal-joshi commented Jun 3, 2020

I still do not get it, its 2 separate things, what would prevent them from working together?
Its the same as using 2 libraries.

I never said that these 2 libs are not compatible with each other. I think @kbssa was asking for a logical approach to implement this, maybe like a pseudo-code!
Bdw, @tablatronix Please fix the ESP requires hard reset issue. This made me switch from WM to another library.

@tablatronix
Copy link
Collaborator

What do you mean ESP requires hard reset? There is no issue for that..

@tablatronix
Copy link
Collaborator

tablatronix commented Jun 3, 2020

I will see about creating an example for combinging with painlessmesh and espmesh or espnow

  • example candidate

@tablatronix tablatronix added the Documentation Flagged for docs label Jun 3, 2020
@pranjal-joshi
Copy link

What do you mean ESP requires hard reset? There is no issue for that..

While using WM v2.0.2, I faced the issue that after receiving the config, the ESP still stays in blocking mode (even though it successfully saves the config in the memory). However, with a hard reset/power-cycle, the ESP successfully retrieves config from memory and proceeds as expected.

@pranjal-joshi
Copy link

I will see about creating an example for combinging with painlessmesh and espmesh or espnow

  • example candidate

@tablatronix - This might be a good point to take a look before writing an example.
https://github.com/gmag11/painlessMesh/blob/master/examples/mqttBridge/mqttBridge.ino

@tablatronix
Copy link
Collaborator

tablatronix commented Jun 3, 2020

are you saving parameters and not wifi? you have to set shoudBreak true or else it doesnt stop the cp, or switch to using the setup menu and not wifi for custom params.

Its not a bug but kind of a throwback to v.0 that I have not figured out a good way to fix without breaking old code. ( since you are NOW allowed to skip saving wifi everytime )

@pranjal-joshi
Copy link

@tablatronix Good to know about this. In my sketch, I was trying to save both WiFi config (SSID+PASS) along with 4-5 custom params which are to be stored on SPIFFS.
If you didn't have mentioned about shouldBreak in the docs, please consider it so.

@tablatronix
Copy link
Collaborator

Ill try to find a better fix for this this week and add better callbacks for param saves.

I thought it was added to the readme but I am not seeing it ...
hmm

@tablatronix
Copy link
Collaborator

doh it was added to hotfixes ill adjust that...

Save settings
This gets called when custom parameters have been set AND a connection has been established. Use it to set a flag, so when all the configuration finishes, you can save the extra parameters somewhere.

IF YOU NEED TO SAVE PARAMETERS EVEN ON WIFI FAIL OR EMPTY, you must set setBreakAfterConfig to true, or else saveConfigCallback will not be called.

//if this is set, it will exit after config, even if connection is unsuccessful.
    void          setBreakAfterConfig(boolean shouldBreak);

@tablatronix
Copy link
Collaborator

You should test out

  // wm.setParamsPage(true); // move params to seperate page, not wifi, do not combine with setmenu!, use setSaveParamsCallback

@kubitz
Copy link

kubitz commented Sep 6, 2021

I will see about creating an example for combinging with painlessmesh and espmesh or espnow

  • example candidate

@tablatronix - This might be a good point to take a look before writing an example.
https://github.com/gmag11/painlessMesh/blob/master/examples/mqttBridge/mqttBridge.ino

@pranjal-joshi did you end up implementing this in one of your projects?

@markg85
Copy link

markg85 commented Mar 20, 2022

I'm curious about this too.
Contrary to what was said in this post earlier, I do think mesh an wifimanager should be complementary if you have a root node that lives on your normal network too. Kind of a gateway node into your mesh network.

In that case, the root node has normal plain wifi and needs to be configured as such. Hence the need for something like WifiManager.

An example with mesh + WifiManager would be an awesome starting point!

@hemangjoshi37a
Copy link

hemangjoshi37a commented Jun 7, 2022

I am curious if anyone already has this implemented in their project: painlessmesh and wifimanager coming together.
Please let me know because I am trying this to do this from very long time.
Hemang Joshi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Flagged for docs Example Good First Issue PR for newbs
Projects
None yet
Development

No branches or pull requests

6 participants