How to use Template to create a sensor, where the attributes of sensor are extracted from the data of an existing input text entity?

For example, the status value of this text entity is formatted as: Date: 2024-05-09, kWh: 10.05 | Date: 2024-05-10, kWh: 10.15. The desired attributes of sensor would be as follows:

  • date: ‘2024-05-09’
    kwh: 10.05
  • date: ‘2024-05-10’
    kwh: 10.15


The text to be stored in an input text is limited to 255 characters, so you will not be able to store more than 8 days of data like this.
How does this input text get updated? Maybe you can use a trigger based template sensor instead