This repository was archived by the owner on Feb 24, 2025. It is now read-only.
File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ func (c *Control) Start() {
164
164
}
165
165
166
166
// 5. if solar production < home energy consumption && battery capacity > 5%, discharge battery
167
- wattsRequired := math .Ceil (avgHomeLoad - avgSolarIn ) * ((100 + float64 (c .config .OverDischargePercentage )) / 100 )
167
+ wattsRequired := uint ( math .Ceil (avgHomeLoad - avgSolarIn ) * ((100 + float64 (c .config .OverDischargePercentage )) / 100 ) )
168
168
if avgSolarIn < avgHomeLoad {
169
169
if wattsRequired > 0 {
170
170
metrics .SetMetricValue ("control" , "action" , map [string ]string {"action" : "discharge_battery" }, 1 )
@@ -181,10 +181,10 @@ func (c *Control) Start() {
181
181
var wattsFromGrid uint
182
182
if wattsRequired > maxBatteryDischargeWatts {
183
183
wattsFromGrid = uint (wattsRequired ) - maxBatteryDischargeWatts
184
- wattsRequired = float64 ( maxBatteryDischargeWatts )
184
+ wattsRequired = maxBatteryDischargeWatts
185
185
}
186
186
187
- wattsRequiredPerBattery := wattsRequired / float64 (len (batteries ))
187
+ wattsRequiredPerBattery := wattsRequired / uint (len (batteries ))
188
188
189
189
for _ , battery := range batteries {
190
190
if battery .capacity < float64 (c .config .MinimumBatteryCapacity ) {
You can’t perform that action at this time.
0 commit comments