SOLVED: How to buld in Redundancy? (ESP8266)

yes, that’s what I meant with:

it ‘knows’ due to a regular blynk connection check. So thats covered.

why? (not that im planning to do so, but im curious nonetheless)

suppose the relay is on PIN D3 of the master and PIN D3 of the slave

when master is ON, PIN show +5V
if slave PIN is OFF, PIN = GND …

is that correct ?

You could potentially use a latching relay and send “pulse” to turn it on or off… So send pulse On, release, and so on… Not a good practice though as one may send On and the other Off at the same time causing unpredictable behaviour.

sure !
but when you send pulse “1” to relay, you send 5V to Slave PIN too

1 Like

an other way to test :slight_smile:

send pulse every 60 seconds from master PIN to one slave PIN

and count …

if slave received 60 pulses an hour, it’s ok, else master is down

why not ?

yes that’s correct (although its 3.3V for an ESP). I’m wondering though if i set D3 to ‘input’ first (so NOT to output) then it does not act as ground anymore!! only when SLAVE becomes active I set D3 of slave to output and D3 of Master to input.

yes…but as said, I’ve already got that part covered. An esp can check for itself whether its connected and act accordingly AND another esp can check whether the other esp is ‘alive’ and if not, act accordingly.

I don’t require a ‘check’. And I think with 2 relays im actually set:

image

as long as the ‘offline’ or ‘slave’ esp set D1 HIGH (open relay) then the other esp has full control.

which brings me back to BLYNK. How could this work. The app usually communicates with ‘Main’ and then all of a sudden has to change to ‘Backup’ should they share the same auth token? both same code with 1 exception: bool isMain = true on ‘main’ and false on ‘backup’ so they know who is who. Would that work with blynk?

07-021409

thnx, but have you seen my edit. lets call it PART TWO:

which brings me back to BLYNK. How could this work. The app usually communicates with ‘Main’ and then all of a sudden has to change to ‘Backup’ should they share the same auth token? both same code with 1 exception: bool isMain = true on ‘main’ and false on ‘backup’ so they know who is who. Would that work with blynk?

just now :smile:
hm …
I think you should have better use a new auth and probably use bridge function

@Gunner what do you think about that ?

I had a similar issue in my summer house. I solved it but making friend with a neighbor who pushes the reset button when needed for me :wink:

1 Like

LOL, good one!!

I don’t see how that could work as all the widgets connected to ‘main’ wil not be connected to ‘backup’ to if backup takes over then all my widgets won’t work anymore. I could build a copy of it obviously but that really sounds like the bad way to do things.

Then I think It would be best to solve the issue, by replacing the router/AP. Any “fixes” will probably not entirely help, as even two ESP’s can get disconnect, and what then?

1 Like

actually I’ve always had this issue with all 5 routers I have had in the past, so replacing it is an unlikely solution, I do have an additional router that was expensive and is extremely stable with which I do not have that issue. However the ‘main’ router is of my ISP so even if I replace it I wouldn’t know how to set it up such that it would work.

Having read through all of this, I think this sums-up the situation…

You’re not too worried about having total redundancy for the relay, ESP, ESP power supply etc. Although this would be nice there are too many pitfalls which could make the system less reliable.

Your main concern is the ESP losing it’s connectivity. When this happens, a reboot of the ESP might fix the problem, but more likely a reboot of the router will be needed.
You have a watchdog timer on the ESP, but it’s not been implemented very well because the watchdog is still being fed even if your ESP loses its connectivity.

Is this correct?

If so, then fixing the watchdog should be your priority, as a reboot of the ESP may fix the issue anyway.

A way of rebooting the router remotely and/or automatically seems like it would be useful.
I have a holiday home in Spain and occasionally I want to be able to reboot the router when I’m not there. For me, this scenario happens when none of the devices within the network are responding, so using a Blynk command to reboot them wouldn’t work, as that command wouldn’t make it through the router from the internet. Instead I use a SIM900 module that I can send SMS messages to. The message is checked to ensure that it’s from a pool of authorised phone numbers and I can check the status of the system, reboot the routeror reboot a couple of other devices or the network, depending on what SMS message I send.
I’m not saying that this is what you need, but maybe you should consider a system where the router will be rebooted automatically if certain criteria (such as your ESP being restarted x times and it still not being able to ping an external website) are met.
I understand your concern that this could get into a loop where the router is being constantly rebooted, but in reality, if you design the system and the reboot criteria well then it shouldn’t happen - besides, the reboot is likely to fix the issue anyway, so the only time a reboot cycle is likely to occur is if your ISP is down, in which case it won’t do any harm anyway.

Pete.

@PeteKnight yes good point. Note that I can reboot my router remotely, but I’d rather have an independently working system, so indeed when an ESP is offline for say >1 hour it should reboot. I could build in an additional ESP/relay at the router to take care off that (keeping in mind that it needs to check its own offline status as well…hmm probably better to use an arduino for that as it will be next to the router so i can use a hard line).
Rebooting ESPs though…I can’t recall one moment that that actually helped, so checking its own status and reboot based on that (which is fairly easy to program) wouldn’t achieve much…I think. Still I could consider
IF esp offline>30 min: reboot ESP
IF esp offline >60 min: reboot router.
this might have some annoying consequences though (say my eldest is playing a game and BOOM router offline) but I guess that could be ommited with a notification and some override in BLYNK…god…this is getting complex…

regardless of this all, I still think its wise to have the central unit redundant in case of e.g. critical failure… that is central is offline > 3 hours. I could let the slave sleep and wake up every hour, sync with server, check online status of main and in case of critical failure become the new central.

1 Like

How about having a Raspberry Pi, talking MQTT with ESP and NODE-RED <> Blynk.

The Pi would allow remote access to your network and further router control.

why would I? I already have access to my router through the internet and can reset it whenever I want. Point is that I want an auto-reset of the router when an esp is offline > 1 hour.

I don’t see the added value of mqtt and IRC node-red does not work well (yet) with blynk.
note that i already have a local server running on an RPI.

Wire up a sonoff to the router, re-programmed (not with Blynk, just standalone) to reboot it if after x amount of time it doesn’t receive a signal (wifi or physical) from the ESP.

1 Like

thats also a nice idea, however I alredy figured that it should be an arduino for the simple reason that that connection NEVER (relatively to ESP) fails. I can hardwire it to the router making it much much more stable. A sonoff would once more be an esp that could go offline.

note that what you suggest would not work in my situation because its usually only 1 esp that goes ‘permenantly’ offline certainly not all of them. So if I were to make it stand-alone it would hardly ever reset the router at the right time.

But enough on this part of the topic. The thing I’m really curious about is how to setup 2 ESP with the same token where one is master and the other slave ?

Same token meens, as far as Blynk is concerned, same device… thus there is no Master/Slave distinction.

Let me expand on this… same token doesn’t require same code… so you could have seperate groups of vPns for each device and thus treat them as “separate”… but I still don’t see the purpose for your double, redundant, redundancy needs :stuck_out_tongue_winking_eye: Seperate tokens, even separate projects, can still act as backups.