Write your own app config file

For the moment, the config files should be put in a folder config_files where the software is launched. It will be improved in the future.

There is 3 parts in the configuration file.

Hardware

Declare which device you need to use.

Hardware :
    Door: # Doors used
        # virtual ID: actual ID
        D1: '001' # name device '001' as 'D1'

    Food_delivery: # Food delivery used
        # virtual ID: actual ID
        F1: '101' # name device '101' as 'F1'

There are two major device group Door and Food_delivery (name cannot be changed). In the device group, you can declare which devices you want to use, and also can give those device a name.

Declare device with their actual ID and give it a name (virtual ID).

Door: # device group
    # device name mapping. virtual ID: actual ID
    D1: '001' # name device '001' as 'D1'
    D2: '002' # name device '002' as 'D2'

You still can use old-style declaration.

Door: ['001', '002']

# equals to
Door:
    '001': '001'
    '002': '002'

With the name mapping table, we can use virtual ID in Command section, and change the device easily (by changing the actual device ID which virtual ID maps to instead of finding and replacing used site in whole config file).

Command:
    C1:
        action: close_door
        output target: D1

Task

This key is describing the automated task with the mode and the triggers to associate. The platform is available with only one mode at the time but with as many you want triggers. Take a look in the task and trigger documentation to see what is available.

Task:
    mode : SequenceTask
    mode options :
        max_trials: 100
    trigger :
      - name: Keyboard
      - name: Server

Command

This part is matching the command send by the user and the actions (1 or more) and the targets (one or more). if you want to specify some value option from the user command at running time, you need to add options specifying the option name. (see the config example file for more detail on it).

Declare commands which you can type at Input text field.

Command: # Command section
    C1: # command
        action: close_door
        output target: D1

Command can be a group of sequential commands.

Command: # Command section
    C1: # command
      - action: close_door
        output target: D1
      - action: 1 # sleep 1 sec
      - action: open_door
        output target: D1

The detail command declaration:

  • action

    Name of the action, which defined in actions.py. It can be a name of list of name. If you give a digit number, hive will consider it a sleep command.

  • output target

    used device. can be virtual ID, actual device ID, device group or list of above.

  • options

    command options in list type. the extra arguments to the actions.

    special options:

    • output_target

See a full example of a config file.