Read value from text file?

I need to create a sensor by reading a value from this text file:

Array
(
    [temp] => 26.7ºC
    [local_time] => 08:06
    [lightStat] => Array

I need the sensor to return the “26.7” value. The Scrape sensor seems to only be able to find text in a web page. Anyone can guide me in the right direction as to how to do this? Thanks!

Instead of http://example.com you could try the scrape editor with file://path/to/your_file.txt
Not sure if this will work, but worth a shot.

Otherwise use the Command Line Sensor with awk/sed/grep to capture the value from the file with regex.

Home Assistant has the File Sensor integration but it’s designed to read JSON-formatted data from a file. Because your data has a custom format, you’ll need to use Skye’s suggestion (Command Line Sensor).

Thanks, I’ve modified the output to be in json format and the File Sensor works perfectly.