Mqtt: add limitEnergy (#11974)

This commit is contained in:
andig 2024-02-01 09:28:30 +01:00 • committed by GitHub
parent df1fcd47a7
commit e39e3b168d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -272,6 +272,15 @@ func (m *MQTT) listenLoadpointSetters(topic string, site site.API, lp loadpoint.
return err
})
}
if err == nil {
err = m.Handler.ListenSetter(topic+"/limitEnergy", func(payload string) error {
energy, err := strconv.ParseFloat(payload, 64)
if err == nil {
lp.SetLimitEnergy(energy)
}
return err
})
}
if err == nil {
err = m.Handler.ListenSetter(topic+"/planEnergy", func(payload string) error {
var plan struct {