Setting time of sensor data

Hi,
I have data coming off my solar system, which is time stamped, however it may take time before it gets written to a file that HA accesses or HA reading the data in the file, so the time in HA is often not correct, I assume its the time HA reads the file.

in my configuration file I have a sensor:

- platform: command_line
    name: Real_Time_Power
    command: 'tail -n 1 /config/externaldata/solar.txt'
    value_template: '{{ value_json.Real_Time_Power }}'
    unit_of_measurement: "W"

solar.txt format is:

{"Date":"2021-04-09","Time_Updated":"14:05","Real_Time_Power":"4016","Solar_Today":"22.7"}

How can I set the time of the data within HA to what is sent form the solar inverter.

Is there also a better way of reading the data from the file ? I did try the below setup but it didn’t work.

 -platform: file
    name: Real_Time_Power
    file_path: /config/externaldata/solar.txt
    value_template: '{{ value_json.Real_Time_Power }}'
    unit_of_measurement: "W"

Thanks for any help