piBeacon Error after upgrade to 2022.160.16

Posted on
Wed Dec 14, 2022 1:50 pm
Sam offline
Posts: 34
Joined: Aug 22, 2016

piBeacon Error after upgrade to 2022.160.16

Hi,
I get an error after upgrade piBeacon-plugin to 2022.160.16, Indigo version 2022.1.2.

piBeacon Error 'local variable 'xx' referenced before assignment'
setGroupStatus @line 1739: 'triggerGroup[xx]["oneHome"] = False'


I only use the plugin for sensors. The Pi:s location is 21-26.

Any ideas?
Thanks in advance.. /Sam

Posted on
Fri Dec 30, 2022 5:01 am
johnpolasek offline
Posts: 911
Joined: Aug 05, 2011
Location: Aggieland, Texas

Re: piBeacon Error after upgrade to 2022.160.16

I just noticed that I am getting it as well (almost never check the log)... it does not seem to be affecting the execution though.

Posted on
Fri Jan 20, 2023 1:21 pm
johnpolasek offline
Posts: 911
Joined: Aug 05, 2011
Location: Aggieland, Texas

Re: piBeacon Error after upgrade to 2022.160.16

Finally got a chance to look at the actual code; the relevant portions (still present in 2022.160.19) is and the failure occurs in the elif apparently for nonBLE devices that are not sensors:
Code: Select all
            if dev.deviceTypeId  in ["rPI","rPI-Sensor","beacon","BLEconnect"]:
               for xx in _GlobalConst_groupListDef:
                  if xx == "SENSOR": continue
                  
                  if dev.states["note"].lower().find(xx.lower()) >-1:
                     if dev.states["status"] == "up":
                        self.groupStatusList[xx]["nHome"]     +=1
                        triggerGroup[xx]["oneHome"]               = True
                     else:
                        self.groupStatusList[xx]["nAway"]     +=1
                        triggerGroup[xx]["oneHome"]               = False
                  okList.append("{}".format(dev.id))

            elif dev.pluginProps.get("isSensorDevice",False):
                        dt = (datetime.datetime.now() - dev.lastChanged).seconds
                        up = dt < self.awayWhenNochangeInSeconds
                        #self.indiLOG.log(10,"setGroupStatus1 {}, dt:{} , up:{}, self.awayWhenNochangeInSeconds:{}".format(dev.name, dt, up, self.awayWhenNochangeInSeconds))
                        if up:
                           self.groupStatusList["SENSOR"]["nHome"]     +=1
                           triggerGroup[xx]["oneHome"]               = True
                        else:
                           triggerGroup[xx]["oneHome"]               = False
                           self.groupStatusList["SENSOR"]["nAway"]     +=1
                        okList.append("{}".format(dev.id))



and since I don't know what kind of non sensor, non BLE devices would have "devlastChanged" states, I can't be sure whether the entire elif should be removed OR another
Code: Select all
               for xx in _GlobalConst_groupListDef:

should be added just under the
#self.indiLOG.log(10,"setGroupStatus1 {}, dt:{} , up:{}, self.awayWhenNochangeInSeconds:{}".format(dev.name, dt, up, self.awayWhenNochangeInSeconds))

and I don't want to break anything by tweaking the code.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 4 guests

cron