Skip to content

Commit e7e6f58

Browse files
committed
Only add bits to the JSON if they are enabled
1 parent 98aa76c commit e7e6f58

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

apps/predbat/predbat.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4169,6 +4169,11 @@ def publish_json_plan(self, pv_forecast_minute_step, pv_forecast_minute_step10,
41694169
output["config"]["metric_battery_value_scaling"] = self.metric_battery_value_scaling
41704170
output["config"]["currency"] = self.currency_symbols
41714171

4172+
output["config"]["iboost_enable"] = self.iboost_enable
4173+
output["config"]["carbon_enable"] = self.carbon_enable
4174+
output["config"]["car_enable"] = self.num_cars > 0
4175+
4176+
41724177
minute_now_align = int(self.minutes_now / 30) * 30
41734178
end_plan = min(end_record, self.forecast_minutes) + minute_now_align
41744179

@@ -4336,13 +4341,13 @@ def publish_json_plan(self, pv_forecast_minute_step, pv_forecast_minute_step10,
43364341
slot["cost"]["change"] = self.dp2(metric_change)
43374342

43384343
# Car charging?
4339-
slot["car"] = {}
43404344
if self.num_cars > 0:
4345+
slot["car"] = {}
43414346
slot["car"]["charging_kwh"] = self.car_charge_slot_kwh(minute_start, minute_end)
43424347

43434348
# iBoost
4344-
slot["iboost"] = {}
43454349
if self.iboost_enable:
4350+
slot["iboost"] = {}
43464351
iboost_slot_end = minute_relative_slot_end
43474352
iboost_amount = self.predict_iboost_best.get(minute_relative_start, 0)
43484353
iboost_amount_end = self.predict_iboost_best.get(minute_relative_slot_end, 0)
@@ -4361,8 +4366,8 @@ def publish_json_plan(self, pv_forecast_minute_step, pv_forecast_minute_step10,
43614366
slot["iboost"]["amount_end"] = iboost_amount_end
43624367
slot["iboost"]["amount_prev"] = iboost_amount_prev
43634368

4364-
slot["carbon"] = {}
43654369
if self.carbon_enable:
4370+
slot["carbon"] = {}
43664371
# Work out carbon intensity and carbon use
43674372
slot["carbon"]["amount"] = self.predict_carbon_best.get(minute_relative_start, 0)
43684373
slot["carbon"]["amount_end"] = self.predict_carbon_best.get(minute_relative_slot_end, 0)

0 commit comments

Comments
 (0)