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.