first commit

This commit is contained in:
Souti
2025-03-06 11:09:58 +01:00
commit 11f7d440ff
330 changed files with 38306 additions and 0 deletions

41
withings.sh Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/bash
cd /opt/domoticz/scripts/
withings=`php withingjd.php`
#poids=$withings |awk -F "," '{print $3}'
#seche=php jd.php |awk -F "," '{print $5}'
#mg=php jd.php |awk -F "," '{print $7}'
arr=$(echo $withings | tr "," "\n")
i=0
j=7
mg=0.0
pds=0.0
for x in $arr
do
#echo "> [$x]"
i=$((i+1))
if [ "$j" -eq "$i" ]
then
mg=$x
echo "mg> [$x]"
fi
if [ 3 -eq "$i" ]
then
pds=$x
echo "pds > [$x]"
fi
done
#echo $mg
if [ "$withings" != "" ]
then
json="http://localhost:81/json.htm?type=command&param=udevice&idx=327&nvalue=$mg&svalue=$mg"
json2="http://localhost:81/json.htm?type=command&param=udevice&idx=326&nvalue=$mg&svalue=$pds"
#echo $json
curl -s -i -H "Accept: application/json" $json >/dev/null
curl -s -i -H "Accept: application/json" $json2 >/dev/null
else
echo "echec de recuperation"
fi