KnutConfig

class knut.core.KnutConfig(file: str = '/etc/knutserver.yml')

Knut configuration.

Load the configuration from a file.

The config dictionary is filled from the configuration file. The Knut objects in the YAML file with the tag !knutobject are initialize, too. If no file is found, a failsafe() configuration is loaded.

To load a Knut object from the configuration, it must be configured as following:

!knutobject
  module: module
  class: Class
  attribute: value
  ...

The keys module and class are mandatory and specify the Class and the module containing it to load. The following keys are the arguments of the classes __init__() method. For example, the knut.server.tcpserver.KnutTCPServer would be configured as following:

!knutobject
  module: knut.server.tcpserver
  class: KnutTCPServer
  address: 127.0.0.1
  port: 8080

For details about the content of the configuration file, see Configuration.

config = {'lights': [], 'local': None, 'server': None, 'task': None, 'temperature': []}

The configuration dictionary.

failsafe()dict

Returns a fail-safe configuration.