Skip to content

Releases: lux4rd0/kasa-collector

v2024.10.01

03 Oct 20:29
9ad3efd
Compare
Choose a tag to compare

The release updates the Grafana dashboards to version Grafana 11.1.3. One of the main differences is an updated Device Details dashboard that supports the KP125M plug and shows the switch status for power strip plugs.

There is no collector update, but I'll push a new version of the Docker instance to be aligned with the dashboard release.

device_details

v2024.10.00 - Updated Manual and Automatic Device Detection

03 Oct 01:39
f844221
Compare
Choose a tag to compare
  1. Device Authentication Overhaul:

    • Manual Device Authentication:
      • Improved handling and prioritization of manually specified devices via KASA_COLLECTOR_DEVICE_HOSTS. Manual devices now receive dedicated authentication and polling, continuously monitoring them, even when auto-discovery is disabled.
      • Enhanced retry logic ensures devices configured manually are more robustly authenticated.
    • Auto-Discovery and Authentication:
      • Improved integration of auto-discovered devices with manual authentication, ensuring a smoother experience in mixed environments.
        Automatic device discovery remains a key feature, but with more robust handling of edge cases, it ensures that all devices, whether discovered or manually added, are correctly authenticated.
  2. Retry and Timeout Mechanism for Device Authentication:

    • New KASA_COLLECTOR_AUTH_MAX_RETRIES: Introduced a configurable environment variable to control the maximum number of retry attempts for device authentication (default: 3).
    • New KASA_COLLECTOR_AUTH_TIMEOUT: Implemented a configurable timeout setting for how long the system will attempt to authenticate a device before retrying (default: 10 seconds).
    • This retry and timeout mechanism strengthens the system’s ability to handle transient network issues and ensure reliable device authentication.
  3. Refactored Code Structure:

    • Introduction of DeviceManager:
      • Centralized device management and authentication into the new DeviceManager class, responsible for handling manual and auto-discovered devices.
      • The DeviceManager ensures consistent authentication, polling, and management of devices with energy monitoring capabilities.
      • Improved handling of emeter-capable devices, ensuring they are polled correctly and integrated into data collection systems.
    • Introduction of Poller:
      • Moved device polling logic to a separate poller.py module to better isolate responsibilities and improve maintainability.
      • Ensures that devices requiring periodic data collection are managed efficiently, reducing overall system load and improving performance.
  4. Logging and Error Handling Improvements:

    • Enhanced logging throughout the system to provide more explicit messages related to device discovery, authentication, and failures, making troubleshooting issues with manual and auto-discovered devices easier.
    • Refined error handling to ensure that failed authentication attempts or missing devices are handled gracefully, with retry mechanisms and informative log outputs.
  5. Better Control Over Device Discovery and Polling:

    • Manual and Auto-Discovery Coexistence: Refactored the system to better handle environments with manually added and automatically discovered devices. Manual devices now take precedence in polling and monitoring operations.
    • Polling Control: Devices requiring energy monitoring are identified and added to the polling schedule, ensuring consistent data collection across manual and auto-discovered devices.
  6. Stability and Performance Enhancements:

    • Refactoring the device management and polling processes has improved system stability, especially in large deployments with a mixture of manual and auto-discovered devices.
    • Reduced the chances of system failures due to network instability by implementing better retry logic, timeouts, and error handling.

v2.0.07 - Manual Devices and Authentication Updates

29 Sep 03:25
ec8f8c7
Compare
Choose a tag to compare

Release Notes - Version 2.0.07

Key Updates

  1. Upgrade to Python 3.12.6:

    • Updated the base image from python:3.12.3-slim to python:3.12.6-slim to incorporate the latest bug fixes and performance improvements.
  2. Updated python-kasa to Version 0.7.4:

    • Enhanced device support and improved stability for interacting with Kasa devices using the python-kasa library.
  3. Updated influxdb_client to Version 1.46.0:

    • Upgraded from influxdb_client==1.40.0 to influxdb_client==1.46.0 to ensure compatibility and take advantage of new features, optimizations, and bug fixes provided in the latest version.
  4. Manually Defined Device Hosts:

    • Introduced the ability to specify manual device hosts using the KASA_COLLECTOR_DEVICE_HOSTS environment variable. This allows users to define specific IP addresses or hostnames of devices they want to monitor, regardless of auto-discovery settings.
    • Updated initialization and discovery processes to respect manually defined hosts and avoid conflicts or reinitialization of devices.
  5. Enhanced Device Discovery and Initialization:

    • Refactored the discovery process to prevent conflicts between manually added and auto-discovered devices.
    • Improved handling and logging for scenarios where devices are already initialized manually, avoiding duplicate entries and repetitive logs.
    • Added KASA_COLLECTOR_ENABLE_AUTO_DISCOVERY for configurable discovery, allowing users to disable auto-discovery when manually managing devices.
  6. Improved SysInfo Handling:

    • Added normalization for fw_ver and sw_ver fields to sw_ver for consistent logging and data representation across devices with differing field names for software versions.
    • Refined the sysinfo processing function to handle new field formats and avoid missing data in InfluxDB storage.
  7. Expanded Authentication Support:

    • Introduced support for KASA_COLLECTOR_TPLINK_USERNAME and KASA_COLLECTOR_TPLINK_PASSWORD to enable authentication for devices associated with a TP-Link account, expanding compatibility with newer devices.
  8. New Environment Variables:

    • Added several new optional environment variables to enhance configurability:
      • KASA_COLLECTOR_DEVICE_HOSTS: Allows manual configuration of device IPs/hostnames for monitoring.
      • KASA_COLLECTOR_ENABLE_AUTO_DISCOVERY: Toggle for enabling/disabling automatic device discovery.
      • KASA_COLLECTOR_TPLINK_USERNAME and KASA_COLLECTOR_TPLINK_PASSWORD: For authenticating with TP-Link accounts.
  9. Documentation Updates:

    • Updated documentation to reflect new environment variables and enhanced configuration options.
    • Clarified instructions for setting up manual devices and configuring account-based authentication.
    • Added detailed explanations for all supported environment variables, distinguishing between required and optional settings.

Migration Notes

  • Environment Variable Changes:

    • Update your environment configuration to include any new variables, especially KASA_COLLECTOR_DEVICE_HOSTS if you need to define specific devices manually and KASA_COLLECTOR_TPLINK_USERNAME/KASA_COLLECTOR_TPLINK_PASSWORD for account-based authentication.
  • Docker Image Update:

    • Pull the latest image lux4rd0/kasa-collector:2.0.07 to ensure you are running the updated collector with the latest Python and python-kasa versions.

These release notes summarize the significant changes, new features, and bug fixes introduced in version 2.0.07, compared to version 2.0.06, ensuring users have the latest functionalities and enhancements for managing their Kasa devices.