TODO move up to timer functions
(name string, delay time.Duration, action string)
| 1471 | |
| 1472 | // TODO move up to timer functions |
| 1473 | func (lp *Loadpoint) publishTimer(name string, delay time.Duration, action string) { |
| 1474 | timer := lp.pvTimer |
| 1475 | if name == phaseTimer { |
| 1476 | timer = lp.phaseTimer |
| 1477 | } |
| 1478 | |
| 1479 | remaining := max(delay-lp.clock.Since(timer), 0) |
| 1480 | |
| 1481 | lp.publish(name+"Action", action) |
| 1482 | lp.publish(name+"Remaining", remaining) |
| 1483 | |
| 1484 | if action == timerInactive { |
| 1485 | lp.log.DEBUG.Printf("%s timer %s", name, action) |
| 1486 | } else { |
| 1487 | lp.log.DEBUG.Printf("%s %s in %v", name, action, remaining.Round(time.Second)) |
| 1488 | } |
| 1489 | } |
| 1490 | |
| 1491 | // boostPower returns the additional power that the loadpoint should draw from the battery |
| 1492 | func (lp *Loadpoint) boostPower(batteryBoostPower float64) float64 { |
no test coverage detected