Gateway Clustering

From Yombo
< docs‎ | gateway
Jump to: navigation, search

Summary

The Yombo Gateway software was designed in such a way to allow multiple computers running the same software to interact with each other to form a cluster. The cluster peers communicate with each other using the Yombo MQTT broker. This allows each gateway to track the status of other gateways, including it's online/offline status, gateway system state information, device states, and more.

Any gateway within the cluster is able to control other devices within the cluster as if the device were locally connected. This means that any gateway can accept a device command for any gateway within the cluster and it will automatically be routed to the correct peer.

Peer types

There are two two types of peers; they they are nearly identical in functionality and can operate independent of each other if needed. This means that each node can have scenes, automation rules, accept API requests, etc.

The master peer and any joining gateway member peers run the same software and nearly perform the same functions. The only difference is that the master gateway is responsible for running the MQTT broker which secondary gateway nodes use to communicate with each other.

Peer types:

  • Master peer - Responsible for managing the MQTT broker.
  • Member peer - Connects to the master peer MQTT broker.

Use case

You want to have you primary Yombo Gateway located inside the house, away from the garage door. However, you now want to control a 'dumb' garage door, the ones with single button to open/close, but you don't want to run wires back to this controller.

In this example, all devices are configured to run on the same network using either cable or WiFi. A low cost solution would be to use a Raspberry Pi 3 as the master peer and a very low cost Raspberry Pi Zero as a member peer located in the garage.

  1. Master node - Raspberry Pi 3: 'Main House'
    • Install the [docs/gateway/quick_start|Yombo Gateway software]]
    • Configure the software as master and setup a DNS name.
    • Add any modules and configure any desired devices.
  2. Garage Node - Raspberry Pi Zero: 'Garage'
    • Connect to two simple magnetic switches connected to the GPIO for open and closed status.
    • Connect a simple relay that is controlled through another GPIO. This will be used to close and open the garage door.
    • Install the Yombo Gateway software
    • Configure the software as a member peer and select 'Main House' as the master.
    • Install the 'Garage door' and 'Raspberry Pi GPIO' modules. The Garage Door module knows how to properly operate the relay momentarily to simulate someone pressing the garage door button.
    • Create 2 new GPIO input devices - label one 'garage opened' and the other 'garage closed'. Configure the proper GPIO pin numbers.
    • Create 1 new GPIO output device labeled 'garage door controller'. Configure the proper GPIO pin number. Disable 'direct control' from the device settings page. This prevents someone from accidentally controlling the relay.
    • Create 1 new Garage Door device and label 'Garage door'. Configure it to use the previously created GPIO devices for position sensing. Configure the garage door controller device.

Now, you use the 'garage door' device to 'open' or 'close' the garage door. The garage door module will handle all the logic of validating the garage door position and using the control relay if needed.

See Also

This page was last edited on 4 September 2018.