@@ -4235,8 +4235,23 @@ def publish_json_plan(self, pv_forecast_minute_step, pv_forecast_minute_step10,
4235
4235
metric_end = self.predict_metric_best.get(minute_relative_slot_end, metric_start)
4236
4236
metric_change = metric_end - metric_start
4237
4237
4238
+ soc_sym = ""
4239
+ if abs(soc_change) < 0.05:
4240
+ soc_sym = "(hold)"
4241
+ elif soc_change >= 0:
4242
+ soc_sym = "(increasing)"
4243
+ else:
4244
+ soc_sym = "(decreasing)"
4245
+
4238
4246
slot["state"] = {}
4239
4247
4248
+ slot['state']['mode'] = soc_sym
4249
+ if minute in self.manual_idle_times:
4250
+ slot['state']['mode'] += " Idle"
4251
+ slot['state']['override'] = True
4252
+ split = False
4253
+
4254
+
4240
4255
slot["state"]["soc"] = {}
4241
4256
slot["state"]["soc"]["percent"] = soc_percent
4242
4257
slot["state"]["soc"]["percent_end"] = soc_percent_end
@@ -4289,25 +4304,44 @@ def publish_json_plan(self, pv_forecast_minute_step, pv_forecast_minute_step10,
4289
4304
if start > minute:
4290
4305
soc_change_this = self.predict_soc_best.get(max(start - self.minutes_now, 0), 0.0) - self.predict_soc_best.get(minute_relative_start, 0.0)
4291
4306
slot["state"]["soc"]["change"] = self.dp2(soc_change_this)
4307
+ if soc_change_this >= 0:
4308
+ slot['state']['mode'] = " (increasing)"
4309
+ elif soc_change_this < 0:
4310
+ slot['state']['mode'] = " (decreasing)"
4311
+ else:
4312
+ slot['state']['mode'] = " (hold)"
4292
4313
4293
4314
if discharge_window_n >= 0:
4294
4315
limit = self.discharge_limits_best[discharge_window_n]
4295
4316
if limit == 99:
4296
- # TODO: figure out the split state logic, and how to reflect it here
4297
- slot["state"]["mode"] = "Freeze discharge"
4317
+ if state == soc_sym:
4318
+ state = ""
4319
+ if state:
4320
+ split = True
4321
+ slot["state"]["mode"] += " - "
4322
+ slot["state"]["mode"] += "Freeze discharge"
4298
4323
slot["state"]["limit"] = limit
4324
+
4299
4325
elif limit < 100:
4300
- # TODO: figure out the split state logic, and how to reflect it here
4326
+ if state == soc_sym:
4327
+ state = ""
4328
+ if state:
4329
+ slot["state"]["mode"] += " - "
4330
+ split = True
4301
4331
if limit > soc_percent_max:
4302
- slot["state"]["mode"] = "Hold discharge"
4332
+ slot["state"]["mode"] + = "Hold discharge"
4303
4333
else:
4304
- slot["state"]["mode"] = "Discharge"
4334
+ slot["state"]["mode"] + = "Discharge"
4305
4335
slot["state"]["limit"] = limit
4306
4336
4307
4337
if self.discharge_window_best[discharge_window_n]["start"] in self.manual_discharge_times:
4308
4338
slot["state"]["override"] = True
4339
+ slot["state"]["mode"] += "Manual discharge"
4309
4340
elif self.discharge_window_best[discharge_window_n]["start"] in self.manual_freeze_discharge_times:
4310
4341
slot["state"]["override"] = True
4342
+ slot["state"]["mode"] += "Freeze discharge"
4343
+
4344
+ slot["state"]["split"] = split
4311
4345
4312
4346
slot["rate"] = {}
4313
4347
slot["rate"]["start"] = rate_start.strftime("%a %H:%M")
0 commit comments