Apple has a habit of deprecating APIs, replacing them (kind of, sort of) with new, incompatible ones. That they did with the API I use, some six years ago. Deprecation takes a long time (Apple doesn’t like to just break stuff, they give lots of warnings… but they never relent). That’s what actually limits the lifetime of the plugin
If you want to access data from a private sensor the Owner's Email for the sensor must be a Google account and you must login with that Google account on purpleair.com before navigating to purpleair.com/json. To update the Owner's Email on a sensor that was previously registered contact us.
varHouseValveON = indigo.variables["Water_Test_HouseValve_ON"]
varHouseValveOFF = indigo.variables["Water_Test_HouseValve_OFF"]
varHouseValveSuccess = indigo.variables["Water_Test_HouseValve_Success"]
varSuccessTimestamp = indigo.variables["Water_Test_Success_TimeStamp"]
varRfxOutsideTimestamp = indigo.variables["RFX_Outside_Temp_Obs_Time"]
if varHouseValveON.getValue(str) == "true" and varHouseValveOFF.getValue(str) == "true":
indigo.variable.updateValue(varHouseValveSuccess, "true")
indigo.variable.updateValue(varHouseValveON, "")
indigo.variable.updateValue(varHouseValveOFF, "")
indigo.variable.updateValue(varSuccessTimestamp, varRfxOutsideTimestamp.getValue(str))
indigo.server.log(u"House Water Valve working correctly")
else:
indigo.actionGroups.execute("Water Valve House Test Failed")
indigo.variable.updateValue(varHouseValveSuccess, "false")
indigo.server.log(u"House Water Valve not executing. Check that knob on side is set to AUTO. ReRun from basement and ensure valve is turning. If not, check Phidgets box and relays.")
varWaterToday = indigo.variables["WaterUse_01_Today"]
varWaterHouseNightLeak = indigo.variables["WaterHouseNightLeak"]
water0 = varWaterToday.getValue(float)
indigo.activePlugin.sleep(600) # sleep for 10 minutes
varWaterToday.refreshFromServer() # have to refresh our copy with the server's version since 10 minutes have passed
water10min = varWaterToday.getValue(float)
waterDelta = water10min - water0
indigo.server.log(u"Total measured water leak is " + str(waterDelta))
indigo.variable.updateValue(varWaterHouseNightLeak, str(waterDelta))
# try to sort out a toilet flush (about a gallon to 1.6 gallons) vs a slow or large leak
if (waterDelta >= 1 and waterDelta <= 10) or waterDelta > 20:
indigo.server.log(u"possible leak")
indigo.actionGroups.execute("Water Measure Night Leak Detected?")
# NOTE: Everywhere I have 'IDOF_', you must replace with the ID of the specified Indigo Object (variable, etc.)
# I've mostly done a line-by-line conversion to help you understand how that kind of conversion would work,
# but in a few cases where things are just much easier in Python I reworked a section (which I NOTE).
# First, import the requests module, which we'll use for the HTTP communication instead of using 'do shell script'
import requests
import time
# using terms from application "IndigoServer"
# tell application "IndigoServer"
#
# set actionOrdered to value of variable "Cam_Garage" as string
action_ordered = indigo.variables[IDOF_Cam_Garage].value
# log actionOrdered
indigo.server.log(action_ordered)
# --Cardinal Directions. Automatically stops the directional movement via delayed command at the bottom.
# set actionDirections to {}
ACTION_DIRECTIONS = ["Left", "Right", "Up", "Down"] # It's customary in Python to name contstant variables IN_ALL_CAPS
# if actionDirections contains actionOrdered is true then
# set theAction to "ptzMove" & actionOrdered & ""
# --log theAction
# --set value of variable "Cam_Garage" to "x"
# end if
if action_ordered in ACTION_DIRECTIONS:
the_action = "ptzMove{}".format(action_ordered)
# --zoom in, out. Automatically stops the zoom via delayed command at the bottom.
# set actionZoom to {"zoomIn", "zoomOut", "zoomStop"}
# if actionZoom contains actionOrdered is true then
# set theAction to actionOrdered & ""
# --log theAction
# --set value of variable "Cam_Garage" to "x"
# end if
if action_ordered in ["zoomIn", "zoomOut", "zoomStop"]:
action_zoom = action_ordered
# --Go to Preset.
# set actionPreSet to {"TopMost", "RightMost", "LeftMost", "BottomMost", "Preset_1", "Preset_2", "Preset_3"} --I added WideView and Center. Modify the list to add your custom preset.
# if actionPreSet contains actionOrdered is true then
# set theAction to "ptzGotoPresetPoint&name=" & actionOrdered & ""
# --log theAction
# --set value of variable "Cam_Garage" to "x"
# log actionOrdered & "the list works"
#
# end if
if action_ordered in ["TopMost", "RightMost", "LeftMost", "BottomMost", "Preset_1", "Preset_2", "Preset_3"]:
the_action = "ptzGotoPresetPoint&name=".format(action_ordered)
indigo.server.log("{} the list works".format(action_ordered))
# --Need to place all non-IR commands in this list so they will execute with proper timing.
# set actionListAll to {"Left", "Right", "Up", "Down", "zoomIn", "zoomOut", "zoomStop", "TopMost", "RightMost", "LeftMost", "BottomMost", "Preset_1", "Preset_2", "Preset_3"}
# if actionListAll contains actionOrdered is true then
# log actionOrdered & "the list works"
#
# set theIP to "'http://10.0.1.25:80/cgi-bin/CGIProxy.fcgi?" --change your ip and command string here. Note the ' at the beginning. Need one at the end.
# set thePW to the value of variable "Camera_Password"
# set theUser to the value of variable "Camera_User"
# --set theAction to the value of variable "Cam_Garage" #NOTE: I'm not sure if this really is supposed to be commented out or not, but it is in your script
#
# set theURL to theIP & "cmd=" & theAction & "&" & "usr=" & theUser & "&" & "pwd=" & thePW & "'" --rearrange the order of the username/password and command string if necessary for your camera.
# --log theURL --comment this out once it is working
# set curlURL to "curl -f" & " " & theURL
#
# set shellscript to curlURL
# --log shellscript -- commment this out once it is working
# do shell script shellscript
# set value of variable "Cam_Garage" to "x"
# end if
if action_ordered in ["Left", "Right", "Up", "Down", "zoomIn", "zoomOut", "zoomStop", "TopMost", "RightMost", "LeftMost", "BottomMost", "Preset_1", "Preset_2", "Preset_3"]:
indigo.server.log("{} the list works".format(action_ordered))
# NOTE: I did change this one since you had to jump through some hoops to make getting the URL work in AppleScript - it's much easier in Python
the_URL = 'http://10.0.1.25:80/cgi-bin/CGIProxy.fcgi'
the_args = {
'cmd': the_action, # NOTE: again, it appears that the_action may not be defined at this time because you commented out the explicit set above
'usr': indigo.variables[IDOF_Camera_User].value,
'pwd': indigo.variables[IDOF_Camera_Password].value,
}
reply = requests.get(the_URL, params=the_args)
# NOTE: you can look at the reply object to see if the request was successful
indigo.variable.updateValue(IDOF_Cam_Garage, value="x")
# --http://10.0.1.25:80/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=[user]&pwd=[password]
#
# --This is a distinct URL send for IR LED open and close. Otherwise it does not work correctly when run as an external script.
# set actionIRonOff to {"openInfraLed", "closeInfraLed"}
# if actionIRonOff contains actionOrdered is true then
# set theAction_IR_Only to actionOrdered
# --log theAction
# --delay 2
# --set value of variable "Cam_Garage" to "x"
#
#
# set theIP to "'http://10.0.1.25:80/cgi-bin/CGIProxy.fcgi?" --change your ip and command string here
# set thePW to the value of variable "Camera_Password"
# set theUser to the value of variable "Camera_User"
#
# set theURL to theIP & "&cmd=" & theAction_IR_Only & "&" & "usr=" & theUser & "&" & "pwd=" & thePW & "'" --rearrange the order of the username/password and command string if necessary for your camera.
# --log theURL --comment this out once it is working
# set curlURL to "curl -f" & " " & theURL
#
# set shellscript to curlURL
# --log shellscript -- commment this out once it is working
# do shell script shellscript
# --delay 2
# set value of variable "Cam_Garage" to "x"
# end if
if action_ordered in ["openInfraLed", "closeInfraLed"]:
indigo.server.log("{} the list works".format(action_ordered))
# NOTE: I did change this one since you had to jump through some hoops to make getting the URL work in AppleScript - it's much easier in Python
the_URL = 'http://10.0.1.25:80/cgi-bin/CGIProxy.fcgi'
the_args = {
'cmd': action_ordered,
'usr': indigo.variables[IDOF_Camera_User].value,
'pwd': indigo.variables[IDOF_Camera_Password].value,
}
reply = requests.get(the_URL, params=the_args)
# NOTE: you can look at the reply object to see if the request was successful
indigo.variable.updateValue(IDOF_Cam_Garage, value="x")
# --Send "stop" URL function for directions and zoom
# delay 0.3
time.sleep(3)
# if actionDirections contains actionOrdered is true then
#
# set theAction to "ptz" & "StopRun"
# set theIP to "'http://10.0.1.25:80/cgi-bin/CGIProxy.fcgi?" --change your ip and command string here
# set thePW to the value of variable "Camera_Password"
# set theUser to the value of variable "Camera_User"
#
# set theURL to theIP & "&cmd=" & theAction & "&" & "usr=" & theUser & "&" & "pwd=" & thePW & "'" --rearrange the order of the username/password and command string if necessary for your camera.
# --log theURL --comment this out once it is working
# set curlURL to "curl -f" & " " & theURL
#
# set shellscript to curlURL
# NOTE: this next line doesnt' appear to do aything since you're already created the URL using 'ptzStopRun'
# set theAction to "ptzMove" & "Stop"
# do shell script shellscript
# set value of variable "Cam_Garage" to "x"
#
# end if
#
if action_ordered in ACTION_DIRECTIONS:
# NOTE: I did change this one since you had to jump through some hoops to make getting the URL work in AppleScript - it's much easier in Python
the_URL = 'http://10.0.1.25:80/cgi-bin/CGIProxy.fcgi'
the_args = {
'cmd': "ptzStopRun",
'usr': indigo.variables[IDOF_Camera_User].value,
'pwd': indigo.variables[IDOF_Camera_Password].value,
}
reply = requests.get(the_URL, params=the_args)
# NOTE: you can look at the reply object to see if the request was successful
indigo.variable.updateValue(IDOF_Cam_Garage, value="x")
set {year:y, month:m, day:d, weekday:w} to (current date)
tell application "IndigoServer"
log w
log d
log m
log y
log (("today = " & value of variable "WaterUsePool_01_Today") & ", " & ("yesterday = " & value of variable "WaterUsePool_02_Yesterday") & ", " & ("this week = " & value of variable "WaterUsePool_03_ThisWeek") & ", " & ("last week = " & value of variable "WaterUsePool_04_LastWeek"))
--Today and Yesterday. Second line in each sequence resets the current variable to ""
set value of variable "WaterUsePool_02_Yesterday" to value of variable "WaterUsePool_01_Today"
set value of variable "WaterUsePool_01_Today" to "0"
--This week and last week
if w is Monday then
set (value of variable "WaterUsePool_04_LastWeek") to (value of variable "WaterUsePool_03_ThisWeek")
set value of variable "WaterUsePool_03_ThisWeek" to "0"
end if
--This month and last month, and convert to hundred cubic feet, ccf, as on water bill.
if d is 1 then
--set value of variable "WaterUsePool_06_LastMonth" to value of variable "WaterUsePool_05_ThisMonth"
set WaterUsePoolThisMonth_Raw to ((value of variable "WaterUsePool_05_ThisMonth") / 7481)
set WaterUsePoolThisMonth to (round (WaterUsePoolThisMonth_Raw * 100)) / 10
--set value of variable "WaterUsePool_06_LastMonth" to value of variable "WaterUsePool_05_ThisMonth"
set value of variable "WaterUsePool_06_LastMonth" to WaterUsePoolThisMonth
set value of variable "WaterUsePool_05_ThisMonth" to "0"
end if
--Prior Month historical data. Will work if variables such as "WaterUsePool_18_Dec" are created
if d is 1 then
if m is January then
set value of variable "WaterUsePool_18_Dec" to WaterUsePoolThisMonth
end if
if m is February then
set value of variable "WaterUsePool_07_Jan" to WaterUsePoolThisMonth
end if
if m is March then
set value of variable "WaterUsePool_08_Feb" to WaterUsePoolThisMonth
end if
if m is April then
set value of variable "WaterUsePool_09_Mar" to WaterUsePoolThisMonth
end if
if m is May then
set value of variable "WaterUsePool_10_Apr" to WaterUsePoolThisMonth
end if
if m is June then
set value of variable "WaterUsePool_11_May" to WaterUsePoolThisMonth
end if
if m is July then
set value of variable "WaterUsePool_12_Jun" to WaterUsePoolThisMonth
end if
if m is August then
set value of variable "WaterUsePool_13_Jul" to WaterUsePoolThisMonth
end if
if m is September then
set value of variable "WaterUsePool_14_Aug" to WaterUsePoolThisMonth
end if
if m is October then
set value of variable "WaterUsePool_15_Sep" to WaterUsePoolThisMonth
end if
if m is November then
set value of variable "WaterUsePool_16_Oct" to WaterUsePoolThisMonth
end if
if m is December then
set value of variable "WaterUsePool_17_Nov" to WaterUsePoolThisMonth
end if
end if
end tell
using terms from application "IndigoServer"
tell application "IndigoServer"
set Water_0 to value of variable "WaterUse_01_Today"
--log Water_0
delay 600 --this is 10 minutes
set Water_10min to value of variable "WaterUse_01_Today"
--log Water_10
set Water_Compare to (Water_10min - Water_0)
log "Total measured water leak is " & Water_Compare
set value of variable "WaterHouseNightLeak" to Water_Compare
--try to sort out a toilet flush (about a gallon to 1.6 gallons) vs a slow or large leak
if ((Water_Compare is greater than or equal to 1) and (Water_Compare is less than or equal to 10)) or (Water_Compare is greater than 20) then
log "possible leak"
execute group "Water Measure Night Leak Detected?"
end if
end tell
end using terms from
using terms from application "IndigoServer"
tell application "IndigoServer"
log "Sprinkler Valve Test running now. 1. Is if there is water running despite valve being off. Measure any flow in initial state. 2. Is valve is opening correctly? Measure zero flow then some flow while open. 3. Are lines tight? See if flow stops once dead space in lines are full. If continued water flow, either lines have a leak or the pool is filling. 4. Is the valve is closing correctly? Observe for any flow following valve closure."
set value of variable "Water_Test_Pool_SprinklerValve_Works" to "false"
set value of variable "Water_Test_Pool_Sprinkler_Success" to "false"
set value of variable "Water_Use_Pool_System_Tight" to "false"
set waterFlow0Seconds to value of variable "WaterUsePool_01_Today" as string
delay 20
set waterFlow5seconds to value of variable "WaterUsePool_01_Today" as string
set waterFlowYes to (waterFlow5seconds - waterFlow0Seconds)
log "initial flow with valve closed is " & waterFlowYes
if waterFlowYes is greater than 0 then
log "Pool House Sprinkler Valve is not open at all but water flow is detected. Valve may be stuck open, with " & waterFlowYes & " tenths of a gallon measured."
else
log "Pool House Sprinkler Valve appears tight with no initial flow."
end if
delay 1
set waterFlow0Seconds to value of variable "WaterUsePool_01_Today" as string
execute group "Water Valve Pool Sprinkler Weekly Valve Test Supply Open"
delay 5
set waterFlow5seconds to value of variable "WaterUsePool_01_Today" as string
set waterFlowYes to (waterFlow5seconds - waterFlow0Seconds)
log "initial flow is " & waterFlowYes
if waterFlowYes is greater than 0 then
log "Pool House Sprinkler Valve is opening correctly and water is flowing, with " & waterFlowYes & " tenths of a gallon measured."
set value of variable "Water_Test_Pool_SprinklerValve_Works" to "true"
set value of variable "Water_Test_Pool_SprinklerValve_Works_TimStmp" to value of variable "RFX_Outside_Temp_Obs_Time"
else
set value of variable "Water_Test_Pool_Sprinkler_Success" to "false"
set value of variable "Water_Test_Pool_SprinklerValve_Works" to "false"
log "The Pool Fill/Sprinkler valve might not be opening as there was zero flow. Turn on pool sprinklers and re-run test to see if flow is active. If not, valve may be malfunctioning."
execute group "Water Pool Sprinkler Valve Test Failed due to Zero Flow"
end if
if waterFlowYes is greater than 0 then
delay 20 --this is 10 seconds and should be enough time for the pipes to fill. Note that the pool fill valve does not appear to close fully. Need a different one.
log "Pool Sprinkler Fill Valve Test Running"
set Water_Test_Pool_Sprinkler_ON to value of variable "WaterUsePool_01_Today" as string
--log (value of variable "Water_Test_Pool_Sprinkler_ON") as string
delay 5
set Water_Test_Pool_Sprinkler_OFF to value of variable "WaterUsePool_01_Today" as string
--log (value of variable "Water_Test_Pool_Sprinkler_OFF") as string
if ((Water_Test_Pool_Sprinkler_OFF) - (Water_Test_Pool_Sprinkler_ON)) is equal to 0 then
set value of variable "Water_Test_Pool_Sprinkler_Success" to "true"
set value of variable "Water_Use_Pool_System_Tight" to "true"
set value of variable "Water_Test_Pool_Sprinkler_Success_TimeStamp" to value of variable "RFX_Outside_Temp_Obs_Time"
log "Pool Sprinkler Valve On then Off shows Valve is functioning and lines are tight. Best case achieved." as string
--This result is our best case.
end if
end if
if ((Water_Test_Pool_Sprinkler_OFF) - (Water_Test_Pool_Sprinkler_ON)) is not equal to 0 then
log "First Test Failed. Could be just refilling the pipes, or slowly filling the pool. Pool Sprinkler Fill Valve Test Running A Second Time"
set Water_Test_Pool_Sprinkler_ON to value of variable "WaterUsePool_01_Today" as string
--log (value of variable "Water_Test_Pool_Sprinkler_ON") as string
delay 10
set Water_Test_Pool_Sprinkler_OFF to value of variable "WaterUsePool_01_Today" as string
--log (value of variable "Water_Test_Pool_Sprinkler_OFF") as string
if ((Water_Test_Pool_Sprinkler_OFF) - (Water_Test_Pool_Sprinkler_ON)) is equal to 0 then
set value of variable "Water_Test_Pool_Sprinkler_Success" to "true"
set value of variable "Water_Use_Pool_System_Tight" to "true"
set value of variable "Water_Test_Pool_Sprinkler_Success_TimeStamp" to value of variable "RFX_Outside_Temp_Obs_Time"
log "While lines took longer to fill, Pool Sprinkler Valve On then Off shows Valve is functioning and lines are tight. Best case achieved." as string
--This result is our second best case.
else
set value of variable "Water_Use_Pool_System_Tight" to "false"
log "The Pool Fill/Sprinkler lines may have a leak, or the pool level is low and it is filling. Go check."
execute group "Water Pool Sprinkler Valve Test Failed"
end if
end if
end tell
end using terms from
using terms from application "IndigoServer"
tell application "IndigoServer"
if ((value of variable "Water_Test_HouseValve_ON" is "true") and value of variable "Water_Test_HouseValve_OFF" is "true") then
set value of variable "Water_Test_HouseValve_Success" to "true"
set value of variable "Water_Test_HouseValve_ON" to ""
set value of variable "Water_Test_HouseValve_OFF" to ""
set value of variable "Water_Test_Success_TimeStamp" to value of variable "RFX_Outside_Temp_Obs_Time"
log "House Water Valve working correctly"
else
execute group "Water Valve House Test Failed"
set value of variable "Water_Test_HouseValve_Success" to "false"
log "House Water Valve not executing. Check that knob on side is set to AUTO. ReRun from basement and ensure valve is turning. If not, check Phidgets box and relays."
end if
end tell
end using terms from
using terms from application "IndigoServer"
tell application "IndigoServer"
if value of variable "vauxResponse" contains "!s" then
set vauxResponseString to value of variable "vauxResponse"
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxResponseString
end if
set {myTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, {","}}
set myList to text items of vauxResponseString
set AppleScript's text item delimiters to myTID -- It's considered good practice to return the TID's to their original state
--log list of myList
--if myList contains less than 5 items then
stop
end if
try
if item 2 of myList is "40" then --this is for setting bass and treble.
set vauxZoneNumber to item 3 of myList
set vauxBassSetting to item 4 of myList
set vauxTrebleSetting to item 5 of myList as string
log ((vauxZoneNumber as string) & " " & (vauxBassSetting as string) & " " & (vauxTrebleSetting as string))
if vauxZoneNumber is "0" then set value of variable "vauxZoneName" to "Off" as text
if vauxZoneNumber is "1" then set value of variable "vauxZoneName" to "Kitchen" as text
if vauxZoneNumber is "2" then set value of variable "vauxZoneName" to "FamRm" as text
if vauxZoneNumber is "3" then set value of variable "vauxZoneName" to "Study" as text
if vauxZoneNumber is "4" then set value of variable "vauxZoneName" to "LivDnRm" as text
if vauxZoneNumber is "5" then set value of variable "vauxZoneName" to "GameRm" as text
if vauxZoneNumber is "6" then set value of variable "vauxZoneName" to "Patio" as text
if vauxZoneNumber is "7" then set value of variable "vauxZoneName" to "Pool" as text
if vauxZoneNumber is "8" then set value of variable "vauxZoneName" to "MBR" as text
set value of variable "vauxResponseBassTreble" to ((value of variable "vauxZoneName" as string) & " Bass " & (vauxBassSetting as string) & " Treble " & (vauxTrebleSetting as string))
log value of variable "vauxResponseBassTreble" as string
end if
end try
try
if item 2 of myList is "1" then --this is the standard response. Don't log
set vauxZoneNumber to item 3 of myList
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxZoneNumber --as string
end if
set vauxSourceNumber to item 5 of myList
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxSourceNumber
end if
set vauxVolumeLevel to item 6 of myList as string
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxVolumeLevel
end if
end if
if item 2 of myList is "3" then
set vauxZoneNumber to item 3 of myList
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxZoneNumber --as string
end if
set vauxSourceNumber to item 5 of myList
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxSourceNumber
end if
set vauxVolumeLevel to item 6 of myList --as string
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxVolumeLevel
end if
end if
if item 2 of myList is "20" then
set vauxZoneNumber to item 3 of myList
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxZoneNumber --as string
--set vauxSourceNumber to item 4 of myList
log vauxSourceNumber
end if
set vauxVolumeLevel to item 5 of myList --as string
if value of variable "vauxLogging_Enabled" is equal to "true" then
log vauxVolumeLevel
end if
end if
if vauxZoneNumber is "0" then set value of variable "vauxZoneName" to "Off " as text
if vauxZoneNumber is "1" then set value of variable "vauxZoneName" to "Kitchen(K)" as text
if vauxZoneNumber is "2" then set value of variable "vauxZoneName" to "Kitchen(F)" as text
if vauxZoneNumber is "3" then set value of variable "vauxZoneName" to "Kitchen(S)" as text
if vauxZoneNumber is "4" then set value of variable "vauxZoneName" to "LivDnRm" as text
if vauxZoneNumber is "5" then set value of variable "vauxZoneName" to "GameRm" as text
if vauxZoneNumber is "6" then set value of variable "vauxZoneName" to "Patio" as text
if vauxZoneNumber is "7" then set value of variable "vauxZoneName" to "Pool" as text
if vauxZoneNumber is "8" then set value of variable "vauxZoneName" to "MBR " as text
if vauxSourceNumber is "0" then set value of variable "vauxSourceName" to "Off " as text
if vauxSourceNumber is "1" then set value of variable "vauxSourceName" to "Tuner" as text
if vauxSourceNumber is "2" then set value of variable "vauxSourceName" to "iTunesPan" as text
if vauxSourceNumber is "3" then set value of variable "vauxSourceName" to "AirPlay" as text
if vauxSourceNumber is "4" then set value of variable "vauxSourceName" to "Cable" as text
--if vauxSourceNumber is "5" then set value of variable "vauxSourceName" to "Cable" as text
if vauxSourceNumber is "8" then set value of variable "vauxSourceName" to "Tone Levels" as text
set value of variable "vauxZoneVolume" to vauxVolumeLevel
set value of variable "vauxResponseCombinedOutput" to ((value of variable "vauxZoneName" as string) & " " & (value of variable "vauxSourceName" as string) & " " & (value of variable "vauxZoneVolume" as string))
--if value of variable "vauxLogging_Enabled" is equal to "true" then
log value of variable "vauxResponseCombinedOutput" as string
--end if
end try
--the short zone name is used on the opening control page to see what's happening at a glance
set vauxShortZone to value of variable "vauxZoneName" as string
set vauxShortZoneName to (characters 1 through 4 of vauxShortZone) as string
set value of variable "vauxResponseOutputShort" to ((characters 1 through 4 of vauxShortZoneName as string) & " " & (characters 1 through 4 of (value of variable "vauxSourceName" as string)) & " " & (value of variable "vauxZoneVolume" as string)) as string
if value of variable "vauxLogging_Enabled" is equal to "true" then
log value of variable "vauxResponseOutputShort" as string
end if
if item 2 of myList is "91" then
set value of variable "vauxResponseOutputShort" to "Now Paging"
log "Now Paging"
set value of variable "vauxResponseCombinedOutput" to "Now Paging"
end if
if item 2 of myList is "90" then
set value of variable "vauxResponseOutputShort" to "Paging Stopped"
log "Paging Stopped"
set value of variable "vauxResponseCombinedOutput" to "Paging Stopped"
end if
end tell
end using terms from
using terms from application "IndigoServer"
tell application "IndigoServer"
set actionOrdered to value of variable "Cam_Garage" as string
log actionOrdered
--Cardinal Directions. Automatically stops the directional movement via delayed command at the bottom.
set actionDirections to {"Left", "Right", "Up", "Down"}
if actionDirections contains actionOrdered is true then
set theAction to "ptzMove" & actionOrdered & ""
--log theAction
--set value of variable "Cam_Garage" to "x"
end if
--zoom in, out. Automatically stops the zoom via delayed command at the bottom.
set actionZoom to {"zoomIn", "zoomOut", "zoomStop"}
if actionZoom contains actionOrdered is true then
set theAction to actionOrdered & ""
--log theAction
--set value of variable "Cam_Garage" to "x"
end if
--Go to Preset.
set actionPreSet to {"TopMost", "RightMost", "LeftMost", "BottomMost", "Preset_1", "Preset_2", "Preset_3"} --I added WideView and Center. Modify the list to add your custom preset.
if actionPreSet contains actionOrdered is true then
set theAction to "ptzGotoPresetPoint&name=" & actionOrdered & ""
--log theAction
--set value of variable "Cam_Garage" to "x"
log actionOrdered & "the list works"
end if
--Need to place all non-IR commands in this list so they will execute with proper timing.
set actionListAll to {"Left", "Right", "Up", "Down", "zoomIn", "zoomOut", "zoomStop", "TopMost", "RightMost", "LeftMost", "BottomMost", "Preset_1", "Preset_2", "Preset_3"}
if actionListAll contains actionOrdered is true then
log actionOrdered & "the list works"
set theIP to "'http://10.0.1.25:80/cgi-bin/CGIProxy.fcgi?" --change your ip and command string here. Note the ' at the beginning. Need one at the end.
set thePW to the value of variable "Camera_Password"
set theUser to the value of variable "Camera_User"
--set theAction to the value of variable "Cam_Garage"
set theURL to theIP & "cmd=" & theAction & "&" & "usr=" & theUser & "&" & "pwd=" & thePW & "'" --rearrange the order of the username/password and command string if necessary for your camera.
--log theURL --comment this out once it is working
set curlURL to "curl -f" & " " & theURL
set shellscript to curlURL
--log shellscript -- commment this out once it is working
do shell script shellscript
set value of variable "Cam_Garage" to "x"
end if
--http://10.0.1.25:80/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr=[user]&pwd=[password]
--This is a distinct URL send for IR LED open and close. Otherwise it does not work correctly when run as an external script.
set actionIRonOff to {"openInfraLed", "closeInfraLed"}
if actionIRonOff contains actionOrdered is true then
set theAction_IR_Only to actionOrdered
--log theAction
--delay 2
--set value of variable "Cam_Garage" to "x"
set theIP to "'http://10.0.1.25:80/cgi-bin/CGIProxy.fcgi?" --change your ip and command string here
set thePW to the value of variable "Camera_Password"
set theUser to the value of variable "Camera_User"
set theURL to theIP & "&cmd=" & theAction_IR_Only & "&" & "usr=" & theUser & "&" & "pwd=" & thePW & "'" --rearrange the order of the username/password and command string if necessary for your camera.
--log theURL --comment this out once it is working
set curlURL to "curl -f" & " " & theURL
set shellscript to curlURL
--log shellscript -- commment this out once it is working
do shell script shellscript
--delay 2
set value of variable "Cam_Garage" to "x"
end if
--Send "stop" URL function for directions and zoom
delay 0.3
if actionDirections contains actionOrdered is true then
set theAction to "ptz" & "StopRun"
set theIP to "'http://10.0.1.25:80/cgi-bin/CGIProxy.fcgi?" --change your ip and command string here
set thePW to the value of variable "Camera_Password"
set theUser to the value of variable "Camera_User"
set theURL to theIP & "&cmd=" & theAction & "&" & "usr=" & theUser & "&" & "pwd=" & thePW & "'" --rearrange the order of the username/password and command string if necessary for your camera.
--log theURL --comment this out once it is working
set curlURL to "curl -f" & " " & theURL
set shellscript to curlURL
set theAction to "ptzMove" & "Stop"
do shell script shellscript
set value of variable "Cam_Garage" to "x"
end if
lanbrown wrote:
So using the input side of things only does make sense.