Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Engine: Regulator with Bypass Relay #70

Merged

Conversation

ghisch
Copy link
Contributor

@ghisch ghisch commented Feb 2, 2025

Hello,

This PR fixes #49
This PR is a follow-up of #51

Add bypass engine mode for solar router

This PR adds a new engine mode that combines the benefits of both the regular engine (smooth regulation) and the on/off engine (relay control) by automatically switching between them based on power conditions.

Goal

Using a dimmer like a robotdyn triac allows a fine control of the load. Triac emits the most heat when they are set to 100% (when all current flows) for a sustained period of time.
This approach optimizes energy efficiency by using the relay for full power situations while maintaining smooth regulation for partial power needs.

New files added:

  • solar_router/engine_regulator_with_bypass.yaml: New engine implementation
  • solar_router/bypass_relay.yaml: Bypass relay control configuration
  • docs/en/engine_regulator_with_bypass.md: English doc of the new enegine
  • docs/fr/engine_regulator_with_bypass.md: French doc of the new enegine translated from English with ClaudeAI

How it works:

  1. The system operates like the regular engine, using smooth regulation (0-100%)
  2. When the router_level stays at 100% for bypass_timer_threshold regulations:
    • The bypass relay is activated
    • The regulator is set to 0% (in this order)
  3. When power demand decreases (router_level < 100):
    • The regulator at the desired level
    • The bypass relay is deactivated (in this order)

Notes:

  • I applied the regulator_opening & energy_divertion logic directly to the components. Like this, it also works when solar routing is Off
  • Compared to previous PR, I switched full_power_timer to a Number Template component. It's not exposed to HA.
  • As mentioned in previous PR, in order to avoid code duplication, I had to rename regulation_control of the relay to relay_ regulation_control, and regulator_gate_pin of the relay to relay_regulator_gate_pin. Without this modification, TRIAC and Relay were sharing the same values and regulation was impossible. ⚠️ This is a breaking change ⚠️ . I updated the corresponding doc. I did not updated the PoC YAML files esp32*.yaml, esp8266*.yaml etc at the root folder of the repo as they seems already outdated.
  • Tested: works great 🚀

@XavierBerger XavierBerger changed the base branch from main to feat/engine_progressive_with_bypass February 2, 2025 09:38
@XavierBerger
Copy link
Owner

XavierBerger commented Feb 2, 2025

OK, I will then merge it on a dedicated branch and review it in detail before merging in main.
I plan to rename engine.yaml to engine_progressive.yaml in contrast with engine_on_off.yaml. If you don't mind, I'll also rename your engine engine_progressive_with_bypass.yaml. The one with 3 channels may also have the keyword progressive in its name.
By the way, is progressive sounds good for you or do you have a better idea to mean that regulation is variable?

@XavierBerger XavierBerger merged commit d2a9462 into XavierBerger:feat/engine_progressive_with_bypass Feb 2, 2025
1 check passed
@ghisch
Copy link
Contributor Author

ghisch commented Feb 2, 2025

Ok great 🚀 Thanks !

I agree for the name change. I tried to think, either we define engine behavior based (engine_progressive), or engine component based (engine_dimmer).

Ex:

1. Behavior Based

toogle or step or onoff
progressive or variable

  • engine_progressive
  • engine_toggle
  • engine_progressive_bypass
  • engine_progressive_2toggles_bypass

2. Component based

dimmer or regulator or variator
switch or relay
bypass or bypassswitch or bypassrelay

  • engine_1dimmer
  • engine_1switch
  • engine_1dimmer_1bypass
  • engine_1dimmer_2switches_1bypass

Option 1 is clearer, Option 2 is more structured. I personally favor option 2.

@XavierBerger
Copy link
Owner

Thanks for this very interesting feedback.
I also like Option 2. I think I'll integrate into the next MR to have only one big breaking change.

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.

[FR] Bypass relay
2 participants