Skip to content

Environmental Flags

Dave Schmid edited this page Oct 6, 2024 · 2 revisions

Kasa Collector can be configured with the following environment variables:

Required Variables

  • KASA_COLLECTOR_INFLUXDB_URL: InfluxDB instance URL.

    • Example: http://influxdb.lux4rd0.com:8086
  • KASA_COLLECTOR_INFLUXDB_TOKEN: InfluxDB token for authentication.

    • Example: your-influxdb-token
  • KASA_COLLECTOR_INFLUXDB_ORG: Organization name for InfluxDB.

    • Example: Lux4rd0
  • KASA_COLLECTOR_INFLUXDB_BUCKET: InfluxDB bucket name for data storage.

    • Example: kasa

Optional Variables

  • KASA_COLLECTOR_WRITE_TO_FILE: Whether to write polled device data to individual JSON files.

    • Default: false
    • Values: "true" or "false"
  • KASA_COLLECTOR_OUTPUT_DIR: Directory where output files will be saved.

    • Default: output
  • KASA_COLLECTOR_FETCH_MAX_RETRIES: Maximum number of retries for fetching data from devices.

    • Default: 5
  • KASA_COLLECTOR_FETCH_RETRY_DELAY: Delay (in seconds) between fetch retries.

    • Default: 1
  • KASA_COLLECTOR_DEVICE_DISCOVERY_INTERVAL: How often to discover devices (in seconds).

    • Default: 300
  • KASA_COLLECTOR_DISCOVERY_TIMEOUT: Timeout (in seconds) for device discovery.

    • Default: 5
  • KASA_COLLECTOR_DISCOVERY_PACKETS: Number of discovery packets to send.

    • Default: 3
  • KASA_COLLECTOR_DATA_FETCH_INTERVAL: How often to poll devices for energy data (in seconds).

    • Default: 15
  • KASA_COLLECTOR_SYSINFO_FETCH_INTERVAL: Interval (in seconds) for fetching system information.

    • Default: 60
  • KASA_COLLECTOR_KEEP_MISSING_DEVICES: Whether to keep missing devices in the list.

    • Default: true
    • Values: "true" or "false"
  • KASA_COLLECTOR_ENABLE_AUTO_DISCOVERY: Enables/disables automatic device discovery.

    • Default: true
    • Values: "true" or "false"
  • KASA_COLLECTOR_TPLINK_USERNAME: TP-Link account username (email) for devices requiring login.

    • Default: None
  • KASA_COLLECTOR_TPLINK_PASSWORD: TP-Link account password for devices requiring login.

    • Default: None
  • KASA_COLLECTOR_DEVICE_HOSTS: Comma-separated list of device hosts (IP addresses) for manual configuration.

    • Default: None
  • KASA_COLLECTOR_LOG_LEVEL_KASA_API: Log level for Kasa API module.

    • Default: INFO
    • Values: DEBUG, INFO, WARNING, ERROR, CRITICAL
  • KASA_COLLECTOR_LOG_LEVEL_INFLUXDB_STORAGE: Log level for InfluxDB storage module.

    • Default: INFO
    • Values: DEBUG, INFO, WARNING, ERROR, CRITICAL
  • KASA_COLLECTOR_LOG_LEVEL_KASA_COLLECTOR: Log level for Kasa Collector.

    • Default: INFO
    • Values: DEBUG, INFO, WARNING, ERROR, CRITICAL
  • KASA_COLLECTOR_AUTH_MAX_RETRIES: Maximum number of retries for device authentication.

    • Default: 3
  • KASA_COLLECTOR_AUTH_TIMEOUT: Timeout (in seconds) for device authentication.

    • Default: 10