Skip to content

Copilot/add relay functionality#2

Open
thecem wants to merge 3 commits into
masterfrom
copilot/add-relay-functionality
Open

Copilot/add relay functionality#2
thecem wants to merge 3 commits into
masterfrom
copilot/add-relay-functionality

Conversation

@thecem

@thecem thecem commented Jul 19, 2026

Copy link
Copy Markdown
Owner

This pull request implements a robust failsafe mechanism for both consumption and production limits in the HEMS relay and FNN modules. It introduces separate configuration options for production and consumption failsafe limits, ensures minimum durations for failsafe states, and adds comprehensive error handling and testing for these scenarios.

Failsafe Mechanism Enhancements:

  • Added configuration and logic for a production failsafe limit (failsafeProductionActivePowerLimit) alongside the existing consumption failsafe limit, including validation to prevent negative values. [1] [2] [3] [4] [5] [6] [7] [8]
  • Introduced minimum duration enforcement for failsafe states (failsafeDurationMinimum) for both consumption and production, with validation to prevent negative values. [1] [2] [3] [4] [5]

Production and Consumption Logic Refactoring:

  • Refactored the FNN logic to handle production and consumption failsafe states independently, including new internal state variables and methods for percent/limit conversion. [1] [2] [3] [4] [5] [6]
  • Improved the handling of relay read errors to trigger the appropriate failsafe mode and exit only after the minimum duration has elapsed. [1] [2]

Configuration and Validation:

  • Updated YAML configuration and config decoding to support the new failsafe fields and enforce validation. [1] [2] [3]

Testing Improvements:

  • Added and updated unit tests to cover the new failsafe logic, including activation, deactivation, duration enforcement, and error propagation for both production and consumption. [1] [2] [3] [4] [5] [6] [7]

Relay Module Updates:

  • Mirrored the failsafe logic and configuration in the relay HEMS module, including validation and duration handling. [1] [2] [3]

These changes ensure that both production and consumption limits can safely fall back to a configured failsafe state in case of input signal errors, with robust duration and validation logic to prevent misconfiguration and ensure predictable recovery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants