4. Configuration¶
This package is configured through a special configuration file, usually
located in configuration/hamas.conf. The user can set the environment
variable HAMAS_CONFIG
to define the location of the configuration
file.
The file is formatted as defined in configparser
. It consists of one
general section and a ZigBee specific section. The general section contains
information about the machine name, the location of the logging configuration
file and which communication protocols shall be used. In the ZigBee section is
defined on which port the ZigBee module is connected to the machine.
-
HAMAS_CONFIG
¶
If the HAMAS_CONFIG
environment variable is set, the file specified
in the variable will be used instead of the default one. On a Linux system
the environment variable is set as follows:
export set HAMAS_CONFIG=~/.my_hamas.conf
Example
A configuration file can look like this:
; A exemplary configuration file
[General]
machine_name = local
use_platform = false
use_zigbee = true
use_mqtt = true
use_uds = false
[ZigBee]
device = /dev/ttyUSB
[MQTT]
broker = localhost
; vim:ft=dosini
-
class
hamas.configuration.
Configuration
(conf_file=None)¶ Bases:
object
The
Configuration
class parses the configuration file and contains the retrieved information. TheAgentManager.create()
accept a instance of this class and will build the multi-agent system according to the given configuration. When importing thehamas
package, a default configuration will be created:def_config
. This default configuration is either created from the default configuration file or the one given byHAMAS_CONFIG
. This default configuration will be used by theAgentManager.create()
-
broker
¶ str – Returns the address of the MQTT broker.
-
device
¶ str – Returns the file descriptor of connected ZigBee hardware.
-
file
¶ str – Returns the path of the configuration file.
-
machine_name
¶ str – Returns the machine name specified in the configuration file.
-
use_mqtt
¶ bool – Returns if MQTT shall be used for communication.
-
use_platform
¶ bool – Returns if the platform connector shall be used for communication.
-
use_uds
¶ bool – Returns if the Unix Domain Socket shall be used for communication.
-
use_zigbee
¶ bool – Returns if ZigBee shall be used for communication.
-