Apply now and off modes immediately (#108)

This commit is contained in:
andig 2020-05-06 20:54:37 +02:00 • committed by GitHub
parent 4dd1c46497
commit 01ef46d47e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -451,8 +451,12 @@ func (lp *LoadPoint) update() {
// execute loading strategy
switch mode := lp.GetMode(); mode {
case api.ModeOff:
// apply immediately
lp.guardUpdated = lp.clock.Now()
err = lp.rampOff()
case api.ModeNow:
// apply immediately
lp.guardUpdated = lp.clock.Now()
// ensure that new connections happen at min current
current := lp.MinCurrent
if lp.connected() {