File sensor is slow to react, can I speed up the reaction time?

I created a file sensor to read a log file and it works fine but it takes 5 - 15 secs to react to the change in the log file. Is there a way to speed up its reaction time? I know with template sensor, I can specify an entity_id to watch for state changes but that doesn’t work for the file sensor.

Thanks


sensor:
  - platform: file
    name: Dashboard
    file_path: /home/homeassistant/.homeassistant/conf/appdaemon.log
    value_template: '{{ value.split("Hello")[1] }}'
1 Like

I changed to command line sensor which has a scan interval. Works great now.


sensor:
  - platform: command_line
    name: Dashboard
    scan_interval: 1
    command: 'tail -n 1 /home/homeassistant/.homeassistant/conf/appdaemon.log'
    value_template: '{{ value.split("Hello")[1] }}'
1 Like