Smart mqtt switch with template payload

I have a esp8266 watering system using mqtt. I have decided it is safer to offload the timer function onto the esp8266 so that if comms is ever lost with HA the valve will turn off at the appropriate time (and removes the need to manage timers etc in HA, can still send a command to turn the valve off, but this way it acts as a fail-safe). I had them set up before as a simple mqtt switch (the esp8266 controls 4 valves)

  - platform: mqtt
    name: "valve_courtyard"
    state_topic: "garden/controller/status/4"
    command_topic: "garden/controller/switch/4"
    qos: 1

what I would like to do is something like:

  - platform: mqtt
    name: "valve_courtyard"
    state_topic: "garden/controller/status/4"
    command_topic: "garden/controller/timed/4"
    payload_on: "{{ input_number.courtyard_water_time_mins }}"
    status_on: "ON"
    status_off: "OFF"
    qos: 1

however payload_on doesn’t accept a template. the value_template seems to work on reading status, not on the command - it is possible to do this or do I need to format the command as JSON
{ "state" : "ON", "time" : 30 }, or put a request for payload_on to be a template (which seems logical)

I have seen the comments to https://github.com/home-assistant/core/pull/13771 that they cannot see the use for a templated payload, yet it is already variable in that it accepts a string and light switches take templated payloads, as brightness, colour etc can be altered… That aside, what is the best way of achieving this please?

@CestLaGalere Did you find a solution for this problem?