piBeacon: presence monitoring plugin discussions

User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: presence monitoring plugin discussions

Post by kw123 »

i simulated no messages by just removing the blue dongle. Then it hangs.

but that is exactly the situation it should cover..
WouterK
Posts: 167
Joined: Wed Aug 19, 2015 3:07 am

Re: piBeacon: presence monitoring plugin discussions

Post by WouterK »

My experience with the pi's is that removing something from the USB port is not something it likes and causes it sometimes to hangs.

Wouter
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: presence monitoring plugin discussions

Post by kw123 »

ok wouterK

v 1.5.5 offers an option to switch OFF the checking of the "alive" file. Just for you..(*)

Karl

there is no syntax issue, but since I cant simulate no messages, i did not really test it, but the logic makes sense:


Code: Select all

    try:
        if enableRebootCheck =="1":   ### <<<< added this
            f=open(homeDir+"alive","r")
            lastAlive=float(f.read().strip("\n"))
            f.close()
            if time.time()- lastAlive > 600:
                toErrLog(" -- (1) last seconds since change :"+ str(time.time()- lastAlive) +" -- (2) reboot seconds: "+ str(rebootSeconds))
         else:               ### <<<< added this
            lastAlive=time.time()        ### <<<< added this
    except:
        pass
        
    if time.time()- lastAlive > 600 and loopCount > 3 : reboot=2 #  nothing happened for xxx seconds: reboot
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: presence monitoring plugin discussions

Post by kw123 »

I am still trying to find anything about a timeout setting for waiting for

Code: Select all

pkt = sock.recv(255)
for reading the bluetooth data. It looks as if it just waits for ever for any message to arrive.

Any advice from the doc programming experts?

I could replace the reboot if nothing happens with a kill &restart of the beaconloop.py program that reads the iBeacons and send the data to the MAC.
Will look into it.


Karl
WouterK
Posts: 167
Joined: Wed Aug 19, 2015 3:07 am

Re: piBeacon: presence monitoring plugin discussions

Post by WouterK »

Hi,

downloaded installed the latest version but it will not start getting the following error(s):

Code: Select all

  Enabling plugin "piBeacon 1.5.6"
  Starting plugin "piBeacon 1.5.6" (pid 92552)
  piBeacon Error                  Error in plugin execution InitializeMain:

Traceback (most recent call last):
<type 'exceptions.SyntaxError'>: ('invalid syntax', ('plugin.py', 18, 15, 'dataVersion 6.1\n'))

  Stopping plugin "piBeacon 1.5.6" (pid 92552)
  Stopped plugin "piBeacon 1.5.6"
  Z-Wave                          received "PIR Keuken - Beweging" status update is on
  Error                           plugin "piBeacon 1.5.6" (pid 92552) failed to start -- restarting in 5 seconds
  Z-Wave                          received "PIR Keuken - Beweging" status update is off
  Reloading plugin "piBeacon 1.5.6"
  Starting plugin "piBeacon 1.5.6" (pid 92639)
  piBeacon Error                  Error in plugin execution InitializeMain:

Traceback (most recent call last):
<type 'exceptions.SyntaxError'>: ('invalid syntax', ('plugin.py', 18, 15, 'dataVersion 6.1\n'))
Wouter
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: presence monitoring plugin discussions

Post by kw123 »

:oops: :oops:

this happens when you want to do things quickly..

see the 1.5.7 post. I have added a selection for what to do if it thinks it"hangs": nothing, reboot, restart the program


Karl
WouterK
Posts: 167
Joined: Wed Aug 19, 2015 3:07 am

Re: piBeacon: presence monitoring plugin discussions

Post by WouterK »

Hi,

Things happen. Its great that you are doing all this work with this plugin.
Downloaded the latest version and installed it. (No Errors)

The rPi whitout the beacon is running steady now for the last 30 min. without a reboot!

The logging of both rPi's show the message : loopMaxCallBLE: 900
Has this something to do of setting the # loop value to 30?

(For now it certainly is not the most important thing but, (also with the previous version(s)) the state in the IndigoDomo interface is not correct.
It display's the rPi as "expired" and as soon it dectects a beacon it shows "up".)

Wouter
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: presence monitoring plugin discussions

Post by kw123 »

rPi as "expired"
the rPis are ibeacons too. they follow expiration schedules like the other Ibeacons. if they are not detected by other beacons or if they do not send a message they are set to expire.

you can change that by setting their expiration timer to e.g. 20 minutes in edit device the first option "transition from UP to DOWN to expired". if the rip does not receive any BLE message it is in a wait state and WILL NOT send anything. you could set the action to restart beaconLoop, then it would restart after 10 minutes. .. but it would still not send a message .. have to think about that one.

The logging of both rPi's show the message : loopMaxCallBLE: 900
where exactly do you see this and how often? depending on debug level it will show what it is reading from the parameters file once a minute (debug >=1)

Karl
WouterK
Posts: 167
Joined: Wed Aug 19, 2015 3:07 am

Re: piBeacon: presence monitoring plugin discussions

Post by WouterK »

Hi,

I see this in the logfile. Debuglevel=0
After changing the debuglevel=1 it show the following in the logfile:
  • tail -f logfile
    signalDelta: {}
    ignoreUUID: []
    ignoreMAC: [u'7A:A5:17:A1:B9:93', u'55:7E:89:9D:EC:88', u'62:2B:E0:D9:0E:7B', u'59:19:A2:9B:E4:70', u'64:F3:AA:51:40:07', u'54:60:09:0C:A1:BB', u'67:69:92:FD:F9:D2', u'58:89:20:C8:A4:4D', u'4B:0E:4F:30:E8:46', u'54:E0:C5:77:08:01', u'5D:60:E9:47:EC:7E', u'59:CA:19:BE:1A:A7', u'6C:31:BA:70:C8:4C', u'71:39:51:0C:40:4C', u'49:D8:FA:BF:6D:7E', u'49:A1:69:91:44:25', u'69:84:DF:E1:93:C5', u'55:11:D0:97:07:43']
    UUIDtoIphone: {}
    starting bluetooth
    BLE start returned : ('hci0:\tType: BR/EDR Bus: USB\n\tBD Address: 00:1A:7D:DA:71:04 ACL MTU: 310:10 SCO MTU: 64:8\n\tUP RUNNING \n\tRX bytes:1702 acl:0 sco:0 events:77 errors:0\n\tTX bytes:833 acl:0 sco:0 commands:65 errors:0\n\n', '')
    my BLE mac# is : 00:1A:7D:DA:71:04
    ble thread started
    msg: /usr/bin/curl -u xxxx:xxxxx --digest -X PUT -d value='{"pi_IN_":"1","ipAddress":"192.168.1.46","mac":"00:1A:7D:DA:71:04","msgs":[["00:EA:23:41:0B:F4",2,"07775dd0111b11e491910800200c9a66-9025-3060",-66.0,-60.0,1,""]],"secsCol":"3"}' http://192.168.1.35:8176/variables/pi_IN_1

    msg: /usr/bin/curl -u xxxx:xxxxx --digest -X PUT -d value='{"pi_IN_":"1","ipAddress":"192.168.1.46","mac":"00:1A:7D:DA:71:04","msgs":[["00:EA:23:41:0B:F4",1,"0-0-0",-64.2,-60.0,55,""]],"secsCol":"61"}' http://192.168.1.35:8176/variables/pi_IN_1

    msg: /usr/bin/curl -u xxxx:xxxxx --digest -X PUT -d value='{"pi_IN_":"1","ipAddress":"192.168.1.46","mac":"00:1A:7D:DA:71:04","msgs":[["00:EA:23:41:0B:F4",1,"0-0-0",-64.5,-60.0,55,""]],"secsCol":"60"}' http://192.168.1.35:8176/variables/pi_IN_1

    loopMaxCallBLE: 900
    fastDown: {}
    signalDelta: {}
    ignoreUUID: []
    ignoreMAC: [u'7A:A5:17:A1:B9:93', u'55:7E:89:9D:EC:88', u'62:2B:E0:D9:0E:7B', u'59:19:A2:9B:E4:70', u'64:F3:AA:51:40:07', u'54:60:09:0C:A1:BB', u'67:69:92:FD:F9:D2', u'58:89:20:C8:A4:4D', u'4B:0E:4F:30:E8:46', u'54:E0:C5:77:08:01', u'5D:60:E9:47:EC:7E', u'59:CA:19:BE:1A:A7', u'6C:31:BA:70:C8:4C', u'71:39:51:0C:40:4C', u'49:D8:FA:BF:6D:7E', u'49:A1:69:91:44:25', u'69:84:DF:E1:93:C5', u'55:11:D0:97:07:43']
    UUIDtoIphone: {}
    msg: /usr/bin/curl -u xxxx:xxxxx --digest -X PUT -d value='{"pi_IN_":"1","ipAddress":"192.168.1.46","mac":"00:1A:7D:DA:71:04","msgs":[["00:EA:23:41:0B:F4",1,"0-0-0",-65.0,-60.0,54,""]],"secsCol":"60"}' http://192.168.1.35:8176/variables/pi_IN_1

    msg: /usr/bin/curl -u xxxx:xxxxx --digest -X PUT -d value='{"pi_IN_":"1","ipAddress":"192.168.1.46","mac":"00:1A:7D:DA:71:04","msgs":[["00:EA:23:41:0B:F4",1,"0-0-0",-64.7,-60.0,59,""]],"secsCol":"60"}' http://192.168.1.35:8176/variables/pi_IN_1

    loopMaxCallBLE: 900
    fastDown: {}
    signalDelta: {}
    ignoreUUID: []
    ignoreMAC: [u'7A:A5:17:A1:B9:93', u'55:7E:89:9D:EC:88', u'62:2B:E0:D9:0E:7B', u'59:19:A2:9B:E4:70', u'64:F3:AA:51:40:07', u'54:60:09:0C:A1:BB', u'67:69:92:FD:F9:D2', u'58:89:20:C8:A4:4D', u'4B:0E:4F:30:E8:46', u'54:E0:C5:77:08:01', u'5D:60:E9:47:EC:7E', u'59:CA:19:BE:1A:A7', u'6C:31:BA:70:C8:4C', u'71:39:51:0C:40:4C', u'49:D8:FA:BF:6D:7E', u'49:A1:69:91:44:25', u'69:84:DF:E1:93:C5', u'55:11:D0:97:07:43']
    UUIDtoIphone: {}
It seems like every minute.

Wouter
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: presence monitoring plugin discussions

Post by kw123 »

that loopMaxCallBLE is a bug:

Code: Select all

               if loopMaxCallBLE!=int(w) or init:              loopMaxCallBLE!=int(w);          toLog( 0,"loopMaxCallBLE:            "   +  str(loopMaxCallBLE))
should be:

Code: Select all

                if loopMaxCallBLE!=int(w) or init:              loopMaxCallBLE=int(w);          toLog( 0,"loopMaxCallBLE:            "   +  str(loopMaxCallBLE))

have a new version that restarts/ reboots better this afternoon. still testing, have that one fixed too.

Karl
WouterK
Posts: 167
Joined: Wed Aug 19, 2015 3:07 am

Re: piBeacon: presence monitoring plugin discussions

Post by WouterK »

Hi,

I will try the new version as soon as possible after it is available.
Great that you found the cause of the "loopMaxCallBLE".

Wouter
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: presence monitoring plugin discussions

Post by kw123 »

wouterK: v 1.6.1 should make you happy. if I did not add another oops

Karl
WouterK
Posts: 167
Joined: Wed Aug 19, 2015 3:07 am

Re: piBeacon: presence monitoring plugin discussions

Post by WouterK »

:D

Thanks, most of the time I am happy :) .
Just installed the new version. As far I can see for now there are no messages in the logfile concerning loopMaxCallBLE: 900
I will let it run overnight en let you know how it went.

Wouter
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: presence monitoring plugin discussions

Post by kw123 »

wouterK:

May I suggest you add one more rPi in a position that each rPi sees at least one other rPi. This will do away with expiration and will then cover the whole house.


Karl
WouterK
Posts: 167
Joined: Wed Aug 19, 2015 3:07 am

Re: piBeacon: presence monitoring plugin discussions

Post by WouterK »

Hi,

Thanks for the suggestion and I will. But I have to buy some extra components.
First I want to make sure that pibeacon is the solution for what I want to use it for.
Now I am using fingscan for our presence detection and it works very well. I am trying to use pibeacon as an alternative because the xyfind beacons you can bundle with your home/car/bicycle keys. You always lock the door as for the phone I sometime forget.......

My garage is the first "contact" so I have placed one there. Because the garage is detached and it is kind of a distance between the garage and the house I have, for now, placed one in the house. The distance is to far to see each other.
If it turns out to be something that can work in my situation I want to place more rPi's to get better coverage. (Thinking of Pi zero's)..........

Wouter
Post Reply

Return to “piBeacon”