http://localhost:8001
curl -vvv localhost:8001
http://macmini2020.local:8001
++ Outdoor Temperature = 14.8 deg C
++ Outdoor Humidity = 60%
++ Dew Point = 7.1 deg C
++ Wind Chill = 14.8 deg C
++ Wind Direction = NNE
++ Wind Speed = 1.34 mph
++ Wind Gust = 2.46 mph
++ Hourly Rain = 0.0 mm
++ Daily Rain = 0.0 mm
++ Weekly Rain = 0.0 mm
++ Monthly Rain = 0.0 mm
++ Annual Rain = 532.4 mm
++ Solar Radiation = 497.74
++ UV = 2
++ Indoor Temperature = 21.5 deg C
++ Indoor Humidity = 49%
++ Barometric Pressure = 1009 mbar
++ Low Battery = 0
++ Date = 2019-04-01 [UTC]
++ Time = 15:19:24
++ Software Type = WH2600GEN_V2.2.7
++ Action = updateraw
++ Realtime = 1
++ RT Freq = 5
/Library/Application Support/Perceptive Automation/Indigo 7/Plugins/
/Library/Application Support/Perceptive Automation/Indigo 7/Plugins (Disabled)/
python getSiteDetails.py -a <address> -p <port>
#!/usr/bin/python
import json
import urllib2
import sys, getopt
def getHTTPData(url):
# create a new Urllib2 Request object
req = urllib2.Request(url)
# add any additional headers you like
req.add_header('Accept', 'application/json')
req.add_header("Content-type", "application/x-www-form-urlencoded")
# make the request and print the results
res = urllib2.urlopen(req)
return res;
def main(argv):
address = 'cam.local'
port = '8001'
try:
opts, args = getopt.getopt(argv,"ha:p:",["ifile=","ofile="])
except getopt.GetoptError:
print 'getHTTP.py -a <address> -p <port>'
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print 'getHTTP.py -a <address> -p <port>'
sys.exit()
elif opt in ("-a", "--address"):
address = arg
elif opt in ("-p", "--port"):
port = arg
url = 'http://' + address + ':' + port + "/api/v1/sites.json"
request = getHTTPData(url);
jsonData = request.read();
decodedJSON = json.loads(jsonData)
firstSite = decodedJSON["sites"][0]
firstURI = firstSite["uri"]
url = 'http://' + address + ':' + port + firstURI
count = 0
while 1:
count = count + 1
request = getHTTPData(url);
if request.code != 200:
print 'Error at iteration ' + str(count) + ': ' + str(request.code)
else:
data = request.read();
if count == 1 or count % 100 == 0:
print "Fetching URL at iteration " + str(count) + ": " + url
if __name__ == "__main__":
main(sys.argv[1:])
boisy wrote:
[Edit 2: Looking at the python code for the plug-in, I'm not sure changing sleep(2) to sleep(1) is changing the polling time. I see a comparison of the current time to a lastCheck variable of 30 (seconds?) so perhaps that's the actually poll time?]