daniel-jong / esp8266_p1meter

DSMR5 P1 meter to mqtt using esp8266
GNU General Public License v3.0
145 stars 54 forks source link

Question wrt setup #6

Open erkr opened 3 years ago

erkr commented 3 years ago

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 commented 3 years ago

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 https://github.com/daniel-jong/esp8266_p1meter/issues/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 commented 3 years ago

Hi Daniël I’m limited in my time, but you will get it when done😎 Best regards Eric

Sent from my mobile

On 16 May 2021, at 11:22, Daniel de Jong @.***> wrote:

 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 😂

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

[ { @.": "http://schema.org", @.": "EmailMessage", "potentialAction": { @.": "ViewAction", "target": "https://github.com/daniel-jong/esp8266_p1meter/issues/6#issuecomment-841791148", "url": "https://github.com/daniel-jong/esp8266_p1meter/issues/6#issuecomment-841791148", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { @.": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

erkr commented 3 years ago

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.
  3. 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 commented 3 years ago

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