Skip to content

Create ip-assignment-watchdog.js#74

Merged
Mircho merged 4 commits intoALLTERCO:mainfrom
Dzhuneyt:main
Nov 30, 2023
Merged

Create ip-assignment-watchdog.js#74
Mircho merged 4 commits intoALLTERCO:mainfrom
Dzhuneyt:main

Conversation

@Dzhuneyt
Copy link
Copy Markdown
Contributor

I've got a triple TpLink Deco P9 mesh setup where every Shelly device has a DHCP address reservation in the mesh network.

But occasionally, whenever the mesh network is restarted, the routers get restarted in some weird order, so a bunch of the Shelly devices somehow connect to the "slave routers" in the mesh, but fail to acquire an IP address (presumably because of the address reservation).

As a result, the network is up and running, but those Shelly devices end up in a limbo state (without an IP assignment from DHCP), until they themselves are restarted. The problem is magnified when you've disabled the AP of those Shelly devices, because then you can no longer connect to them to restart from the web admin, and they also didn't get an IP from the router, so you can't access them by IP either. Essentially, you have to flip electrical breakers, which is a hardware fix, but the script here is a software auto-healing fix to the same problem.

Copy link
Copy Markdown
Contributor

@Mircho Mircho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good solution. Can I ask you to also describe in the manifest - https://github.com/ALLTERCO/shelly-script-examples/blob/main/examples-manifest.json

let pingTimer = null;

function checkForWifi() {
Shelly.call("WiFi.GetStatus",{}, function (response) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can replace this with a synchronous call Shelly.getComponentStatus. It's more robust.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mircho good suggestion. I didn't know about this utility function. Refactored.

@Mircho Mircho merged commit a4a7df9 into ALLTERCO:main Nov 30, 2023
@Mircho
Copy link
Copy Markdown
Contributor

Mircho commented Nov 30, 2023

Thank you for your contribution!

@wimleers
Copy link
Copy Markdown

wimleers commented Dec 1, 2023

Could you please expand this to include Ethernet in addition to WiFi? 🙏

My Shelly Pro 3EM is connected via Ethernet to a dumb switch, which is connected to my ISP's modem/router. In case of a power interruption, the Shelly boots faster than the modem/router — so essentially the same problem.

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

Successfully merging this pull request may close these issues.

3 participants