Would be more elegant, to have your own mqtt-connection to broker, using custom lua-program, or only a simple shell-script with mosquitto, depending upon the amount of messages, you have. Running official openwrt on a large fleet of RUT955s, this way I connect AWS-IoT to ModBus/RTU devices, and vice versa. Retain_flag no problem, then, of course.