Skip to content

Commit

Permalink
Publish thresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
andig committed Oct 23, 2023
1 parent 85f2849 commit fd8fa61
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/loadpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,9 @@ func (lp *Loadpoint) Prepare(uiChan chan<- util.Param, pushChan chan<- push.Even
lp.publish(minCurrent, lp.MinCurrent)
lp.publish(maxCurrent, lp.MaxCurrent)

lp.publish("enableThreshold", lp.Enable.Threshold)
lp.publish("disableThreshold", lp.Disable.Threshold)

lp.setConfiguredPhases(lp.ConfiguredPhases)
lp.publish(phasesEnabled, lp.phases)
lp.publish(phasesActive, lp.activePhases())
Expand Down
6 changes: 6 additions & 0 deletions core/loadpoint_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,11 @@ func (lp *Loadpoint) SetEnableThreshold(threshold float64) {
lp.Lock()
defer lp.Unlock()

lp.log.DEBUG.Println("set enable threshold:", threshold)

if lp.Enable.Threshold != threshold {
lp.Enable.Threshold = threshold
lp.publish("enableThreshold", threshold)
}
}

Expand All @@ -266,8 +269,11 @@ func (lp *Loadpoint) SetDisableThreshold(threshold float64) {
lp.Lock()
defer lp.Unlock()

lp.log.DEBUG.Println("set disable threshold:", threshold)

if lp.Disable.Threshold != threshold {
lp.Disable.Threshold = threshold
lp.publish("disableThreshold", threshold)
}
}

Expand Down

0 comments on commit fd8fa61

Please sign in to comment.