Unable to trigger action group

Posted on
Sat Dec 14, 2019 9:31 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Unable to trigger action group

My living room temperate is less than a trigger value, which should reset my thermostat (with an action group).
The relevant values or lrC - the current temperature, and lRmCd - the trigger point.
At 1800 today, the event log reported the following values:
Script lRmCld: 3
Script lrC: 2



The entire script that is failing to function is below. I have bolded the lines that might help with the assessment. Note that I have tried to simplify the conditions with lines that are commented out - none of which worked. I have verified that both 'warmup' variables are false.
Code: Select all
[b]season = indigo.variables[325456157].value
[/b]hseOcc = indigo.variables[612296111].getValue(bool)
[b]warmup18 = indigo.variables[566274194].getValue(bool)
warmup20 = indigo.variables[1193285363].getValue(bool)
[/b]import time

# get the trigger values (trigXXX: abbreviation for FD low point trigger)
hSmpCld = indigo.variables[658575084].getValue(int) #htr sump COLD threshhold
hSmpOK = indigo.variables[1115411517].getValue(int) #htr sump OK

htWtrCld = indigo.variables[295376955].getValue(int) #htWtrTank COLD threshhold
htWtrOK = indigo.variables[154728201].getValue(int) #htWtrTank OK

[b]lRmCld = indigo.variables[1086851778].getValue(int) #livingRm COLD threshhold
lRmOK = indigo.variables[711165647].getValue(int) #livingRm OK

[/b]stWtrCld = indigo.variables[25559805].getValue(int) #streetWater COLD threshhold
stWtrOK = indigo.variables[483412678].getValue(int) #streetWater OK

upStrsCld = indigo.variables[840732144].getValue(int) #upstairs COLD threshhold
upStrsOK = indigo.variables[63463463].getValue(int) #upstairs OK

wCabCld = indigo.variables[415421705].getValue(float) #wineCabinet COLD threshhold
wCabOK = indigo.variables[364969593].getValue(float) #wineCabinet OK

outsideCld = indigo.variables[680985657].getValue(int) #outside COLD threshhold
outsideOK = indigo.variables[78723147].getValue(int) #outside OK

crwlSpcCld = indigo.variables[427855415].getValue(int) #crawlSpace COLD threshhold
crwlSpcOK = indigo.variables[1756484536].getValue(int) #crawlSpace OK

statSetPt = indigo.variables[453519410].getValue(int) #stat set point (from var, not stat)

# get the current temperatures (xxxC: abbreviation for space temp)
dev = indigo.devices[647163782] #street water
stWtrC = int(dev.states["temperature"])

dev = indigo.devices[895358553] #wine cabinet
wineCabC = int(dev.states["temperature"])

[b]dev = indigo.devices[883519697] #living room
lrC = int(dev.states["temperature"])
[/b]
[b]dev = indigo.devices[634066077] #upstairs
upStrsC = int(dev.states["temperature"])
[/b]
dev = indigo.devices[1969337208] #outside
outC = int(dev.states["temperature"])

dev = indigo.devices[892742387] #hot water tank
htWtrC = int(dev.states["temperature"])

dev = indigo.devices[1386749935] #heater sump
sumpC = int(dev.states["temperature"])

dev = indigo.devices[46322275] #crawl space
crwlSpcC = int(dev.states["temperature"])

# verify that the variables have been imported properly
[b]indigo.server.log(" season: {}".format(season))
[/b]
indigo.server.log(" outsideCld: {}".format(outsideCld))
indigo.server.log(" outC: {}".format(outC))

indigo.server.log(" crwlSpcCld: {}".format(crwlSpcCld))
indigo.server.log(" crwlSpcC: {}".format(crwlSpcC))

[b]indigo.server.log(" lRmCld: {}".format(lRmCld))
indigo.server.log(" lrC: {}".format(lrC))

indigo.server.log(" upStrsCld: {}".format(upStrsCld))
indigo.server.log(" upStrsC: {}".format(upStrsC))

[/b]indigo.server.log(" hSmpCld: {}".format(hSmpCld))
indigo.server.log(" sumpC: {}".format(sumpC))

indigo.server.log(" htWtrCld: {}".format(htWtrCld))
indigo.server.log(" htWtrC: {}".format(htWtrC))

indigo.server.log(" wCabCld: {}".format(wCabCld))
indigo.server.log(" wineCabC: {}".format(wineCabC))

indigo.server.log(" stWtrCld: {}".format(stWtrCld))
indigo.server.log(" stWtrC: {}".format(stWtrC))

# proceed with the if/then turn off heat for anything that is OK (> FD OK test) w AG
time.sleep(3) #allow time for temp variables to be updated
if stWtrC > stWtrOK:
   indigo.actionGroup.execute(358770212) #stWtr tape off
if wineCabC > wCabOK:
   indigo.actionGroup.execute(955423681) #wine can htr off
if sumpC > hSmpOK:
   indigo.actionGroup.execute(172000814) #htr sump tape off
if not hseOcc:
   if lrC > lRmOK or upStrsC > upStrsOK:
      if not("warmup18" or "warmup20"):
         indigo.actionGroup.execute(431011597) #htr 5C
   if htWtrC > htWtrOK:
      indigo.actionGroup.execute(460903989) #htWtr off
      
[b]# next, proceed with the if/then turn on heat for anything that is cold (fails FD test) w AG
if season == "winter":
   #if (lrC < lRmCld) or (upStrsC < upStrsCld):
   if (lrC < lRmCld):
#      if not("warmup18"):# or "warmup20"):
      if not("warmup18" or "warmup20"):
         indigo.actionGroup.execute(1307638528) #htr 7, cntr, main water off [/b]
   if sumpC < hSmpCld:
      indigo.actionGroup.execute(1808251937) #htr sump tape on, cntr
   if htWtrC < htWtrCld:
      indigo.actionGroup.execute(599509902) #htWtr On, cntr
   if stWtrC < stWtrCld:
      indigo.actionGroup.execute(90585841) #stWtr tape on, cntr, water off
   if wineCabC < wCabCld:
      indigo.actionGroup.execute(1406401903) #wine can htr on, cntr

#last, send email notifications f(FD condition)
   time.sleep(3) #allow time for devices to switch on as necessary before reporting their status
   if (lrC < lRmCld or \
      upStrsC < upStrsCld or \
      crwlSpcC < crwlSpcCld or \
      outC < outsideCld or \
      sumpC < hSmpCld or \
      htWtrC < htWtrCld or \
      stWtrC < stWtrCld or \
      wineCabC < wCabCld ):
         indigo.actionGroup.execute(966172245) #if any cond fails, sends FD email (AG - FD Status Email)

   elif (outC > outsideOK):
      indigo.actionGroup.execute(1538967727) # (AG - FD notCold email)

   else:
      indigo.actionGroup.execute(963098824) #all temps ok emai (AG - FD no exceptions email)





The preview showed that the bolding did not work. How can I help point to the issues in a script in the future?

Posted on
Sun Dec 15, 2019 12:39 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Unable to trigger action group

Unfortunately you can’t use BBCode formatting issue code blocks, as you’ve found.

I add lines of ######## either side of important bits when I’m trying to find sections of code.

Add to why its not working, given you’re using a lot of log lines already, I’d be tempted to add lines inside each if() that you can comment out or not when trying to debug something.

If(season = “winter”):
indigo.server.log(“Season is winter”)


if (lrC < lRmCld):
indigo.server.log(“Living Room is cold”)

If(not warmup18):
Indigo.server.log(“...”)

Etc


Sent from my iPhone using Tapatalk Pro

Posted on
Sun Dec 15, 2019 12:44 pm
matt (support) offline
Site Admin
User avatar
Posts: 21416
Joined: Jan 27, 2003
Location: Texas

Re: Unable to trigger action group

Neither of these lines make sense:

Code: Select all
#      if not("warmup18"):# or "warmup20"):
      if not("warmup18" or "warmup20"):

That will always evaluate as false. You aren't comparing a python variable to anything there. "warmup18" and "warmup20" are just strings. Any string that isn't empty will evaluate to True:

bool("warmup18")

will be True, so this:

if not("warmup18" or "warmup20")

is really just:

if not(True or True)

which is:

if not True:

which is:

if False:

Image

Posted on
Sun Dec 15, 2019 12:46 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Unable to trigger action group

:oops:


Sent from my iPhone using Tapatalk Pro

Posted on
Sun Dec 15, 2019 6:37 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: Unable to trigger action group

I thought I was creating two boolean variables with the following two lines.
Code: Select all
warmup18 = indigo.variables[566274194].getValue(bool)
warmup20 = indigo.variables[1193285363].getValue(bool)

So I'm not looking at strings - correct?
Code: Select all
      if not("warmup18" or "warmup20"):

- which I believe is what you are saying I need to do. If I understand your reply, since they are both false, I believe the condition for execution is met.
Are quotation marks used only for strings perhaps?
Or do I misunderstand your reply?

Posted on
Sun Dec 15, 2019 6:44 pm
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Unable to trigger action group

Yes, quotes make it a string.

Code: Select all
if not (warmup18 or warmup20):

is the correct boolean format, but I’ve not paid attention to the true/false bits of Matt’s reply.


Sent from my iPad using Tapatalk Pro

Posted on
Sun Dec 15, 2019 6:57 pm
SMUSEBY offline
Posts: 511
Joined: Sep 16, 2009
Location: California

Re: Unable to trigger action group

Quotes gone and it runs. Hoping that is the fix - needs to get a but colder first.
Thanks.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest