Skip to content

Instantly share code, notes, and snippets.

@elvisimprsntr
Created November 10, 2012 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elvisimprsntr/4052516 to your computer and use it in GitHub Desktop.
Save elvisimprsntr/4052516 to your computer and use it in GitHub Desktop.
Bash scripts for the REST interface for the ISY99i
#!/bin/bash
read -p "Enter ISY IP address or hostname: " ISYIP
read -p "Enter ISY user ID: " USER
read -p "Enter ISY password: " PASS
read -p "Enter Elk code: " CODE
# define variables
ISYRESTURL=http://$ISYIP/rest/elk
# define function
isyrestwget () {
wget -O $ISYLOG.xml --user=$USER --password=$PASS ${ISYRESTURL}${ISYCMD} >> elk_interrogate.log 2>&1
}
echo "Begin Elk REST interrogation" > elk_interrogate.log 2>&1
# Area Commands
ISYCMD=/areas/query
ISYLOG=elk_area_query
isyrestwget
ISYCMD=/area/1/get/status
ISYLOG=elk_area_1_status
isyrestwget
ISYCMD=/area/2/get/status
ISYLOG=elk_area_2_status
isyrestwget
ISYCMD=/area/3/get/status
ISYLOG=elk_area_3_status
isyrestwget
ISYCMD=/area/4/get/status
ISYLOG=elk_area_4_status
isyrestwget
# Zone Commands
ISYCMD=/zones/query
ISYLOG=elk_zones_query
isyrestwget
ISYCMD=/zone/0/query/voltage
ISYLOG=elk_zone_0_query_voltage
isyrestwget
ISYCMD=/zone/1/query/voltage
ISYLOG=elk_zone_1_voltage
isyrestwget
ISYCMD=/zone/16/query/voltage
ISYLOG=elk_zone_16_voltage
isyrestwget
# General Commands
ISYCMD=/query/all
ISYLOG=elk_query_all
isyrestwget
# depreciated
#ISYCMD=/get/config
#ISYLOG=elk_get_config
#isyrestwget
# depreciated
#ISYCMD=/get/connected
#ISYLOG=elk_get_connected
#isyrestwget
# depreciated
#ISYCMD=/get/enabled
#ISYLOG=elk_get_enabled
#isyrestwget
ISYCMD=/get/status
ISYLOG=elk_get_status
isyrestwget
# System Commands
ISYCMD=/system/get/status
ISYLOG=elk_system_get_status
isyrestwget
ISYCMD=/get/topology
ISYLOG=elk_get_topology
isyrestwget
ISYCMD=/refresh/topology
ISYLOG=elk_refresh_topology
isyrestwget
# Arm/Disarm Commands
ISYCMD="/area/1/cmd/arm?armType=2&code="$CODE
ISYLOG=elk_area_1_arm
isyrestwget
ISYCMD=/area/1/get/status
ISYLOG=elk_area_1_status_stay
isyrestwget
ISYCMD="/area/1/cmd/disarm?code="$CODE
ISYLOG=elk_area_1_disarm
isyrestwget
ISYCMD=/area/1/get/status
ISYLOG=elk_area_1_status_disarmed
isyrestwget
# Keypad Commands
ISYCMD=/keypad/1/get/status
ISYLOG=elk_keypad_1_status
isyrestwget
ISYCMD=/keypad/2/get/status
ISYLOG=elk_keypad_2_status
isyrestwget
# Output Commands
ISYCMD=/outputs/query
ISYLOG=elk_outputs_query
isyrestwget
# bug in 3.1.13
ISYCMD=/output/3/get/status
ISYLOG=elk_output_3_status
isyrestwget
ISYCMD="/output/3/cmd/on?offTimerSeconds=2"
ISYLOG=elk_output_3_momentary
isyrestwget
#!/bin/bash
read -p "Enter ISY IP address or hostname: " ISYIP
read -p "Enter ISY user ID: " USER
read -p "Enter ISY password: " PASS
# define variables
ISYRESTURL=http://$ISYIP/rest
# device/scene node IDs
LIVING=19496
ALL=8730
TSTAT="14%2066%20F4%201"
# program IDs
FLASH=0006
# define function
isyrestwget () {
wget -O $ISYLOG.xml --user=$USER --password=$PASS ${ISYRESTURL}${ISYCMD} >> isy_interrogate.log 2>&1
}
echo "Begin ISY REST interrogation" > isy_interrogate.log 2>&1
# Batch Commands
ISYCMD=/batch
ISYLOG=isy_batch
isyrestwget
ISYCMD=/batteryPoweredWrites
ISYLOG=isy_batt_powered_writes
isyrestwget
# Configuration
ISYCMD=/config
ISYLOG=isy_config
isyrestwget
ISYCMD=/sys
ISYLOG=isy_sys
isyrestwget
ISYCMD=/time
ISYLOG=isy_time
isyrestwget
ISYCMD=/network
ISYLOG=isy_network
isyrestwget
ISYCMD=/subscriptions
ISYLOG=isy_subscriptions
isyrestwget
# Nodes
ISYCMD=/nodes
ISYLOG=isy_nodes
isyrestwget
ISYCMD=/nodes/devices
ISYLOG=isy_devices
isyrestwget
ISYCMD=/nodes/scenes
ISYLOG=isy_scenes
isyrestwget
ISYCMD=/nodes/$LIVING
ISYLOG=isy_node_living
isyrestwget
ISYCMD=/nodes/$TSTAT
ISYLOG=isy_node_tstat
isyrestwget
ISYCMD=/nodes/$TSTAT/CLIHUM
ISYLOG=isy_node_tstat_hum
isyrestwget
ISYCMD=/nodes/$LIVING?member=true
ISYLOG=isy_node_living_true
isyrestwget
ISYCMD=/nodes/$LIVING?member=false
ISYLOG=isy_node_living_false
isyrestwget
# Properties
ISYCMD=/nodes/$ALL/cmd/DON
ISYLOG=isy_all_on
isyrestwget
ISYCMD=/nodes/$LIVING/cmd/DOF
ISYLOG=isy_living_off
isyrestwget
ISYCMD=/nodes/$ALL/cmd/DOF
ISYLOG=isy_all_off
isyrestwget
ISYCMD=/nodes/$LIVING/cmd/DON
ISYLOG=isy_living_on
isyrestwget
ISYCMD=/nodes/$TSTAT/cmd/CLIMD/0
ISYLOG=isy_tstat_off
isyrestwget
sleep 5
ISYCMD=/nodes/$TSTAT/cmd/CLIMD/5
ISYLOG=isy_tstat_prog_auto
isyrestwget
# Status
ISYCMD=/status
ISYLOG=isy_status
isyrestwget
ISYCMD=/status/$TSTAT
ISYLOG=isy_status_tstat
isyrestwget
# Query
# response timeout. UDI investigating
ISYCMD=/query
ISYLOG=isy_query
wget --tries=1 -T 30 -O $ISYLOG.xml --user=$USER --password=$PASS ${ISYRESTURL}${ISYCMD} >> isy_interrogate.log 2>&1
ISYCMD=/query/$LIVING
ISYLOG=isy_query_living
isyrestwget
# Programs
ISYCMD=/programs/$FLASH/runThen
ISYLOG=isy_programs_flash_runthen
isyrestwget
sleep 5
ISYCMD=/programs/$FLASH/stop
ISYLOG=isy_programs_flash_stop
isyrestwget
ISYCMD=/programs
ISYLOG=isy_programs
isyrestwget
ISYCMD="/programs?folderContents=false"
ISYLOG=isy_programs_foldercontents
isyrestwget
ISYCMD="/programs?subfolders=true"
ISYLOG=isy_programs_subfolders
isyrestwget
# Modules
ISYCMD=/electricity
ISYLOG=isy_electricity
isyrestwget
ISYCMD=/climate
ISYLOG=isy_climate
isyrestwget
ISYCMD=/networking/resources
ISYLOG=isy_networking_resources
isyrestwget
# UDI investigating
ISYCMD=/networking/wol
ISYLOG=isy_networking_wol
isyrestwget
# Logs
ISYCMD=/log
ISYLOG=isy_log
isyrestwget
ISYCMD="/log?reset=true"
ISYLOG=isy_log_reset
isyrestwget
ISYCMD=/log/error
ISYLOG=isy_log_error
isyrestwget
ISYCMD="/log/error?reset=true"
ISYLOG=isy_log_error_reset
isyrestwget
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment