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

Question wrt setup #6

Open
erkr opened this issue May 14, 2021 · 4 comments
Open

Question wrt setup #6

erkr opened this issue May 14, 2021 · 4 comments

Comments

@erkr
Copy link

erkr commented May 14, 2021

Hi Daniel

Very nice project and very well coded. I have a concern wrt configuring process of the board. First time works great.
According the code it re-enters AP mode when connect to the WiFi fails. Two real life issues here:
-When WiFi is down, the board ends up in AP mode. Won't reconnect once the WiFi is back.
-No way to fix or adjust MQTT settings when the WiFi works.
I think adding the DoubleResetDetector library to enter AP config mode when pressing reset twice is better. That's what I'm going to try. Interested in the diff?

Best regards and thx for the great work
Eric

@daniel-jong
Copy link
Owner

Hey,

Funny that you mention this, I was running into the same issue earlier this week while trying to get everything back up and running after moving to a different house.

Thanks for the suggestion on using the DoubleResetDetector, it would be easier to use than the solution discussed in #4

If you get this working I'm more than interested in a patch or pull request 👍. It might take me a couple of weeks to merge it back as I would like to get my local setup up and running to test things out. And my Iskra AM550 is not making things easy for me 😂

@erkr
Copy link
Author

erkr commented May 17, 2021 via email

@erkr
Copy link
Author

erkr commented May 23, 2021

Hi Daniël

I attached an updated and tested version. I leave the merge to you. Basically I just made these changes:

  1. Added the DoubleDetectReset.h (commented with a link to the library) and added two configuration defines to Settings.h.
  2. Modified the setup() routine:
  • Check on double Reset and then clear the WiFi settings
  • Changed the behavior to only enter the Configuration Portal if the WiFi is NOT configured.
  1. Added a check if the WiFi is actually Connected before executing the code in loop(). If not it just waits for a reconnect (Verified, AutoConnect() enables this and that worked)

One thing I observed is that I can't use OTA to update (maybe it never worked. I my projects I always enter OTA mode explicitly, not icw the normal code)

Thanks for the great example. My Home Assistant is now successfully tracking my Power usage :-)
update.zip

Best Regards
Eric

@erkr
Copy link
Author

erkr commented May 24, 2021

Hi Daniël

Small Update: OTA works! I just needed a wired connection for my Laptop to see them.
During this OTA quest I noticed the board remained in STA+AP mode during normal operation.
That is fixed adding this line at the start of setup():

void setup()
{
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants