MODBUS Registry Write - SOLVED

I am looking to control a Solis inverter via MODBUS without using Home Assistant.

So far I have correctly got the ESP device reading the MODBUS registers and output-ing them to MQTT.
I have spent a few days reading and trying to comprehend the documents, but I struggle with the Lambda stuff, I have very little experience with C++.

I tried to modify the example from here https://esphome.io/components/modbus_controller (about 2/3rds of the way down - the example about resetting the time)

  on_boot:
    ## configure controller settings at setup
    ## make sure priority is lower than setup_priority of modbus_controller
    priority: -100
    then:
      - lambda: |-

          int mode = 33;
          esphome::modbus_controller::ModbusController *controller = id(solis);

            // create the payload
            std::vector<uint16_t> rtc_data = {uint16_t(mode)};
            // Create a ModBUS command item with the time information as the payload
            esphome::modbus_controller::ModbusCommandItem set_rtc_command =
                esphome::modbus_controller::ModbusCommandItem::create_write_multiple_command(controller, 43110, 1, rtc_data);
            // Submit the command to the send queue
            solis->queue_command(set_rtc_command);
            ESP_LOGI("ModbusLambda", "EPSOLAR RTC set to 33");

However I am struggling with what I am doing.

I used to control the MODBUS via Tasmota and Node Red, and this is what got published to MQTT

    msg.payload = { //Inverter charging times
        "deviceaddress": 1,
        "functionCode": 16,
        "startAddress": 43143,
        "type": "uint16",
        "count": 8,
        "values": data
    };
    node.send(msg);
    msg.payload = { //Inverter charging status
        "deviceaddress": 1,
        "functionCode": 6,
        "startAddress": 43110,
        "type": "uint16",
        "count": 1,
        "values": [35]
    };
    node.send(msg);

Where ‘data’ is an array of 8 values. I want to write to write to these registers, plus the ones to set the inverter time.
I have moved across to ESPHome but this is the final bit of my setup that I need to convert.

Any help/pointers would be appreciated

I solved this using MODBUS selects

Hi, would you be able to show the YAML you used for this?