Introduction
On a large scale, when we have a big automation setup like the one designed for a villa, an entire building or perhaps even bigger, like it could be the one designed for a smart city, it is required to decentralize the whole system by having a convenient number of local controller units that are able to communicate each other and work like a single big coordinated entity.
HomeGenie Interconnections
During the development of HomeGenie, there was one vision behind the whole design process, a paradigm to follow, which was the one of the Central Nervous System.
Following that paradigm, a single HomeGenie unit can thus be imagined as a nerve cell that process and transmit information through event signals. The way this information is processed by a local unit is governed by the APE (Automation Programs' Engine) and by all programs defined into it.
In fact, automation programs can receive signals (events) from any local or remote module and external services and may react generating other signals that are then processed and propagated through the system.
So each local HomeGenie can have its own intelligence but can also cooperate and handle external signals and modules in a coordinated way within a bigger interconnected system, even though heterogeneous.
Event forwarding
The quickest way to interconnect HomeGenie servers is by enabling "Interconnections → Forwarding" programs from the "Automation → Programs" page.
This kind of interconnection is achieved by forwarding of signals generated by modules on one server to another HomeGenie server. When a server receive signals from a remote module, automatically creates a local instance of that module, treating it as if it were a local one.
So every command issued on that module will be automatically forwarded to the remote server to which that module belongs to.
This also means that interconnected server can carry on automation tasks involving remote modules and that can also be conditioned by the status of remote modules.
There are various types of event forwarding:
Sensor.*
- sensors parameter updatesStatus.*
- smart lights and switches level updatesReceiver.RawData
- IR/RF remote controllers button pressMeter.Watts
- smart metering devices value updates
After activating the type of forwarding we want to use, we can configure the remote server to interconnect to, from the "Configure → Settings" page.
All modules generating events matching the type of activated forwarding programs will be so exported to the remote server as well.
On the remote server end, all modules originated from this interconnection will have the prefix HGIC:<interconnected_server_ip>.
in the domain field of the module address.
Remarks
When using events forwarding, in order to be able to control modules of an interconnected server, the HTTP security settings must be the same on both endpoints.
Interconnecting via MQTT
Another way of interconnecting servers is by using the MQTT Network program. While the event forwarding approach is meant to work as a one-to-one interconnection, this method allows many-to-many interconnections.
In fact this approach relays on the MQTT service which is a sort of "chat" service for sensors, smart devices and machines in general.
In this scenario interconnected HomeGenie servers will publish module events to a MQTT broker service so that those events will also be received by all other servers connected to the same MQTT network.
In order for this approach to work we then need an MQTT broker service endpoint that must be properly configured in the "MQTT Network" program settings dialog.
The MQTT service can be provided by a stand-alone server or it can also be installed as an additional feature from "Interfaces/Protocols" category of HomeGenie package repository (see "Installing additional drivers and features" in the Setup page), in which case the HomeGenie server itself will provide the MQTT broker service.
After MQTT Network is properly configured, we can then choose the modules to be shared with the other servers connected to the same MQTT network, by activating "Publish module on MQTT network" checkbox from the settings' popup of each module.