What is the MQTT broker, can we do without it??
You can do automation without having a PC "always on" with a MQTT broker installed and without resorting to free or not free online brokers (perhaps excellent but of dubious security)...
|
In the page that explains
what MQTT is and how it works, we said that in a domotics or automation system based on MQTT there must be a BROKER which is a "server" program (a bit like Web servers) which must always be active on a device that is always on, to wait for calls from the devices it must "serve", in our case the various peripherals (
temperature sensors,
displays,
clocks,
switches, etc.
However, it is a bit inconvenient to leave the PC always on, perhaps after installing the Mosquito program (even if it is a possibility).
You can then use an external broker on the Internet: there are websites that even offer the MQTT Broker service for free.
Maybe we should list a few here.
The weak point of these brokers is that you pass your personal data on Internet servers that belong to... who knows who... and whether they provide you the service for free or for a fee they can see your data...
Can you do without this damned MQTT Broker in a generic automation or personal home automation?
At least with a small system, we don't see why you need to already have this MQTT server in order to make just a few simple things...
Well the first answer is yes: if you use the set of VisualVision products (
TXdata,
TXtemp,
TXsoil,
DoorOpen,
8888-Display,
SuperClock,
QueueNumber, etc.) they are designed to work with a ... more "normal" HTTP , and no configuration is required for use in your local network. Indeed, you don't even need to have a local network, since
DisplayRX or
ControlHUB can create their own WiFi network.
And for remote or very remote access (even GSM) even if you don't have your own Web server, pointing any Dyndns on our ControlHUB (which also works in HTTP in the same way) solves every problem.
But what if you also want to use MQTT components from other brands?
The answer, for small automations, is still ControlHUB. In its options, by ticking a cross, you can activate its Internal Broker and voila: as long as you don't have to connect too many "always on" components (it has a limit on that!) ControlHUB alone, plus all the other things it does , can also act as an MQTT Broker and manage the messages of a small automation.
So we can imagine an automation with:
- one or more MQTT components / devices
- one or more HTTP or ModBus components / devices
- one or more personal HUBs
- an MQTT broker which can be the ControlHUB itself; and if the system is very large, well you will need to use another device as a broker or an online broker ... ControlHUB is very cool but it can't do everything!
Is it really true that there is no configuration ??
Well there's only one boring thing to do if you want to use the
ControlHUB broker (or, actually, any other broker installed on a PC or other device - you always need it), which is to
fix its Network Address.
As you know, all computers connected to a network have an IP address which is used to distinguish them and to find them.
If the MQTT broker is installed in the local network, it is essential that it has a static, or invariable, IP address within its network. This is because ALL MQTT clients (of any type) will be "pointed" towards him (usually they have somewhere in their setup options a box where you have to put the IP address or the name of the broker) in order to contact him.
If the broker's IP address changed, all the configurations of the various components / devices would go away.
But it is not difficult to fix the address: in every WiFi Router, in the settings (which are usually accessible by typing 192.168.1.1 or 192.168.1.0 or something like that on the browser bar - see the manual of your Router) there is usually a section "advanced settings", "DHCP", "DHCP utilities" where you can command the Router to always assign / fix a given IP to the device running the MQTT Broker. For example you tell him to give him 192.168.1.100 and he will always have that.
Usually the Router needs the MAC (that is some numbers) to do this: the ControlHUB MAC can be read in the WiFi / MQTT / ModBus menu.
If you use MQTT for your automation, whatever the MQTT Broker you use, this fixing is definitely to be done.
The IP of the various gadgets other than the Broker can instead easily vary.
If you use ControlHUB, but in HTTP mode (the standard of VisualVision products), this configuration is not needed - but it is anyway useful to know that if needed, it can be done!
(C) 2022 VisualVision