- if there is no change in the outside temp, increment a counter by '1';
- else, change the value of variable temp-previous to equal temp-current.
In Indigo, if the counter variable reaches, say 5, trigger an email to check the webservice.
The script below fails at line 6 because I am unable to modify the indigo variable. I'm guessing the other 3 lines which modify variables would also fail.
- Code: Select all
counter = indigo.variables[900799422].getValue(int) #web service test = number hours temp has not changed
dev = indigo.devices[1969337208] #outside temp device value
outTemp_crnt = int(dev.states["temperature"]) #current outside temp variable value
outTemp_prev = indigo.variables[1778324840].getValue(float) #previous outside temp variable value
if outTemp_crnt != outTemp_prev:
indigo.variable.updateValue(900799422, value = 0) #reset webservice test counter to 0
indigo.variable.updateValue(1778324840, value = outTemp_crnt) #assign current temp to previous temp
else:
counter = counter + 1
indigo.variable.updateValue(900799422, value = outTemp_crnt) #increment counter value by 1