githubEdit

Configuration

Configure the API

Configuration is done via environment variables (usually located in .env file) and controller config file.

Environment variables

Environment variables are set using a .env file located in the root of the project. You can also set custom file location by exporting ROBOPIPE_API_ENV environment variable. You can find an example in .env.example. To modify these values simply copy the file into .env and change the desired keys.

circle-info

Please note that changing the CORS_ORIGINS to a value that does not include the URL of these docs will render the Try it and stream player functionality in these docs unusable.

  • HOST - domain name or IP address of the host that serves the API

    • DEFAULT - 0.0.0.0

  • PORT - Por on which the API is running

    • DEFAULT - 8080

  • CORS_ORIGINS - comma separated list of allowed origins for the CORS preflight requests

    • DEFAULT - "*"

  • CONTROLLER_CONFIG - path to the config.yaml file defining controller configuration.

    • DEFAULT - empty

Controller configuration

Controller configration is done using a config.yaml file located at path specified by CONTROLLER_CONFIG environment variable. In this path a config.yaml file and a directory named hw_definitions must be present.

config.yaml

This file should contain one key named comm_channels with the follow structure:

Bus configuration

  • <bus_name> - Your choice, but has to be unique

  • type options:

    • MODBUSTCP

      • hostname - hostname of the Modbus server

      • port - port of the Modbus server

    • MODBUSRTU

      • port - path to the Modbus device

      • boudrate - baudrate of the Modbus device

      • parity - parity of the Modbus device (N / E / O)

    • OWBUS

      • interval - interval of values updating

      • scan_interval - new devices will be automatically assigned

      • owpower - Circuitarrow-up-right of owpower device (for restarting bus; optional parameter)

Device configuration

  • <device_name>: the device will be available in the API under this name. Has to be unique.

MODBUSTCP & MODBUSRTU

  • model_id - assigns a Modbus register map (examples: xS51, xS11), see hw_definitionsarrow-up-right.

  • slave_id - slave address or unit-ID of the Modbus device.

  • scan_frequency - an optional parameter, determines how often values are read from the device (Default value is 50).

OWBUS

  • type - 1-Wire sensor type, options: [DS18B20, DS18S20, DS2438, DS2408, DS2406, DS2404, DS2413]

  • address - 1-Wire device address

HW definitions

Last updated