Read sensor data from file

I was able to use the notify to file and store solar data to a file using automation. I followed all the recipes to get home assistant to read that file with no success and lots of frustration. I took screenshots of relevant parts of my configuration
yaml file. Any suggestion is appreciated.
Home assistant has access to the folder since I am able to add data to the file.

Please don’t post screenshots of text. People willing to help have to type them over.

Sorry about that.

template:

  • sensor:
    • name: “Salah State”
      state: >
      {% if is_state(‘binary_sensor.garage_status’, ‘on’) %}
      ‘closed’
      {% else %}
      ‘open’
      {% endif %}
  • sensor:
    • platform: file
    • name: energy
      file_path: /config/energy.txt
      value_template: ‘{{value.split(“,”),[1]}}’
      unit_of_measurement: "mwh

A good tip via the link

Please use code blocks to post code.

image

No duplicate - sensor:
Forgot quote on last mhw

      - platform: file
        name: energy
        file_path: /config/energy.txt
        value_template: '{{value.split(","),[1]}}'
        unit_of_measurement: "mwh"