このスクリプトを実行して、OctoPrint (3d プリンター) が冷却されているかどうかを確認しています。
使用することで
#octocmd status
temps:
bed: actual=26.0, target=0.0, offset=0
tool0: actual=54.9, target=55.0, offset=0
i will get a data like this.
bashスクリプトでこれを行ったので、印刷されていることを確認できます
/usr/local/bin/octocmd status | grep 'target=200.0, offset=0'
if [ $? == 0 ]; # if target 200; enter if
then
echo "Printing in progress, Script will check back in 5 minutes"
/usr/local/bin/octocmd status
sleep 5m
クールダウン中に見るべき
tool0: actual=189.3(decreasing), target=0.0, offset=0
ただし、ELSE関数を試して、冷却されているかどうかを確認することに固執しています。まあ言ってみれば
actual= (**range from 40.0 to 180**), target=0.0, offset=0
したがって、actual=XXX から任意の範囲のデータを検出する方法について、謙虚に助けを求めたいと思います。
これは現在私のコードです:
while [ 1 ]
do
/usr/local/bin/octocmd status | grep 'target=200.0, offset=0' &> /dev/null # grab string $ remove error
if [ $? == 0 ]; # if target 200; enter if
then
echo "Printing in progress, Script will check back in 5 minutes"
/usr/local/bin/octocmd status
sleep 5m # check every 5 minutes
elif [ -z "/usr/local/bin/octocmd status | /*CHECK IF PRINTER IS COOLING DOWN OR NOT, CHECK ACTUAL=30 ~ 180 */"' 2>&1 /dev/null ];
then
if [ $? == 0 ];
then
#enter here if target is cooled with no print job
/usr/local/bin/octocmd status
fi
done