Help getting HA to read a csv file

My goal is to have HA update a Boolean switch to reflect the current status of my security alarm. Without going into too much detail, I can get the security alarm status into a csv file. The last word in the csv file is the current status, which is either:

  • armed, or
  • disarmed

The problem is I can’t find the newly created sensor, or it’s status in HA. I created the sensor on my configuration.yaml file, using the File platform, and pointed it to the appropriate path (see code below). The config file checks out as “valid”, but after a restart, when I search for the “Alarm Status” sensor, under developer tools → states → entities, nothing shows up.

Can anyone help me figure out what I’m doing wrong?

sensor:
  - platform: file
    name: Alarm Status
    file_path: /config/uivision/alarmstatus.csv

Two things. First:

The file sensor platform reads the entries from a plain-text file and shows the found value. Only the last line of the file is used. This is similar to do $ tail -n 1 sensor.txt on the command-line.

This is what you’re expecting right? It’s not going to parse CSV. If its working its just going to take the very last line and make it the state of the sensor. Also states have a character limit, believe it is 255 characters. The rows are less then that right? If not then you’ll have issues.

Second:

Note that file paths must be added to allowlist_external_dirs.

You did this right?

2 Likes

It was the allowlist. Thank u! :slight_smile: