OK, I set this up in node-red.. i think I'm happy with it less a tidy-up and a better trigger.
Trigger - Charge
Set force charge on via Modbus
wait 4 min
check the battery mode via API (hence 4 min wait)
if battery mode force charge, then send notification success
if battery mode is not forced, send force charge command again, then wait another 4 min before checking again. (this can repeat 4 times before failing and notifying of a failure)
Target - stop charge
check battery mode is forced charge
if it isn't, do nothing (it will have been on 30 min at least by this point, so I assume there's no need to check more than once)
if it is then send stop force charge command
wait 4 min
check battery mode isn't forced charge
if it is, then send the command again ( repeat up to 4 times before failing and sending a notification)
if it is not force charge then send a notification successful.
Is my logic sound? have I missed anything?
Can anyone give a better way than checking the battery state to check the command was successful?