Is there a way I can run a cron job (or some other periodical script) under Hassio that will report the disk space use/available? On my other two Raspberry pi, (running Stretch) I use a simple script that runs periodically and sends my “Eventghost” server a message when usage exceeds 90%. The script looks similar to:
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
echo $output
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' | sed 's/\//./g' )
if [ $usep -ge 90 ]; then
curl "http://my-eventghost.org:portNum/?RaspPi.White.$partition.Space.Used&$usep"
fi
done
Ironically, where I need it most, on my Hassio server, I can not get this method to work. Any one have any suggestions?
Yes, I do have this working however I cant figure out how I can report this info on a periodic time. In fact, I cant seem to get it to report at all. This is what I have
Your current trigger will report whenever there is a change in the value of your disk sensor. Which is efficient. However if you really do want it to report periodically, whether the value has changed or not, use a time trigger:
trigger:
platform: time # This will match every 10 minutes
minutes: '/10'
seconds: 00
but now encounter an old problem I have never found a solution for. Assume disk percent is at 11%. To pass this message along with the 11% value the subsequent URL has to look something like
I agree that reporting disk usage only when it changes is most efficient. I really don’t need to get a report for every change but only when usage exceeds at certain amount. Therefore, I came up with this:
Old topic and that automation gives me an error so I created new one which send telegram message:
alias: Disk used more than 85%
description: ''
trigger:
- platform: state
entity_id: sensor.disk_use_percent_config
from: '85'
condition: []
action:
- service: telegram_bot.send_message
data:
message: Disk almost full (85%)
title: Disk Space problem
mode: single
That is not a more than 85% trigger. That is a trigger that will happen if the disk use changes from 85% to anything. So it would not trigger if your use went from 70 directly to 90, or if it does hit 85% then drops back to anything below 85% it will still trigger.