Kostal Plenticore Plus 10: external battery management

Without you knowing what happens in the background it’s kinda pointless! :wink:
But I’ll try to strip it down a bit.

Basic understanding:

  1. I have a bunch of situations, in which I want to address one of the five:
    ** MinSoc
    ** MaxSoC
    ** BatteryChargePower
    ** BatteryMaxCharge
    ** BatteryMaxDischarge
  2. So I created a Group-Item for each of them, which is either the MIN-values or MAX-values of multiple items for each of the five depending on the situation.
  3. So, e.g. one situation says: set MinSoC to 10% and another says MinSoC to 50%, then the group-Item will assume 50% (max-value). Other way round with the group-item BatteryMaxDischarge, this will then be set to the Min-value.
  4. basically I have up to five group-items, which can assume an value. The child items of each of the five group-items get constantly updated via rules. If there’s no update, the expiration time for the group-items is 1min. After that they’re reset to UNDEF

With that in mind, I do have a rule, that runs every 20secs with my Kostal Timeout being 60secs. Basically the rule sends an update to the respective register every 20secs to keep it alive, if the gorup-item has an value.
So, as you also encountered, if you add a new command it works, but if you “remove” a command, the last known entry gets stuck in the Kostal, if there’s another command constantly updated within the timeout.

So what I do is simply count the group-items with values and write that into a global variable (or cache Map object) in my JS Scripting rules (should be similar with DSL?). On each run I compare the actual number of items with the cached one and if they differ I’ll pause the rule for 80seconds to be sure the timeout is met and then start again with updates every 20secs.

(sorry, posting my rule won’t help, as they’re tailored to my configuration and pretty messed up, I didn’t take time to restructure them as I still hoped to get a more straight forward solution.)