statesToCheck = ["onOffState","status","up"]
valuesForUp = ["up","on","true","100"]
countUp = 0
countTotal = 0
for dev in indigo.devices:
countTotal +=1
for ss in statesToCheck:
if ss in dev.states:
indigo.server.log(dev.name.ljust(30)+" "+ss.ljust(20)+" "+unicode(dev.states[ss]))
if unicode(dev.states[ss]).lower() in valuesForUp:
countUp+=1
break
indigo.server.log("devices total= "+str(countTotal) )
indigo.server.log(" up= "+str(countUp) )
try:
var = indigo.variables["numberOfUpDevices"]
except:
indigo.variable.create("numberOfUpDevices")
try:
var = indigo.variables["numberOfDevices"]
except:
indigo.variable.create("numberOfDevices")
indigo.variable.updateValue("numberOfUpDevices", str(countUp))
indigo.variable.updateValue("numberOfDevices", str(countTotal))
Users browsing this forum: No registered users and 1 guest