I have found that I can use the following shell scripts to perform certain actions with my Envisalink:
Report the current status of the alarm:
Code: Select all
curl -sS 'http://user:user@192.168.1.8/' | tidy --output-xml yes --add-xml-decl yes --doctype omit --quiet yes --show-warnings no | sed -e 's/ /foobar/g' | xpath -q -e '//*[@id="CONTENT"]/table/tr[2]/td[2]/table/tr/td[2]/text()'
Code: Select all
curl -sS 'http://user:user@192.168.1.8/2?[b]A=3[/b]&p=1&X=1470'
Code: Select all
curl -sS 'http://user:user@192.168.1.8/2?[b]A=4[/b]&p=1&X=1470'
Full script for sharing: (usage would be: <scriptname> <on/off/status>
Code: Select all
# If $1 = status
if [ $1 == "status" ]; then
# Report status:
curl -sS 'http://user:user@192.168.1.8/' | tidy --output-xml yes --add-xml-decl yes --doctype omit --quiet yes --show-warnings no | sed -e 's/ /foobar/g' | xpath -q -e '//*[@id="CONTENT"]/table/tr[2]/td[2]/table/tr/td[2]/text()'
exit
fi
# Loop until status contains "Armed"
if [ $1 == "on" ]; then
while [[ "`$0 status`" != *Armed* ]]; do
curl -sS 'http://user:user@192.168.1.8/2?A=3&p=1&X=1470' > /dev/null 2>&1
sleep 1
done;
exit
fi
# Loop until status is "Ready"
if [ $1 == "off" ]; then
while [[ "`$0 status`" != *Ready* ]]; do
curl -sS 'http://user:user@192.168.1.8/2?A=4&p=1&X=1470' > /dev/null 2>&1
sleep 1
done;
exit
fi