-
Notifications
You must be signed in to change notification settings - Fork 637
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/feature/plugin] reset (switch on/off connected device) when network not available #1550
Comments
I apologize for the delay in replying :) There two parts to this: First part can be based on lwip code (networking library, implementing TCP/IP stack). IDK though whether this approach is compatible with the old lwip1.4/core 2.3.0. Due to some timing issues in SDK and esp8266 missing sending ARP, there was a method proposed to make esp ping gateway's ip every now and then: Second part can be achieved via #1521 , linking the sensor data into some flow |
In the process of adapting ArduinoJson6, I needed to have some dummy sensor that does not need any hardware but still allows to report real (and changing) data. Following my own idea from the message above, I got a working sensor class that periodically does ping. That's about it, because I am not sure what exactly should be it's output:
|
The issue raised by @wsw70 has a practical sense. Scenario I: I switch on some appliances using any of the integration like Home Assistant, Alexa etc. and suddenly the network gone. In this scenario we do not have access to any of the integration and as a result the appliances will be ON state till the point the network again restores. Scenario II: Similar to scenario I but in this case, router connected without internet as a result the integration which are mostly dependents on the internet connectivity won't work till the point again the connectivity restored. Is there any possibility to implement a rescue mode for all the relays after a configurable delay, that will make the relays in OFF mode. Request you to please think and if possible, to mark this enhancement into the next release. |
Setting pulse timer works here? Timer will continuously tick down to 0 while the relay is ON, and periodically publishing
For MQTT specifically, this was implemented as set relayMqttDisc0 off (or
Scripting can be used? Although it lacks some obviously useful operators, as it turns out https://github.com/xoseperez/espurna/wiki/RPN-Rules#mqtt-variables also might help. Note that any type of variable works (gtg edit the wiki) |
#1550 (comment) wait 30s for reconnection, perform status change after timer expires
I verified the behavior described above, but unfortunately rssi does not goes to a value -127 when disconnected from internet and which is quite logical. The main reason is that router is still connected with the home network but unfortunately it loses the internet connectivity. Moreover, as you said the implementation with mqttDisconnectReaction# for the rescue mode operation is not very firm idea because I might not use MQTT at all. Is it possible to implement an even in the wifi class itself which notify when the router loses/ restore connectivity from the external world in addition to the other events it implemented. If anyone wants to subscribe to the event, they can subscribe and implement rescue mode operation according to their choice. In my case I should be switch off all the relays if connectivity does not return back for may my 300 sec. |
Returning to the OT then - what is a definitive way to do that? Ping is one, yes. Other way is to poll connectivity services like iOS, Windows, Android, etc., It would not be part of WiFi, which is purely a physical layer here. If device is accessible externally, does the pulse suggestion above work? Until something stops pulse requests, device would stay on. Pulse time becomes such timeout. |
I have a need which is probably too specific to be included as part of the firmware: I use (among others) a Sonoff Basic behind two devices:
The idea is that when things go horribly wrong, a forced power reset of the devices can be the ultimate save. This is true for the server (it happened that I did some things remotely which cut me off and rebooting the server brought it back to a working state), and certainly for the set top box which is a big pile of [censored], provided by the largest French national fiber provider whom I would like to thank for the reliability of their equipment /s
Today I have a script which runs periodically and check whether Internet (
1.1.1.1
) is available - if not then after a few tries an MQTT message is sent which switches off the switch, waits a moment and switches it back. This is great until the machine which runs the script is not the one which is faulty (or the network, or the broker or anything else on the way).This is why I am considering to try to write a plugin which would bring this functionality right into the switch.
This post is more a quest for information (and ideally documentation) than anything else (well except if someone did not realize they had the need and are jumping on the idea :))
The text was updated successfully, but these errors were encountered: