need help design the custom image names

Posted on
Wed Jan 18, 2017 7:11 pm
johnpolasek offline
Posts: 843
Joined: Aug 05, 2011
Location: Aggieland, Texas

Re: need help design the custom image names

Or if you are going to list text, as I already do with the beacons at home, you can script the lists and then print the concatenated variables; I already have an action called "Check Beacons" that each of my valid beacons calls on change of status with a script to sweep the beacons folder and build a list left over from when PiBeacon was simpler; I just added a few lines to create extra lists for each rPi individually:

Code: Select all
#Call this from a trigger on State "status" "has any change" for each "beacon" that you wish have set the house status.
#Now get the status of all beacons in the valid beacon folder.  Assume all are expired to start
AllExpired = "expired"
WhosHere = ""
PiCount = 0
# Add as many of these as you have rPis
RPi0Close = ""
RPi1Close = ""
#Find beacons in "Valid piBeacons" Folder (ID 552440476)
for MyDevice in indigo.devices:
    if MyDevice.folderId == 552440476:
       if (MyDevice.states["status"] == "up"):
          AllExpired = MyDevice.states["status"] # State "status" of next Device in myNewDictionary
          WhosHere = WhosHere + u" " +
          PiCount = PiCount + 1

            #Add as many of these as you have rPis
          if (MyDevice.states["closestRPI"] == 0):
              RPi0Close = RPi0Close + u" " +
          if (MyDevice.states["closestRPI"] == 1):
              RPi1Close = RPi1Close + u" " +

if (AllExpired == "expired"):
   indigo.variable.updateValue(1363252541, value="Gone") # Home Status
   indigo.variable.updateValue(729737176, value="true") # another Home Status
   indigo.variable.updateValue(1363252541, value="Here") # Home Status
   indigo.variable.updateValue(729737176, value="false") # another Home Status

indigo.variable.updateValue(1332290367, value = WhosHere) # List of all valid Beacons at Home
indigo.variable.updateValue(104188384, value = unicode(PiCount)) # Number of beacons at home
indigo.variable.updateValue(614002335, value = unicode(PiCount)) # another Number of beacons at home

#Add as many of these as you have rPis
VarPiID0 =642149151
indigo.variable.updateValue(VarPiID0,  value = RPi0Close) # Beacons near Pi0
indigo.variable.updateValue(VarPiID1, value = RPi1Close) # Beacons near Pi1

If you've got a LOT of Pis like Karl, you can replace the individual variables and ifs with vectors called RPiClose and VarPiID and a loop from 0 to however many, and/or break out family from Guests, etc...

Posted on
Wed Jan 18, 2017 7:37 pm
kw123 offline
User avatar
Posts: 6251
Joined: May 12, 2013
Location: Dallas, TX

Re: need help design the custom image names


Who is online

Users browsing this forum: No registered users and 1 guest