Skip to content
This repository has been archived by the owner on May 26, 2021. It is now read-only.

Auto reconnect to WiFi #5

Open
WhoSayIn opened this issue Jan 6, 2020 · 9 comments
Open

Auto reconnect to WiFi #5

WhoSayIn opened this issue Jan 6, 2020 · 9 comments

Comments

@WhoSayIn
Copy link

WhoSayIn commented Jan 6, 2020

Hi,

I manage to have my setup yesterday and it worked fine until what it seems like around afternoon, then the WiFi connection dropped. (my meter is just outside of my apartment)

I even restarted my router while I was at the office but it didn't connect back so I didn't have data until I got back home, unplugged the esp and plugged it back.

Now it works fine but it most probably gonna happen again. Not really experienced in this but is it possible to put a control in the loop method, so if it's not connected to WiFi, it would reconnect?

@WhoSayIn
Copy link
Author

WhoSayIn commented Jan 7, 2020

Stopped working around 4 in the morning again :) Probably the signal is not very strong as the meter is in a cabinet outside the apartment. But when it works, it works just fine.

How was your experience?

@HanSyt
Copy link

HanSyt commented Jan 10, 2020

I have the same experience here. I think it would be handy if an option is build in to restore the connection.
However, sometimes it stays connected for days, sometimes it drops. Even sometimes after a couple of hours it reconnects (according to grafana data).

@WhoSayIn
Copy link
Author

Now I'm running a much more simplified version of this code with ability to reconnect and not to send data when it reads 0 (it happened only once in a while)

I think at this point creating a fork would make more sense. Gonna post a link soon.

@WhoSayIn
Copy link
Author

WhoSayIn commented Jan 12, 2020

I created the fork [0]

Main differences from this repository;

  • Much more simplified. Not using WifiManager, flash the LED on ESP etc.
  • Reconnects to WIFI when the connection drops.
  • Does not send the 0 values (it happened only once in a while randomly, then the graphs looked weird. Keep in mind that in my setup I only record consumption_low_tarif, consumption_high_tarif, actual_consumption, gas_meter_m3. In your case maybe it would be useful to record the 0 values)

Feel free to use it.

[0] - https://github.com/WhoSayIn/esp8266_dsmr2mqtt

@WhoSayIn
Copy link
Author

Ah, I also use D5 pin, as it was easier to do the setup compared to D2 :)

@HanSyt
Copy link

HanSyt commented Jan 12, 2020

esp8266_p1meter.zip

Added some meter readings, maybe you can use them in your fork.

@WhoSayIn
Copy link
Author

@HanSyt thanks!

Do you mind telling what they mean? Like the difference in between DELIVERY and CONSUMPTION?

Also L1, L2 and L3? :)

@WhoSayIn
Copy link
Author

Oh, I haven't had seen your fork [0] btw! I see some improvements over there!

[0] https://github.com/HanSyt/esp8266_p1meter/commits/master

@schumi2004
Copy link

I have added this to the loop function, works perfect so far.

    // * Gets called when WiFi connection is lost
    if (WiFi.status() == WL_DISCONNECTED){
        logger->println("Lost WiFi Connection! Restarting...");
        ESP.restart();
    }

note: I'm using this repo https://github.com/Diechel/esp8266_p1meter so you need to replace logger-> with Serial.

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

No branches or pull requests

3 participants