Skip to content

Fronius Gen24: add PV curtailment support - #32823

Merged
andig merged 1 commit into
evcc-io:masterfrom
tilalx:feat/fronius-gen24-curtail
Aug 14, 2026
Merged

Fronius Gen24: add PV curtailment support#32823
andig merged 1 commit into
evcc-io:masterfrom
tilalx:feat/fronius-gen24-curtail

Conversation

@tilalx

@tilalx tilalx commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds curtail/curtailed to the fronius-gen24.yaml PV usage block, implementing api.Curtailer via SunSpec model 123 (WMaxLimPct/WMaxLim_Ena) — the same mechanism already used by sunspec-inverter-curtailable.yaml.
  • Adds "curtail" to the template's capabilities list.

Test plan

Verified against real GEN24 hardware (12 kW Symo GEN24 Plus) over Modbus TCP:

  • Confirmed SunSpec model 123 registers present and correctly named (WMaxLimPct, WMaxLim_Ena)
  • Wrote a curtailment limit below current natural inverter output and confirmed the grid meter showed increased import, consistent with AC output actually being capped (not just the register accepting the write)
  • Reverted to 100%/uncurtailed and confirmed normal behavior resumed

Implements api.Curtailer via SunSpec model 123 (WMaxLimPct/WMaxLim_Ena),
the same mechanism already used by sunspec-inverter-curtailable.yaml.
Confirmed working on real GEN24 hardware over Modbus TCP.
@github-actions github-actions Bot added devices Specific device support enhancement New feature or request labels Aug 14, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In the curtail.set switch cases you have nested set keys (e.g. set: { source: const, ... set: { source: sunspec ... } }), which is likely invalid for this template DSL; consider separating these into a proper sequence of steps rather than nesting set inside another set block.
  • The curtailed script returns an int derived from a float limit; if the surrounding system expects a float percentage like other PV limit fields, it may be safer to keep this as a float to avoid unintended truncation or type mismatches.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the `curtail.set` switch cases you have nested `set` keys (e.g. `set: { source: const, ... set: { source: sunspec ... } }`), which is likely invalid for this template DSL; consider separating these into a proper sequence of steps rather than nesting `set` inside another `set` block.
- The `curtailed` script returns an `int` derived from a `float` limit; if the surrounding system expects a float percentage like other PV limit fields, it may be safer to keep this as a float to avoid unintended truncation or type mismatches.

## Individual Comments

### Comment 1
<location path="templates/definition/meter/fronius-gen24.yaml" line_range="180-188" />
<code_context>
+        value: 123:WMaxLimPct
+      - source: switch
+        switch:
+          - case: 100 # Uncurtailed
+            set:
+              source: const
+              value: 0 # Limit disabled
+              set:
+                source: sunspec
+                uri: {{ joinHostPort .host .port }}
+                id: 1
+                value: 123:WMaxLim_Ena
+        default:
+          source: const
</code_context>
<issue_to_address>
**issue (bug_risk):** The nested `set` under the `case: 100` branch is structured differently from the `default` branch and is likely not parsed as intended.

In the `case: 100` branch you currently have a nested `set`:

```yaml
- case: 100 # Uncurtailed
  set:
    source: const
    value: 0 # Limit disabled
    set:
      source: sunspec
      uri: {{ joinHostPort .host .port }}
      id: 1
      value: 123:WMaxLim_Ena
```

whereas the `default` branch uses a single `set` block:

```yaml
default:
  source: const
  value: 1 # Limit enabled
  set:
    source: sunspec
    uri: {{ joinHostPort .host .port }}
    id: 1
    value: 123:WMaxLim_Ena
```

Because the `case: 100` structure differs from the expected pattern, the Sunspec write there may not execute. Please align the `case: 100` structure with the `default` branch (const source + one `set` block) so both paths behave consistently.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread templates/definition/meter/fronius-gen24.yaml
@andig
andig merged commit 7566a00 into evcc-io:master Aug 14, 2026
17 checks passed
@tilalx
tilalx deleted the feat/fronius-gen24-curtail branch August 14, 2026 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devices Specific device support enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants