EEBus OHPCF: use either power estimate or envelope (#31380)

This commit is contained in:
andig 2026-07-02 16:03:29 +02:00 • committed by GitHub
parent 2e22d16660
commit c8eceb8d30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -425,24 +425,22 @@ func (c *EEBusOHPCF) apply() error {
var _ api.PowerLimiter = (*EEBusOHPCF)(nil)
// GetMinMaxPower implements the api.PowerLimiter interface, reporting the
// announced optional consumption (estimate..max) or ErrNotAvailable if none.
// optional consumption as expected min/max or ErrNotAvailable if none.
func (c *EEBusOHPCF) GetMinMaxPower() (float64, float64, error) {
entity, ok := c.connectedCompressor()
if !ok {
return 0, 0, errNotConnected
}
estimate, err := c.cem.OHPCF.RequestedPowerEstimate(entity)
if err != nil {
return 0, 0, api.ErrNotAvailable
if power, _ := c.cem.OHPCF.RequestedPowerEstimate(entity); power > 0 {
return power, power, nil
}
maxPower, err := c.cem.OHPCF.RequestedPowerMax(entity)
if err != nil {
maxPower = estimate
if power, _ := c.cem.OHPCF.RequestedPowerMax(entity); power > 0 {
return power, power, nil
}
return estimate, maxPower, nil
return 0, 0, api.ErrNotAvailable
}
var _ api.Meter = (*EEBusOHPCF)(nil)