piBeacon: 3- presence monitoring download

Posted on
Sun Jan 19, 2020 9:42 am
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

Added features / changes in v7.115.329 @ 2019-01-18
===================================================
Code: Select all
1. device state " batteryLevelLastUpdate" to iBeacon devices.
with this information you can see when the last successful update of the iBeacon battery level was obtained.

2. add daily report to indigo log / plugin log if batterylevel to low or update older than 2 days eg:
piBeacon Warning batterylevel level test:
b-iHere black2 last level reported: 74%, has not been updated for > 2 days:
b-iHere_black last level reported: 76%, has not been updated for > 2 days:
b-Mazda-aaa level down to: 11% ... charge or replace battery

if all ok one line "batterylevel level test: no iBeacon found with low battery indicator or old update" is printed to plugin.log
you could trigger on event log warning to check for that output

2. if there are any active ibeacons w battery reporting, each morning at 4 or after plugin relaunch
the plugin will request a battery level update from the RPIs


The battery information can be obtained from
aiko
iHERE
xy beacon
social retail
types of iBeacons. May be some others too, but not tested.

Karl

Posted on
Sun Jan 19, 2020 9:09 pm
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

Code: Select all
Added features / changes in v7.115.330 @ 2019-01-19
===================================================

1. fixed:  get batterly level for noda aiko beacons. They are a little special
   they use 6 bits, the 7th bit is always on, max value is 36 hex = 54 int That means a value of hex 36 is 100% battery level
   In device edit you must use/set the proper ibeacon type for battery level read.


Karl

Posted on
Thu Jan 23, 2020 10:35 am
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

Code: Select all
Added features / changes in v7.115.332 @ 2019-01-23
===================================================

1. optimized acquisition of battery level for ibeacons
   - repeat process every 8 hours(4/12/20). Request to read if last successfull read was > 17 hour or battery level < 20%
   - send  tasks to closest rpi for each beacon
   - prevent up-->down status change for ibeacons during measurement times
   - generate a warning log entry when ibeacon has bad / old info: > 2 days or < 20% once a day at 8am
  ==> you need to enable this option idividually for each beacon in device edit

2. split of getBeaconParameters.py from execcommands.py to be able to better mange termination of processes

3. added comments in device edit for battery level setting and process.

4. streamlined plugin process to manage do not do up--> donw status changes while RPIs are busy

5. added several comments and explanations to config and device edit

6. added a reboot trigger on RPI if error "too many open files"

Karl

Posted on
Sun Jan 26, 2020 5:16 pm
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

!!To be able to add some more BLE pibeacon servers !!
I like to have one per room and some outside to really pinpoint the beacons ie in which room/ outside are the beacons - and 16 should be enough.

Coming up:

++++ STRUCTURAL CHANGE: ++++
# of ibeacon pi-servers to increase from (#0-#9) to (#0-#15) == 10 --> 16 pi-servers
# of sensor only pi-servers to increase from (#10-#19) to (#16-#40) == 10 --> 25 pi servers
As a consequence CURRRENT pi- servers #0-#9 should not experience any change.
BUT current pi-servers #10-#15 will need to be re-created as pi-servers #16 .. #40 (pick any number) ie sensors-only pi-servers
Also all sensors and output devices need to point to the new pi-server numbers (device edit of sensors and outputs)
++++ STRUCTURAL CHANGE: ++++

Unfortunately the data structure in the plugin is such that they essentially are managed in a list like structure RPI[0] ...RPI[X]
I looked into doing that more dynamically, but that would required a more or less complete rewrite of the plugin structure.
Also the device states look like Distance_pi#, doing that dynamically would we another hurdle.
And I also do not want to increase the number of device states too much (16 *3 + 10 are enough), that's why I stopped at 16

So I decided to just increase the numbers, but that has the consequence that pi-sensor-only servers will need to be re-created.

If you don't use any pi-server# >9, no change for you.

Karl

Posted on
Thu Jan 30, 2020 9:57 am
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

Code: Select all
Added features / changes in v7.116.332 @ 2019-01-30
===================================================

1. ++++ STRUCTURAL CHANGE: ++++
   # of ibeacon pi-servers increased from (#0-#9) to (#0-#15) == 10 --> 16 pi-servers
   # of sensor pi-servers increased from (#10-#19) to (#16-#40) == 10 --> 25 pi servers
   As a consequence CURRRENT pi- servers #0-#9 should not experience any change.
   BUT current pi-servers #10-#15 will need to be re-created as pi-servers #16 .. #40 (pick any number) ie sensors-only  pi-servers
   Also all sensors and output devices need to point to the new pi-server numbers (device edit of sensors and outputs)
   you will see a lot of new indigo sql device tables crated and converted from number to real
   ++++ STRUCTURAL CHANGE: ++++

2. added support for i2c relay from 52pi for RG11 rain sensor.
   see device edit for details for relay# to dip-switch mapping   

3. removed option to foget ALL history, that removed all definitions for all BLE RPI and recreated them with new indigo ID

4. changed default for restart options in menus, apparently indigo does not like ","" in defaults 

5. fixed bug with menu command shutdown rpi

6. many smaller fixes and improvements in menus and controls

Karl

Posted on
Sun Feb 09, 2020 9:30 pm
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

Code: Select all
1. fixed pressure format for pascal units (%.0f instead of %d as value is float)
   fixed BLEconnect was disabled when switching to 16 RPI
   fixed pressure and humidity offsets, for some sensors (eg BME280) it was applied twice

2. improved dynamic behavior (fast changinging distance) for ultrasound distance sensor.

3. improved BME680 mamangement, added SensorStatus, AirQualityText

4. option to suppress writing certain high frequency dev/states and variables to SQL logger
   requires Indigo 7.4.1 or higher
   this can reduce the cpu load of the SQL logger by > 20%..30%
   variables: pi_IN_x and b_count and lastChanged
   states: Pi_xx_Time, TxPowerReceived,UUID,closestRPIText,displayStatus,status,batteryLevelLastUpdate,pktInfo,sensorvalue_ui,updateReason 
   these are mostly text fields that do not need to be kept in sql history
   you need to set and select in plugin config
   will reduce SQL data for device types: beacon, rpi, rpi-sensor, BLEconnect, sensors

5. changed mbar to mBar in config. You need to reselect the pressure unit in config

6. added Adafruit STEMMA Soil Moisture Sensor and Chirp soil sensor
   it is configured to give rel moisture 0-100%

7. changed message structure (pi --> indigo) from a list to a dict, for easier reading

8. added state "updateReason" for iBeacons to indicat why it was updated
   - timer = data once a minute (90+ % of times)
   - new beacon
   - fast down
   - fast down back
   - beacon is back
   - delta signal = if you enabled that parameter in beacon device edit

9. can now handle python3.x modules on RPI

Posted on
Wed Feb 12, 2020 9:20 am
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

Code: Select all
Added features / changes in v7.117.334 @ 2019-02-11
===================================================

1. added menu option to update beacon battery level for a SINGLE beacon, not just all

2. added clostestRPIlast and clostestRPIlast states to RPi, ibeacon and BLEconnect states. it show the previous clostest RPI
   this is not the second clostsest!!

3. added "nohup" to ssh master start, otehrwise master stops when ssh session ends

4. fixed clostest RPI in BLEconnect, was not alwasy showing correct RPI.

5. added requiremnt that two (RSSI values - lastAverage)  in sequence > delta signal to trigger deltat signal change.
   this remove some noise fluctuations of signals that otherwise would trigger delta_signal > xx state.
   
6. fixed:
   Error setting up BLEconnect Line 3636 has error=range() integer end a
   Error Line 12444 has error=Unknown format code 'd'
 
7. improved stability reading for adafruit moisture sensor
 


Added features / changes in v7.117.333 @ 2019-02-09
===================================================

1. fixed pressure format for pascal units (%.0f instead of %d as value is float)
   fixed BLEconnect was disabled when switching to 16 RPI
   fixed pressure and humidity offsets, for some sensors (eg BME280) it was applied twice

2. improved dynamic behavior (fast changinging distance) for ultrasound distance sensor.

3. improved BME680 mamangement, added SensorStatus, AirQualityText

4. option to suppress writing certain high frequency dev/states and variables to SQL logger
   requires Indigo 7.4.1 or higher
   this can reduce the cpu load of the SQL logger by > 20%..30%
   variables: pi_IN_x and b_count and lastChanged
   states: Pi_xx_Time, TxPowerReceived,UUID,closestRPIText,displayStatus,status,batteryLevelLastUpdate,pktInfo,sensorvalue_ui,updateReason 
   these are mostly text fields that do not need to be kept in sql history
   you need to set and select in plugin config
   will reduce SQL data for device types: beacon, rpi, rpi-sensor, BLEconnect, sensors

5. changed mbar to mBar in config. You need to reselect the pressure unit in config

6. added Adafruit STEMMA Soil Moisture Sensor and Chirp soil sensor
   it is configured to give rel moisture 0-100%

7. changed message structure (pi --> indigo) from a list to a dict, for easier reading

8. added state "updateReason" for iBeacons to indicat why it was updated
   - timer = data once a minute (90+ % of times)
   - new beacon
   - fast down
   - fast down back
   - beacon is back
   - delta signal = if you enabled that parameter in beacon device edit

9. can now handle python3.x modules on RPI


The last release did not make it to the plugin store, 7.117.333, was on GitHub
hopefully this one is there

Karl

Posted on
Tue Feb 25, 2020 8:16 pm
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

Code: Select all
Added features / changes in v7.118.338 @ 2020-02-17
===================================================

1. added option for several sensor types to have red/grey/green status column colors
   in devcice edit (for sensors only) you can set the condition when the icon should be red/grey/green
   eg green: 20<x<30, grey 30<=x<60, red x>=60, where x is the sensor value as shown in the status field

2. fixed action shutdown rpi through ssh command timing issue for some slower RPI network connections

3. now has 20 ibeacon RPi and 20 RPI sensor only RPI.
  you might need to restart the plugin twice to get all the new states loaded.

4. the ibeacon state Names are now Pi_xx_Signal .. _Distance  .._Time = 2 digits for all pi_xx states  ie Pi_1 --> Pi_01, to make it sort better.
   and there are now 20 ibeacon RPIs (0-19) and 20 non iBeacon RPI (for sensors only) 20-39

5. fixed issue with wrong ip number on RPI when switching between Wifi and ethernet


1. upgraded ADC converters, more parameters, models :
   0. apply offset and multiplier to value
   1. if Resistor measurement (one resistor to V+or gd, the measurement resistor to gnd or V+, eg light, thermistor ..)
      will calculate the proper value of the resistor
   2. if value [min,max] = (INPUT -Min)/Max-Min)
   3. if  log;  log(value)
   4. if  1/value;   value = 1/value
   5. apply offset2 and multiplier2
   6. format formula and add  unit
     any input number can be a simple formula eg 1./255

2. plugin now shows RPI power problems as:
   none
   #0 Under-voltage,
   #1 ARM freq capped,
   #2 Curr throttled,
   #3 Soft temp limit active,
   #16 Under-voltage occd since reboot,
   #17 Throttling occd since reboot,
   #18 ARM freq capped occd since reboot,
   #19 Soft temp limit occd

3. RPI will reboot if hciconfig shows DOWN for 2 tests in a row ~ 20 sec apart

4. a new program will be running on the RPI: master.sh
   It will test every 25 secs if master.py is running, if not it will restart it
   This is mostly for development as starting master.py from the console and logging out
   will kill it after some seconds  .. the parent process stops and then the childprocess also.

5. fixed reboot action, only reboot menue was working

6. cleanup some code in beaconloop and BLEconnect

7. fixed master.sh bug that caused constant restarts of master.py (from V .334)



1. upgraded ADC converters, more paraemteers, models :
   1. Resistor mesasurement (one resistor to V+, the mreasurment resistor to gnd, eg light, thermistor ..)
   2. value [min,max] = (INPUT -Min)/Max-Min)
   3. lin: (value + offset)* multiplier;  log;  log(value * offset) *multiplier
   4. format formula and unit
   any input number can be a simple formula eg 1./255

2. added option for BLEconnect to work thorugh commandline tools (hcitool) instead of python code.
  it seems that running BLEconnect together with wifi on the internal chips can create timeout > 1 sec.
   ie for a pi0-W use an extermnal BLE-dongle and send BOTH iBeacon AND BLEconnect to the external BLE dongle, pings are const at ~ 5msec.


===> added option to setup wifi through file on RPI SSD boot directory.
This is the directory visible when you mount the SSD on a mac, in filer you can see a directory ( it should also contain the file config.txt )
add a file: wifiInfo.json with the exact format (do NOT use textedit!! it produces curly ") :
{"SSID":"abc", "passCode":"def"}
The file name as well as keys and data are case sensitive.

Or supply the wpa_supplicant.conf file in that directory. It will be copied to /etc/wpa_supplicant/wpa_supplicant.conf as is

A new SSD image is available (feb 2020)  for down loading in first post in this thread. If you create a new SSD use that one


Karl

Posted on
Sun Mar 15, 2020 1:37 pm
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

Added features / changes in v7.118.339 @ 2020-03-15
===================================================

1. fixed problem on RPI, stack did not restart after boot (a" instead of a ;")

Karl

Posted on
Sun Apr 05, 2020 2:37 pm
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

Added features / changes in v7.118.346 @ 2020-04-05
===================================================

1. fixed timezone setting
2. added check for install NTP (apt-get install ntp)
3. suppress msg for stopBLE file not fouund
4. changed logging on RPI, date format and logfile now /var/log/pibeacon (no .log)

Posted on
Sat Apr 18, 2020 11:19 am
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

Added features / changes in v7.118.348 @ 2020-04-18
===================================================

1. added light sensor MAX44009
This is a very simple fully autoscale light sensor
range 0.045 .. 188,000 Lux
has 2 i2c address configurable

3. added state: clostestiBeaconLast
it inherits from clostestiBeacon when that changes

3. fixed:
- devices edit for CAR devices, did not list choices for members. My fault, created 3 V ago
- some typos and menue changes


Karl

Posted on
Sat May 23, 2020 9:59 am
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

Added features / changes in v7.119.357 @ 2020-04-21
===================================================

1. added 3 differnt font sizes for position plot
2. added option to randomize beacon+BLE positions by 0/10/20/30/40%
3. added timestamp to position plot, set in config
4. added delay in master start from getbattery level to ensure that message was send to plugin
5. added RuuviTag sensors
they are iBeacons, T,H,P Mag field and movement sensors
no setup of the device is needed
battery life is > 1 Year, but they are larger than regular iBeacon devices
6. added time delay in get battery program as rpi4 is too fast in restarting master.py

Posted on
Sun May 31, 2020 12:01 pm
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

v 7.120.361

enabled beacon beep command for specific beacons

This version allows to send "beep' commands to some of the beacons (nonda iHere and nonda aiko)
You can make them beep through a menu command or an action.

First you need to edit the beacon device and enable beep


MANY THANKS GO TO ADAM FURMAN. He came up with the proper gatttool commands to make them beep.
all the data is stored in an internal dict.
you can add or overwrite the settings by creating a file
/Library/Application Support/Perceptive Automation/Indigo 7.4/Preferences/Plugins/com.karlwachs.piBeacon/knownBeaconTags.supplicant
use the example file knownBeaconTags for the format.

In addition some clean up and better management of UUIDs (now done directly on the RPI) was added.

Karl
ps
you also might need to re-enable get battery level in beacon device edit.
there is no complicated selection, just on/off like radon, battery bits .. - just one other option for ruuvi beacons (=message)

Posted on
Mon Jun 08, 2020 8:24 pm
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: 3- presence monitoring download

posted v .121.396

besides several minor changes
1. fix of battery function
2. added various improvements in beacon plot positions
3. significant improvement in stability of beacon positions
4. added ability to auto detect beacon types and add them as indigo devices.
- in config select instead of adding new beacons signal > xx choose add beacons of type... if you want to add an Nonda_Aiko, pick that one
- the beacons of type supported are listed here : https://forums.indigodomo.com/viewtopic.php?f=187&t=15360&start=105
The new beacon(s) are/will will be automatically detected and added
if you have one of the listed beacons you don't have to put beacons on an RPI notes signal and move them away note signal and back to the RPI to check which of the many new beacons is the one you want.

If you have existing beacons eg Aiko xy ..you must edit the indigo beacon device and set the type of beacon field to the proper type. The type of beacon property had to be cleaned up to make them consistent.

This was 2 weeks of testing and coding and testing..
Learned a lot about gatttool and OS X bluetooth tracking, actually pretty cool

Although a lot of testing was done, there are probably some little bugs left

And again thanks to Adam for his support and suggestions

Karl

Posted on
Thu Jun 11, 2020 10:31 am
kw123 offline
User avatar
Posts: 7141
Joined: May 12, 2013
Location: Dallas, TX

piBeacon: 3- presence monitoring download

posted v7.121.399

polished version:
- Auto detect of certain beacon types, see https://forums.indigodomo.com/viewtopic.php?f=187&t=15360
- Several beacon types can now be "beeped" and battery level be read by the plugin - only if the app on the phone is not on. A beacon can only be attached to one device at a time either the phone or an rpi.
You can create an action to beep a beacon.
- option to run "bluetoothctl scan on" instead of LESCAN on the rpi, is more stable and reliable, will produce similar output in the plugin.log file
- some smaller typo correction
- due to request from a low lying country: The description/ notes field, is now writeable, anything you like. The UUIDtag -Maj-Min is now shown in the firmware field (also in state:"UUID")

Karl

Who is online

Users browsing this forum: No registered users and 0 guests