Thanks for sharing. The only things i can recommend is you might look at Design Pattern: Expire Binding Based Timers which could simplify the logic a little.
And you should use the method instead of the action for send command. See https://docs.openhab.org/configuration/rules-dsl.html#sendcommand-method-vs-action