I think you can do this with a lua script on domoticz:
Thanks, but I have dumped Domoticz and will go with my own Pascal program and serial controller. It's still way too early days for any useful Controllers, although OpenHab 2 seems to be finally getting the memo. Controllers have to be more than just pretty graphs and buttons to be called a controller. Right now they are not much more than software switches.
Did you notice that Domoticz calls home two times every time you start it? I blocked that in my router.