MQTT as switching tunnel
Send switching signals barrier-free from A to B
There are cases in which switching signals are needed far away from where they are generated. One good way to bridge such distances is transmission using the Web-IO 4.0 Digital in box-to-box mode over the network. Things become difficult however when the distances are so great that the internet has to be involved as a transmission path.
In principle this would also be possible in box-to-box mode. Since there is a direct connection between the two Web-IOs, the respective routers and firewalls would also have to be configured for such a solution such that access to the local network is possible from the internet side. This is cumbersome, but also a no-go for the IT administrators in most companies.
An alternative is to use MQTT protocol (Message Queuing Telemetry Transport). The corresponding Web-IOs do not communicate directly with each other, and so there is no direct connection. Instead the two Web-IOs open a connection from within the local network to a broker in the internet.
This connection direction is non-critical and generally requires no configuration in routers or firewalls. The broker is a kind of turntable for data. The one Web-IO acts as publisher and sends an input status to the broker. The broker passes this information to the second Web-IO, which as subscriber can receive the switching status. The second Web-IO then switches its output to the received switching state.
How it’s done
- Provide power to the Web-IO and connect the IOs
- Simply connect two Web-IO boxes to the network at the corresponding locations
- Assign IP addresses
- Select a broker and set up an account (access)
- Enable and configure Web-IOs for MQTT, enable outputs for switching
- Configure input-triggered actions for MQTT publish in the Web-IO
As soon as these steps are completed, the outputs on the one Web-IO follow the inputs on the other 1:1. This works in both directions when configured accordingly.
Box-to-Box solutions offer many advantages
- In most cases no special configuration of the routers or firewalls is necessary.
- When locations change no great rewiring is required. All you need to do is connect the affected Web-IO to the network at the new location and change the IP parameters.
- Current signal states can be queried at any time from the local network using the Web interface.