Curtailment: distribute limits to all devices by percent (#31390)

This commit is contained in:
andig 2026-07-02 20:43:12 +02:00 • committed by GitHub
parent 949daf4670
commit eea55d282d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 147 additions and 131 deletions

View file

@ -19,7 +19,7 @@ func handleCurtailFlag(cmd *cobra.Command, v any) bool {
}
if vv, ok := api.Cap[api.Curtailer](v); ok {
if err := vv.Curtail(val > 0); err != nil {
if err := vv.SetCurtailPercent(val); err != nil {
log.ERROR.Println("curtail:", err)
}
} else {

View file

@ -52,7 +52,7 @@ const (
flagDiagnoseDescription = "Diagnose"
flagCurtail = "curtail"
flagCurtailDescription = "Curtail (0/1 to switch, only available if supported by device)"
flagCurtailDescription = "Curtail feed-in to percent (0-100, only available if supported by device)"
flagDim = "dim"
flagDimDescription = "Dim (0/1 to switch, only available if supported by device)"

View file

@ -369,12 +369,12 @@ func runRoot(cmd *cobra.Command, args []string) {
YamlSource: yamlSource.hems,
Status: struct {
Dimmed *bool `json:"dimmed,omitempty"`
Curtailed *bool `json:"curtailed,omitempty"`
Curtailed *int `json:"curtailed,omitempty"`
MaxConsumptionPower float64 `json:"maxConsumptionPower,omitempty"`
MaxProductionPower *float64 `json:"maxProductionPower,omitempty"`
}{
Dimmed: hemsInstance.Dimmed(),
Curtailed: hemsInstance.Curtailed(),
Curtailed: hemsInstance.CurtailedPercent(),
MaxConsumptionPower: hemsInstance.MaxConsumptionPower(),
MaxProductionPower: hemsInstance.MaxProductionPower(),
},