How to get Battery Level to work

Posted on
Sat Jul 11, 2020 8:03 pm
johnfdl offline
Posts: 177
Joined: May 18, 2017
Location: Atlanta, GA USA

How to get Battery Level to work

Karl,

I have a few Nonda iHere beacons and unsure why the battery level is not showing. They are the iHere which apparently work to get battery level and I enabled it in the beacon edit. Do I need to install gatttool or update the SSD image? I am on the latest plug-in. Beacons work fine but don't show a battery level (technically it shows the meter but it's at zero.
Attachments
Configure_beacon.jpg
Configure_beacon.jpg (94.05 KiB) Viewed 2750 times

Posted on
Sun Jul 12, 2020 9:11 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: How to get Battery Level to work

you can set beep to on.

looks good.

could you do
ssh to rpi
tail -f /var/log/pibeacon

then in plugin menu get ibeacon battery level..
and if you have > 1 rpi select the rpi you just ssh'ed and select all beacons < execute>
post the plugin.log part

there seems to be a problem w the RPI0w and the battery command, still on my to do list
so which type of RPI are you using?


Karl

Posted on
Sun Jul 12, 2020 10:50 am
johnfdl offline
Posts: 177
Joined: May 18, 2017
Location: Atlanta, GA USA

Re: How to get Battery Level to work

Thanks. Unsure I have a use case fro the beep (and I don't have a current ssd image.....mine is likely from 2017.

You said "then in plugin menu get ibeacon battery level.."

I don't see a menu item labelled 'get ibeacon battery level". Do you mean "Get iBeacon Parameters from rPi"? If so, here's the output of the log:

2020-07-12 09:19:39 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-47:4A:79:33:20:27 UUID: mac-4376-56339
2020-07-12 09:19:39 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-63:EA:E4:45:B6:78 UUID: mac-19224-61988
2020-07-12 09:19:39 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-76:E4:2F:09:CE:87 UUID: 0a070bff4c00100635-6662-18159
2020-07-12 09:19:41 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-77:0E:E3:94:D3:C2 UUID: 0a0c0bff4c00100603-6769-18055
2020-07-12 09:19:41 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-5F:90:D9:AB:F0:76 UUID: 0a0c0bff4c0010061e-7864-20344
2020-07-12 09:20:05 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-61:D7:D0:1C:DB:5B UUID: 0a0c0bff4c0010065b-7910-40232
2020-07-12 09:20:57 creating new beacon, received from pi # 0/B8:27:EB:5D:F1:8D: beacon-76:F9:A1:57:15:D7 UUID: 011a020a0c0aff4c001005-796-30914
2020-07-12 09:20:58 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-73:57:C7:F3:C5:F5 UUID: 0a0c0bff4c00100614-7779-50333
2020-07-12 09:21:45 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-66:85:03:27:34:EE UUID: 011a020a080aff4c001005-12824-59121
2020-07-12 09:22:14 creating new beacon, received from pi # 0/B8:27:EB:5D:F1:8D: beacon-DF:5F:D6:C0:F3:79 UUID: 01060302affe0609-20016-17456
2020-07-12 09:22:17 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-75:3B:1B:38:F0:88 UUID: 011a020a0c0aff4c001005-4888-62148
2020-07-12 09:23:13 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-69:47:3B:37:5A:1C UUID: 011a020a0c0aff4c001005-22300-11875
2020-07-12 09:25:09 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-55:C1:4D:C5:4E:9D UUID: 0a0c0bff4c00100611-6821-41684
2020-07-12 09:25:34 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-5E:2E:0E:08:2C:67 UUID: 070f7aa00c5b7d4b62c2e55fb110064f-7726-6234
2020-07-12 09:26:45 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-71:4D:7C:EB:02:8F UUID: 011a020a080aff4c001005-30492-6288
2020-07-12 09:27:12 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-5E:CE:37:E2:34:AA UUID: 0a0c0bff4c0010065b-7877-9231
2020-07-12 09:27:29 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-7F:BF:1B:96:78:A0 UUID: 0a0c0bff4c00100608-7918-39709
2020-07-12 09:27:41 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-79:13:0F:C8:66:68 UUID: mac-4376-20571
2020-07-12 09:27:48 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-4A:29:E3:86:C0:53 UUID: 000719010e200b998f000009071f1787-52736-16250
2020-07-12 09:29:00 creating new beacon, received from pi # 1/B8:27:EB:26:8D:A7: beacon-4A:E1:0F:5D:A6:E9 UUID: 011a020a180aff4c001005-408-12994
09:29:25 -myLogSet setting parameters -- logFileActive= indigo; logFile= /Library/Application Support/Perceptive Automation/Indigo 7.4/Logs/com.karlwachs.piBeacon/plugin.log; debug plugin:[] RPI#:-1
2020-07-12 09:47:41 rpi: 0 update thread stopped, state was:stop ; all;
2020-07-12 09:47:41 rpi: 1 update thread stopped, state was:stop ; all;
2020-07-12 09:47:42 rpi: 0 update thread stopped, state was:stopped - exiting thread
2020-07-12 09:47:45 !!!!INFO ONLY!!!! logger enabled for THREADDEBUG !!!!INFO ONLY!!!!
2020-07-12 09:47:45 !!!!INFO ONLY!!!! logger enabled for DEBUG !!!!INFO ONLY!!!!
2020-07-12 09:47:45 !!!!INFO ONLY!!!! logger enabled for INFO !!!!INFO ONLY!!!!
2020-07-12 09:47:45 !!!!INFO ONLY!!!! logger enabled for WARNING !!!!INFO ONLY!!!!
2020-07-12 09:47:45.139 ERROR Plugin.__init__ !!!!INFO ONLY!!!! logger enabled for ERROR !!!!INFO ONLY!!!!
2020-07-12 09:47:45.140 CRITICAL Plugin.__init__ !!!!INFO ONLY!!!! logger enabled for CRITICAL !!!!INFO ONLY!!!!
09:47:45 -myLogSet setting parameters -- logFileActive= indigo; logFile= /Library/Application Support/Perceptive Automation/Indigo 7.4/Logs/com.karlwachs.piBeacon/plugin.log; debug plugin:[] RPI#:-1
2020-07-12 09:47:45 setting BeaconsCheck to off (no up-->down) for 125 secs requested by: setVariables
09:47:45 - --V 7.120.361 initializing --
2020-07-12 09:47:45 starting UpdateRPIqueues
2020-07-12 09:47:45 .. restarting thread for pi# 1, state was : -
2020-07-12 09:47:46 .. restarting thread for pi# 0, state was : -
2020-07-12 09:47:46 .. config read from files
2020-07-12 09:47:47 MAP2Vendor initializing
2020-07-12 09:47:47 MAP2Vendor initializing finished, read from mac2Vendor.json file
2020-07-12 09:47:47 MAP2Vendor initializing finished, read from mac2Vendor.json file
2020-07-12 09:47:47 .. checking devices tables
2020-07-12 09:47:49 startup(self): setting variables, debug .. finished
2020-07-12 09:47:50 setting BeaconsCheck to off (no up-->down) for 50 secs requested by: initConcurrentThread
2020-07-12 09:47:50 .. starting tcpip stack
2020-07-12 09:48:11 .. tcpip stack started
2020-07-12 09:48:11 setting BeaconsCheck to off (no up-->down) for 40 secs requested by: initConcurrentThread
2020-07-12 09:48:11 .. checking sensors
2020-07-12 09:48:11 .. checking BLEconnect
2020-07-12 09:48:11 .. checking beacons
2020-07-12 09:48:12 setting BeaconsCheck to off (no up-->down) for 50 secs requested by: initConcurrentThread
2020-07-12 09:48:12 .. initialized, starting loop
2020-07-12 09:48:39 BeaconsCheckPeriod waiting for reboot, no changes in up--> down status for another 23[secs]

Posted on
Sun Jul 12, 2020 10:53 am
johnfdl offline
Posts: 177
Joined: May 18, 2017
Location: Atlanta, GA USA

Re: How to get Battery Level to work

And here's what was in the terminal window from the ssh:

pi@raspberrypi:~ $ tail -f /var/log/pibeacon
12-09:13:38 master readNewParams L:382 Lv:30 UPS-V2 interface NOT enabled
12-09:13:45 master readNewParams L:445 Lv:20 sensors :
12-09:19:40 master fixRcLocal L:1531 Lv:20 writing callbeacon.py file
12-09:19:40 master readNewParams L:233 Lv:20 output devices: {}
12-09:19:41 master readNewParams L:382 Lv:30 UPS-V2 interface NOT enabled
12-09:19:47 master readNewParams L:445 Lv:20 sensors :
12-09:29:49 master fixRcLocal L:1531 Lv:20 writing callbeacon.py file
12-09:29:49 master readNewParams L:233 Lv:20 output devices: {}
12-09:29:50 master readNewParams L:382 Lv:30 UPS-V2 interface NOT enabled
12-09:29:56 master readNewParams L:445 Lv:20 sensors :
12-09:48:21 master fixRcLocal L:1531 Lv:20 writing callbeacon.py file
12-09:48:21 master readNewParams L:233 Lv:20 output devices: {}
12-09:48:21 master readNewParams L:382 Lv:30 UPS-V2 interface NOT enabled
12-09:48:21 master readNewParams L:416 Lv:30 restart due to new input master
12-09:48:22 master execMaster L:2094 Lv:30 ========================= starting master version: 12.7
12-09:48:25 master execMaster L:2117 Lv:20 START.. indigoServer @ IP:>>192.168.0.28<<
12-09:48:26 piBeaconUtils getIPNumberMaster L:1457 Lv:20 cBY:master found IP number:192.168.0.24
12-09:48:30 piBeaconUtils getIPNumberMaster L:1523 Lv:20 cBY:master IP info: IPs#: changed:><; connected:True; IndigoServer>192.168.0.28<; Router>192.168.0.1<; wlan0>192.168.0.24<; eth0><; G.wlanActive:True; G.eth0Active:False; AddressFile>192.168.0.24<; PKTS(eth0>0,<; wlan0>584831,<, dTime:99.9)
12-09:48:30 piBeaconUtils getIPNumberMaster L:1524 Lv:20 cBY:master ... Requested Config:{u'wlan0': {u'on': u'on', u'useIP': u'use'}, u'eth0': {u'on': u'off', u'useIP': u'doNotUse'}}
12-09:48:35 master checknetwork0 L:1621 Lv:30 no ip number working, trying again, indigoServerOn:False, ip:192.168.0.24
12-09:48:35 piBeaconUtils getIPNumberMaster L:1457 Lv:20 cBY:master found IP number:192.168.0.24
12-09:48:39 piBeaconUtils getIPNumberMaster L:1523 Lv:20 cBY:master IP info: IPs#: changed:><; connected:True; IndigoServer>192.168.0.28<; Router>192.168.0.1<; wlan0>192.168.0.24<; eth0><; G.wlanActive:True; G.eth0Active:False; AddressFile>192.168.0.24<; PKTS(eth0>0,0<; wlan0>584837,584831<, dTime:9.2)
12-09:48:39 piBeaconUtils getIPNumberMaster L:1524 Lv:20 cBY:master ... Requested Config:{u'wlan0': {u'on': u'on', u'useIP': u'use'}, u'eth0': {u'on': u'off', u'useIP': u'doNotUse'}}
12-09:48:44 master checknetwork0 L:1621 Lv:30 no ip number working, trying again, indigoServerOn:False, ip:192.168.0.24
12-09:48:44 piBeaconUtils getIPNumberMaster L:1457 Lv:20 cBY:master found IP number:192.168.0.24
12-09:48:48 piBeaconUtils getIPNumberMaster L:1523 Lv:20 cBY:master IP info: IPs#: changed:><; connected:True; IndigoServer>192.168.0.28<; Router>192.168.0.1<; wlan0>192.168.0.24<; eth0><; G.wlanActive:True; G.eth0Active:False; AddressFile>192.168.0.24<; PKTS(eth0>0,0<; wlan0>584841,584837<, dTime:9.3)
12-09:48:48 piBeaconUtils getIPNumberMaster L:1524 Lv:20 cBY:master ... Requested Config:{u'wlan0': {u'on': u'on', u'useIP': u'use'}, u'eth0': {u'on': u'off', u'useIP': u'doNotUse'}}
12-09:48:53 master checknetwork0 L:1621 Lv:30 no ip number working, trying again, indigoServerOn:False, ip:192.168.0.24
12-09:48:53 piBeaconUtils getIPNumberMaster L:1457 Lv:20 cBY:master found IP number:192.168.0.24
12-09:48:58 piBeaconUtils getIPNumberMaster L:1523 Lv:20 cBY:master IP info: IPs#: changed:><; connected:True; IndigoServer>192.168.0.28<; Router>192.168.0.1<; wlan0>192.168.0.24<; eth0><; G.wlanActive:True; G.eth0Active:False; AddressFile>192.168.0.24<; PKTS(eth0>0,0<; wlan0>584850,584841<, dTime:9.3)
12-09:48:58 piBeaconUtils getIPNumberMaster L:1524 Lv:20 cBY:master ... Requested Config:{u'wlan0': {u'on': u'on', u'useIP': u'use'}, u'eth0': {u'on': u'off', u'useIP': u'doNotUse'}}
12-09:49:03 master checknetwork0 L:1621 Lv:30 no ip number working, trying again, indigoServerOn:False, ip:192.168.0.24
12-09:49:03 master checknetwork0 L:1613 Lv:30 no ip number working, giving up, running w/o ip number, setting mode to clockMANUAL
12-09:49:04 master fixRcLocal L:1531 Lv:20 writing callbeacon.py file
12-09:49:04 master readNewParams L:233 Lv:20 output devices: {}
12-09:49:04 master readNewParams L:382 Lv:30 UPS-V2 interface NOT enabled
12-09:49:10 master readNewParams L:445 Lv:20 sensors :
12-09:49:11 installLibs <module> L:316 Lv:30 installLibs starting
12-09:49:11 installLibs <module> L:343 Lv:30 installLibs no opsys upgrade requested
12-09:49:11 installLibs <module> L:366 Lv:30 ==== libraries seem to be setup, no need for action
12-09:49:11 installLibs <module> L:368 Lv:30 ==== libraries install finished
12-09:49:11 master startProgam L:615 Lv:20 >>>> starting beaconloop.py at startup ;-- with cmd: sudo /usr/bin/python /home/pi/pibeacon/beaconloop.py &
12-09:49:12 piBeaconUtils getIPNumber L:633 Lv:20 cBY:beaconloop found new IP number:192.168.0.24
12-09:49:12 beaconloop startBlueTooth L:144 Lv:30 (re)starting bluetooth
12-09:49:12 beaconloop startBlueTooth L:167 Lv:20 Beacon Use HCINo -1; useHCI:hci0; myBLEmac:B8:27:EB:26:8D:A7; devId:0
12-09:49:12 beaconloop startBlueTooth L:180 Lv:20 hcitool -i hci0 cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 2f 23 44 54 cf 6d 4a 0f ad f2 f4 91 1b a9 ff a6 00 09 00 01 C5 00 &
12-09:49:12 beaconloop startBlueTooth L:190 Lv:20 hcitool -i hci0 cmd 0x08 0x0006 00 10 00 20 03 00 00 00 00 00 00 00 00 07 00 &
12-09:49:13 beaconloop startBlueTooth L:196 Lv:20 hcitool -i hci0 cmd 0x08 0x000a 01 &
12-09:49:13 beaconloop startBlueTooth L:208 Lv:20 BLE start returned:
hci0: Type: BR/EDR Bus: UART
BD Address: B8:27:EB:26:8D:A7 ACL MTU: 1021:8 SCO MTU: 64:1
UP RUNNING
RX bytes:675077281 acl:0 sco:1 events:16984024 errors:0
TX bytes:4992 acl:0 sco:0 commands:179 errors:0

my BLE mac# is >>B8:27:EB:26:8D:A7<<
12-09:49:13 beaconloop startBlueTooth L:246 Lv:30 ble thread started
12-09:49:13 beaconloop execbeaconloop L:1185 Lv:30 starting loop
12-09:49:16 piBeaconUtils getIPNumberMaster L:1457 Lv:20 cBY:master found IP number:192.168.0.24
12-09:49:20 piBeaconUtils getIPNumberMaster L:1523 Lv:20 cBY:master IP info: IPs#: changed:><; connected:True; IndigoServer>192.168.0.28<; Router>192.168.0.1<; wlan0>192.168.0.24<; eth0><; G.wlanActive:True; G.eth0Active:False; AddressFile>192.168.0.24<; PKTS(eth0>0,0<; wlan0>584887,584850<, dTime:22.4)
12-09:49:20 piBeaconUtils getIPNumberMaster L:1524 Lv:20 cBY:master ... Requested Config:{u'wlan0': {u'on': u'on', u'useIP': u'use'}, u'eth0': {u'on': u'off', u'useIP': u'doNotUse'}}
12-09:49:20 master execMaster L:2234 Lv:20 starting loop

Posted on
Wed Jul 15, 2020 4:15 pm
johnfdl offline
Posts: 177
Joined: May 18, 2017
Location: Atlanta, GA USA

Re: How to get Battery Level to work

let me know if I can provide any other details to help get battery levels reporting.

Posted on
Thu Jul 16, 2020 4:51 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

How to get Battery Level to work

just posted a version that makes it a little clearer..

New beacons will be set every automatically.
Existing beacons: you need to edit and save. It will set the battery parameters correctly (as defined in the file knownBeaconTags.json in the plugin preference directory).
Also changed the menu / action text to make it clearer.

As stated before: you can follow on the plugin w config/debug ibeacon battery level==> check
then in plugin.log file you can see the command send to the rpi(s)

and on the rpi
w tail -f /var/log/pibeacon
you can follow the execution on the RPI


Karl
Ps if properly configured the plugin will automatically get the battery level every 8-16 hours

Posted on
Tue Aug 04, 2020 6:43 pm
johnfdl offline
Posts: 177
Joined: May 18, 2017
Location: Atlanta, GA USA

Re: How to get Battery Level to work

ok, I think it doesn't work for me as I have an old SSD card image. So I assume I just need to shutdown the rPis, put the new image on SSD and insert the SSD into the rPi and power up the rPi?

Also, not sure if it is just me but twice now since updating to the latest plug-in, my rPis seem to keep going up and down repeatedly. Stopping/Restarting the plug-in has no affect, but restarting the Indigo server fixes the issue at least for a few days to a week. Just throwing this out there should anyone else be experiencing the issue.

Posted on
Tue Aug 04, 2020 8:55 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: How to get Battery Level to work

>> ok, I think it doesn't work for me as I have an old SSD card image. So I assume I just need to shutdown the rPis, put the new image on SSD and insert the SSD into the rPi and power up the rPi?<<
in principle yes, You might have an issue with the ssh fingerprint signature file, but pibeacon SHOULD take care of that.

As for the beacon up/down.
the get battery function takes owernship of the BLE stack on the RPI. in some configs (rpi type, # of dongles, w/wo BLEconnect the regular beacon loop might not restart and it takes master.py too long to restart the beacon program, that could happen at 4am, noon, 8 pm.

the newest version should handle that right. it will restart the while program set after get battery level .. are finished.

As I have 15++ rpi running, if one of them is out of commission for some minutes, one of the other rpi will pick up the beacon (that is how my rpi are positioned.) So I did not experience that effect... at least that is my interpretation.

Karl
new release with sensor BMP388 high precision pressure sensor support coming up.
It has an accuracy equivalent to 0.8 m( < 3 feet) height difference, so you should see if your sensor is on the first or second floor( or 0/1 in continental Europe)

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests