How to get details about a specific Folder

How to get details about a specific Folder

Hi guys,

In this article we saw how to monitor a folder within your file system.

Today I want to introduce the Folder sensor that is strictly correlated with the previous one.

Scenario

Supposing you want to be aware of the:

  • content of a specific folder
  • total number of files within that folder
  • size of that folder
  • path of each file within that folder

Software configuration

  1. Home Assistant. I'm currently running version?2022.9.6
  2. The Folder sensor configured to monitor a specific folder

Home Assistant code (yaml) / procedure

This is the code you have to write within the sensor.yaml file to configure the Folder sensor:

- platform: folder
? ? folder: /yourpath        

Some specifics about the code / procedure above

  1. The code reported allows you to define the sensor yourpath to monitor that specific folder (yourpath)
  2. As soon as the new sensor has been configured, the entity sensor.yourpath will become available and will be ready to be added to your Home Assistant dashboard with the following specific attributes:

  • path of the folder under monitoring
  • number_of_files within that folder
  • bytes of the folder under monitoring
  • filter evntually applied on sensor definition to filter out files to be considered

Thank you for reading. ?? I hope you have enjoyed this new article.

I'm available for any feedback so, feel free to contact me or share your thoughts in the comments section below.

Your feedbacks will be very appreciated!

Meanwhile,?if you liked this article share it or?subscribe?to my newsletter?about?Home Assistant?to read all previous episodes and still up to date on latest news.

要查看或添加评论,请登录

社区洞察

其他会员也浏览了