Promptly detect internet outages without using external services
Application June 27, 2022
The unavailability of the connection to the public network can be a serious problem whether you have to manage a data center or more simply the home connection, especially when equipment and services depend on access to the public network.
If Avior is connected to your WiFi network, it can easily detect service interruptions and use its cellular connectivity to report the problem by making a phone call, sending an SMS message, a chat message, an email or an HTTP call to a server...
We can use Avior.Suite software by connecting Avior to a Personal Computer with the appropriate USB cable or accessing the device's account cloud by entering the identification (WebId) and password.
We assign the name WiFi.Internet to variable 1 and to its expression the remainder of the division of parameter D26/2 (recalling its value with $D26). This parameter contains the current status of the internet connection:
0 = no connection
1 = connection available through WiFi network
2 = connection available through cellular network
3 = connection available through both WiFi and cellular networks
The WiFi connection is present in conditions 1 and 3 and absent in conditions 0 and 2.
The remainder of the division by 2 of an odd number always makes 1 while an even number always makes 0, so this operation allows us to have as a result 1 when WiFi connection is available (regardless of cellular connection status).
The variable is updated every 60 seconds.
More info on variables available HERE.
Let's add a simple rule to be triggered when the connection is restored.
Let's add a simple rule to be triggered when the connection is lost.
You can also add rules to send messages in the event of a power failure, or when a temperature threshold is exceeded, detected with a probe connected to an analog input or with a remote Bluetooth sensor.
In addition to sending messages, you can activate outputs, control other interconnected devices, publish an MQTT topic ...
You can check the connection status at any time by consulting the status of variable 1 (WiFi.Internet).
HERE you can find the complete Avior documentation.