piBeacon: 3- presence monitoring download

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

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

released 7.94.242

- added option to track cpu usage of methods and functions This is beneficial in case plugin hangs (ie menu/ config does not open)
- used this to optimize the code (~ 20% faster)
- fixed some spelling and improved menus


Karl

ps from now on all MY updated plugins will required Indigo 7.x.. it gets to difficult to maintain work arounds for options that do not work under 6.x
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

release v 7.94.250

moved RPI updates into parallel threads.

This accelerates the updates from ~ 40 secs to ~ 3 secs for 20 RPI.
And if there is an RPI that is offline, it will not stop updating the other RPI.
For the user it has the advantage that the regular main plugin thread is not blocked by waiting for RPI to answer and opening menus etc will not time-out in these situations.
Waiting for an answer of a disconnected RPI could be up to 15 secs. During that time the main plugin thread was waiting... not anymore.

Also fixed some smaller bugs

Karl

this was a major piece of work .. learned a lot eg

Code: Select all

threading.Thread(name=u'nameofmethod', target=self.xxx, args=(piU,))
requires a "," in args=(piU,)) after the argument. If not present it does not work for some arguments (eg piU > 9)
strange, but that took me 1/2 day to figure out .. .. it is repeatable !! remove the "," and the thread does not start when piU > "9", with the "," it works
Asconasny
Posts: 161
Joined: Fri Jan 16, 2015 5:05 am

Re: piBeacon: 3- presence monitoring download

Post by Asconasny »

just updated to latest

this is flooding my in my event log

Code: Select all

   sshToRPI in Line '13443' has error=''Popen' object does not support indexing'
any clue what its complaining about?
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

Added features / changes in v7.97.252 @ 2018-12-06:

Code: Select all

===================================================
1. option to set sleep/wait time after boot (in RPI device edit), before master.py starts.   
	This is useful for #2 and can be tuned to accommodate to let eg wifi connect before master.py is started  
	rc.local calls /home/pi/callbeacon.py, it then waits xx secs before it calls /home/pi/pibeacon/master.py  

2. option to set 2 GPIO  (input or output) to any value (in/out, low, high, floating .,..) BEFORE master.py immetiately after rc.local is finished (set in RPI device edit)  
	this is useful to set a GPIO as fast as possible after boot before all networks, vars, etc are finished.. saves ~ 15 secs  
	done in /home/pi/pibeacon/doGPIOatStartup.py called by /home/pi/callbeacon.py  ..called by rc.local after boot  
	doGPIOatStartup is setup by master with the options set in RPI device edit  

3. added state "actualGpioValue" to OUTPUT-GPIO on/off devices.  
	This will set the actual value of the GPIO on the RPI, msg send from rpi to the plugin.   
	It will be refreshed after GPIO is set from plugin and checked every 90 secs or if changed   
	useful if your GPIUO is set by other means or after a reboot the GPIOs might not be set properly  

4. added RPI device state "closest iBeacon". it will show eg [email protected] = name@distance.
	you can set cutoff distance (ignore if distance > xx) in PRI device edit
	you can set ignore THIS iBeacon for this feature in iBeacon device edit.
	how to use it in an action (python code), trigger on any change of dev/state["closestiBeacon"]
		yyyy = indigo.devices["name of your rpi"].states
		xxx = yyyy["closestiBeacon"]
		if xxx.find("@")>-1:  
			nameOfBeacon = xxx.split("@")[0]
			distToRPI    = float(xxx.split("@")[1])
			indigo.server.log(" closest beacon to RPi is "+nameOfBeacon+" at distance of "+str(distToRPI))
			# do something with dist
			if distToRPI < 3: 
				indigo.server.log("beacon is very close" )
		else:
			indigo.server.log("no iBeacon is close" )
   
5. added option in menu to restart master.py in case it hangs ... 

x. will deprecate devices OUTPUT-GPIO-4,8,12,16,.. should all be changed to device type OUTPUT-GPIO-1-on-off
	it is to complicated to manage all the states and which one to use for status and is more in line with std Indigo philosophy 
Karl
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

Code: Select all

Added features / changes in v7.98.255 @ 2018-12-09:  
===================================================

1. added option in RPI device edit to select which BLE channel should be used for iBeacon / BLEconnect.
	RPI3+ with SSD >=2018-11 does not work properly with the internal chip, 
	Must add an external USB dongle for iBeacon. BLE connect works fine w internal BLE chip.

2. added option to DELETE RPI in "initial setup of RPI" in the plugin menu, besides "ON/off".
	this is useful if you interchange RPi or want to get rid of any RPI config for a specific RPI. 
	
3. A RPI device will now be created when setting up a new RPi in "initial setup of RPI".
	the plugin does not wait for the first iBeacon message to create the RPI.
	The RPi will be initiated with MAC# 00:00:00:00:00:00. When the first iBeacon message arrives from the RPI that MAC number is overwritten 
	This is needed in order to be able to set the BLE device that should be used for iBeacon (for RPI3plus you need to set the BLE for iBeacon to USB)
	When the proper BLE device is not selected no iBeacon message are send from the RPI

4. added a log message when ftp to RPI is successfully finished (when Update RPI debug is on). Before only the start was put into the log file

5. increased some timers on the RPI python files to make sure that if something goes wrong and its in "panic" mode  it is not constantly rebooting, but wait 30+ secs between reboots.
	(I had that problem.)

These changes should now enable the usage of "SSD stretch image 2018-11" ... BUT the RPI3plus will need an extra BLE dongle to work. 
With "SSD stretch image 2018-04" RPI3plus works fine.
Karl
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

Code: Select all

Added features / changes in v7.98.258 @ 2018-12-14:  
===================================================

1. bug fix for RPI beaconloop.py program - only a problem when BLE program was not working properly ie in restart: 
	return argument was mixed up, was introduced in 7.98.255 

2. added check for MAC mac number returned from RPI in plugin- in case of empty messages ... 

3. added RPI devices states: last_boot, rpi_type, op_sys to give you a quick view of the state and config of your RPIs.
	Useful if you have many RPi

4. Improved devices edit menus for RPi and iBeacon sensors

5. fixed reboot ssh command, was not always working 
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

Code: Select all

Added features / changes in v7.98.260 @ 2018-12-18:  
===================================================

1. bug fix for RPI beaconloop.py program - only a problem when BLE program was not working properly ie in restart: 
	return argument was mixed up, was introduced in 7.98.255 

2. added check for MAC mac number returned from RPI in plugin- in case of empty messages ... 

3. added RPI devices states: last_boot, last_masterStart, rpi_type, op_sys to give you a quick view of the state and config of your RPIs.
	Useful if you have many RPi to give you a quick overview of system configs etc.

4. Improved devices edit menus for RPi and iBeacon sensors

5. fixed reboot ssh command, was not always working 

6. added decoding of eg ";"  characters when send data from RPI to plugin through http to indigo variables

7. changed tag for expect ssh to "Last Login" from ":~". It is much less depended on op-sys, naming of rpi etc.
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

Code: Select all

Added features / changes in v7.99.261 @ 2018-12-29:  
===================================================

1. added support for sensors:
	- adafruit max31865 platinum 100/1000 temp sensor
	- adafruit  tmp007 remote temperature sensor,  successor to temp006


2. added back dev state closestRPItext for iBeacons:
	this dev state now shows the NAME of the closest RPI, not just PI_x
	also added option in config to set closestRPItext to blank when iBeacon leaves or keep the last RPI name

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

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

Code: Select all

Added features / changes in v7.99.263 @ 2019-01-06:  
===================================================

1. added support for wlan1 in addition to wlan0. in case you have 2 wifi adapters. BUT ONLY one can be active

2. moved all pibeacon files from ~/indigo/pibeacon to  /Library/Application Support/Perceptive Automation/Indigo 7.2/Preferences/Plugins/com.karlwachs.piBeacon/

3. all detailed logging now goes to /Library/Application Support/Perceptive Automation/Indigo 7.2/Logs/com.karlwachs.piBeacon/plugin.log. all error messages still go to teh standard indigo logfile

4. fixed bug line 4649 in buttonAnycommandCALLBACK bad operand... . only occures when sending custom command to rpi and logging was switched on

5. suppressed some RPi updating messages
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

Code: Select all

Added features / changes in v7.99.265 @ 2019-01-07:  
===================================================

 fixed: 1. wlan0 not working, logging not working


===> introduced in v .263


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

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

Code: Select all

Added features / changes in v7.100.268 @ 2019-01-21:  
===================================================

1. fixed:  BLE connect up/down/up when iphone is off.

2. fixed:  some logging inconsistencies, typos... 

3. added support for various STEPPER MOTORS
You can chose between 5 pole unipolar and 2 coils bipolar stepper motors.  
These motors must be driven by chips:    
ULN2003 is a simple set of darlington transitors, current up to 250mA. It is used for the 5 pole unipolar motor   
L9110 low power and L298N high power: can be used to drive bipolar 2 coil motors in full and half step modes  
A4988 (8V-35V) and DRV8834(2.5V-8V) are more sophisticated.   
-They are almost 100% pin compatible
-Can drive bipolar 2 coil motors in 1,1/2,1/4,1/8,1/16 (and 1/32) step size you need to configure the pins on the chips to set the step size
-Can configure enable / sleep / reset and fault pins. They are currently only used to switch the motor ON at start,
      but you could also simply hardwire the pins at the chip directly. You should be able to use multiple motors on the same RPI, just limited by the number of GPIOs available
Use an indigo ACTION  "Send commands to stepper motor .." to drive the motor; #of steps, direction, delays ... can be send in single or multiple sets
You can use up to 3 GPIO input pins to control the range of the motor:  
   If one of thes GPIO goes High/low the motor will stop. This can be enabled / configured in each action separately. 
   In device edit you define the GPIO pin numbers and refer to them in actions as GPIO#0 / 1 / 2

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

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

fixed the name of the SSD download file is now : 2018-11-09 (was 2018-12-09- my typo)

this is just a name change of the file to make it consistent with the created unzip file (11-09)..
no content changed

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

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

Code: Select all

Added features / changes in v7.101.270 @ 2019-02-04:
===================================================

1. added lookup of mac to vendor name for ibeacons, added state "vendorName"

2. some smaller debugs

3. added check if userid / password not set: will write message and wait before doing anything

4. converted to std logging

5. added sensor type:
INPUT-Rotatary-switch-Grey-Pulses : supports turn switches that send grey encoded pulse left and right direction
INPUT-Rotatary-switch-encoded: supports turn switches that have static codes at n Pins that deliver 4.8.16... states from binary pins values

6. did a lot of testing and added little fixes when creating / deleting RPIs
1. fixed binary rotary types:
Screen Shot 2019-02-04 at 16.29.43.png
Screen Shot 2019-02-04 at 16.29.43.png (185.89 KiB) Viewed 4739 times
Indigo states:
Screen Shot 2019-02-04 at 16.36.55.png
Screen Shot 2019-02-04 at 16.36.55.png (4.75 KiB) Viewed 4739 times
2. pulse generating rotary switches
Screen Shot 2019-02-04 at 16.30.30.png
Screen Shot 2019-02-04 at 16.30.30.png (123.91 KiB) Viewed 4739 times
Indigo states:
Screen Shot 2019-02-04 at 16.36.19.png
Screen Shot 2019-02-04 at 16.36.19.png (3.14 KiB) Viewed 4739 times
DO NOT connect V+ to +5V. These switches no not have any electronics on board, just a 10K resistor V+ to signal pins. either remove the resistor or connect V+ to 3.3V
For hardware debouncing see: http://raspberrypihobbyist.blogspot.com ... input.html

The text in status field can be freely set in device edit, and you can multiply the number with anything you like.

The indigo device edit gives some advice on how to connect.

you can have several of these devices in parallel with different GPIOs at the same RPI -- tested with2.


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

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

Code: Select all

Added features / changes in v7.103.272 @ 2019-02-10:  
===================================================

1. finalized rotaty encoded switch devices
	A absolute position
		read encoded n pin rotaty switch, send integer value to indogo every 90 secs or if changed
		grey code = only 1 bit changes pre step
		    eg http://www.grayhill.com/assets/1/7/mech_encoder_26.pdf
		regular binary; normal binary code 
		   like also: https://www.amazon.com/gp/product/B071F4QM6L/ref=ppx_yo_dt_b_asin_title_o06__o00_s00?ie=UTF8&th=1
		Bourns table encoded: 
			special bourns devices that comes with an 8 bit 0-127 value encoding
			    https://www.bourns.com/pdfs/ace.pdf
			    pins 1,2,G,3,4   8,7,G,6,5 
				0-127 positions

		Bourns serial device that is read like SPI, but just very simple code
			    CLK, CS, DO= read data. it is 10 bits + some status bits
			    pins: Di,CLK, GND, Do, V+, CS, connect CLK,GND,DO,V+,CS; CS can be set HIGH permanently , use V=3.3V not 5V
			    https://www.bourns.com/pdfs/EMS22A.pdf
				0-1023 positions


	B continuous increment / decrement 
		"2-bit quadrature code" using 2 GPIO pins and GND and V+
		2 gpios are read. they go 1 0 1 0 .. most have 0=ON and 1 = off
		B: 011001100110
		A: 001100110011
		and opposit direction:
		B: 001100110011
		A: 011001100110 
		one full step is 4 bits

2. BUG fix for DHT temp sensor
	screw up in one of the last versions when I switch from 2 different DHT to one type

3. Made version check future proof

4.  changed logging for errors or init of dataStats file
in device edit:with UNIT=[º] and multiply = 0.035
Screen Shot 2019-02-10 at 21.10.50.png
Screen Shot 2019-02-10 at 21.10.50.png (4.62 KiB) Viewed 4695 times
example for rotate switches:

1. absolute:
Bourns 1024 potions
Screen Shot 2019-02-10 at 21.11.11.png
Screen Shot 2019-02-10 at 21.11.11.png (40.48 KiB) Viewed 4695 times
Grey encoded 16 pos:
Screen Shot 2019-02-10 at 21.11.20.png
Screen Shot 2019-02-10 at 21.11.20.png (23.42 KiB) Viewed 4695 times
2. continuous 100 steps/ 360:
Screen Shot 2019-02-10 at 21.11.32.png
Screen Shot 2019-02-10 at 21.11.32.png (192.74 KiB) Viewed 4695 times
User avatar
kw123
Posts: 8705
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: piBeacon: 3- presence monitoring download

Post by kw123 »

released v 7.103.276

added option for SPRINKLER relay to be on if GPIO is 0 or 1
set in device edit.

some typos in menus

various small changes to clean up code

Karl
Post Reply

Return to “piBeacon”