The following diagram shows an overview of the communication from and to the Gateway.
Components running on the BeagleBone
This sections describes the daemons running on the BeagleBone.
This is the main daemon. It communicates with the master (using rs232) and the power modules (using rs485) and provides the Webservice over HTTPS. This webservice provides the local gateway interface (on https://OpenMotics.local/) and is used by the cloud to perform action like setting outputs and thermostats.
The daemon in implemented in openmotics_service.py and run in supervisord. See  for more information on how to use supervisord.
The vnp_keepalive daemon periodically asks the gateway whether the vpn connection should be opened. The daemon includes status information (about inputs, outputs, thermostats and power modules) in the requests, this makes sure that the status information in the cloud is alway updated in near real-time. The status information is fetch from the openmotics daemon using a local HTTP connection (the HTTP socket is configured to only respond to requests from localhost and cannot be used from external hosts: the encrypted HTTPS connection has to be used from external hosts).
The cloud has to ability to perform some basic configuration and actions using the keepalive messages:
- The cloud can control the interval between two consecutive keepalive messages from the gateway by setting the sleep_time.
- The cloud can ask the gateway to perform an action, this can be used to perform actions when the vpn connection is closed.
The status information send to the cloud is defined by the mode in the vpn_keepalive daemon. For instance: when configuring his system, the cloud shows the user the last pressed inputs, this makes it easy to identify the inputs. However when the configuration is over, the cloud does not need the last pressed inputs. The last pressed inputs are only sent when in init mode, this mode is set by the cloud.
The daemon in implemented in vpn_service.py and run in supervisord.
The leds on the toppanel are driven by the led_service. The led_services communicates with the top panel using i2c and exposes the functionality to set the leds to the other daemons using dbus.
The led_services also keeps track of the button on the top panel: if the button is pressed for more then 5 seconds, the gateway is put in authorized mode. When an action that requires authorized mode (for instance creating a new user) is received in the openmotics daemon, the openmotics daemon uses dbus to communicate with the led_service daemon to check if the gateway is in authorized mode.
The daemon in implemented in physical_frontend_service.py and run in supervisord.
Run once at startup: sets the correct input/output mode on the gpio pins of the BeagleBone. This script is located at /opt/openmotics/bin/configure_ports.sh and is run in supervisord.