Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 107665

Shell_command sensor for last modified date of files

$
0
0

Hello,

I would like to implement a shell_command sensor to get the last modified date of certain files in a directory. The command executes successfully from a VSCode terminal, but I can’t get it to work as a sensor.

Config:

- platform: command_line
  name: Last backup date media
  command: 'find /media/Upload -type f \( -iname \*.jpg \) -printf "%T+\n" | sort | tail -n 1'

If I run this from the VSCode add-on I get the expected result: 2022-03-14+00:29:11.1575092970, but not from the sensor. Debugging logging does not show any additional information:

2022-03-15 21:15:57 DEBUG (SyncWorker_3) [homeassistant.components.command_line.sensor] Running command: find /media/Upload -type f \( -iname \*.jpg  \) -printf "%T+\n" | sort | tail -n 1

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 107665

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>