piBeacon: 6- tips and tricks
piBeacon: 6- tips and tricks
change the display state column value:
The indigo state values of the GPIO input pins are
1 = GPIO input connected to ground
0 = GPIO open or high
if you want to inverse this for the display state value: set offset to -1 and multiplier to -1 in device INPUT edit that will do
0 = GPIO input connected to ground
1 = GPIO open or high
but only for the display state column not for the other states.
The indigo state values of the GPIO input pins are
1 = GPIO input connected to ground
0 = GPIO open or high
if you want to inverse this for the display state value: set offset to -1 and multiplier to -1 in device INPUT edit that will do
0 = GPIO input connected to ground
1 = GPIO open or high
but only for the display state column not for the other states.
Re: piBeacon: tips and tricks
if your wifi boot takes to long do this: change line to save with CTRL-o <return> CTRL-x<return>
and reboot
Code: Select all
ssh [email protected]
sudo nano /etc/dhcp/dhclient.conf
Code: Select all
#timeout 60;Code: Select all
timeout 15;and reboot
piBeacon: 6- tips and tricks
Hi Karl,
My installation of piBeacon has been serving us very well, Thank you.
There are no issues to correct. I want to perform a yearly maintenance update of the rPi.
So, I have some questions.
Sean
My installation of piBeacon has been serving us very well, Thank you.
There are no issues to correct. I want to perform a yearly maintenance update of the rPi.
So, I have some questions.
- Do you think that periodic maintenance updates are a good idea in this case? Or, if it is working it should be left alone?
- Should the OS be updated also?
- I can execute console commands remotely via SSH. Should this be the method I use to update the rPi? Or would you create new SSD cards from scratch?
- What is the quickest way to check if my version of PiBeacon server needs updating?
- If SSH to console is best, what commands would I use to update the PiBeacon server software on the rPi?
Sean
Last edited by CraftGeek on Sat Nov 26, 2016 7:23 pm, edited 1 time in total.
Sean
Re: piBeacon: 6- tips and tricks
first of all: YES use SSH.
to upgrade manually:
ssh into api
that does upgrades to existing installed programs ( cd pibeacon; sudo python installLibs.py force & does that for you on the RPI)
But I suggest to use the manual way. you might see an error message
if you want to get the latest RPI OPSYS image with ALL programs apps etc you need to do:
(no -y in 2. line). but many of them are not needed AND THIS WILL TAKE SOME HOURS !!
I do not suggest to download a fresh copy from raspberry as there are many libs needed by pibeacon you would need to be install manually.
The latest posted SSD (November2016 ) in downloads has all the new RPi version and configs libs .. installed. (it took me a day to create that one with all downloads, sizing, imaging redoing things ....)
I have ~15 RPI. Some of them are still on the original SSD (feb this year) and some have the latest. All of them work.
Whenever I have an issue on an RPI, I pop in the latest SSD . But then I need to set the network config on a monitor when I use WiFi on the RPI.
anyway if it works don't break it .. but the new pibeacon has some really nice features with groups and significant reduced CPU on the indigo server when you use i7
so if you like to tinker . download the new SSD from the pibeacon download, configure network, . that should be it.
you could also just use the new pibeacon plugin
hope that answers your questions..
Karl
to upgrade manually:
ssh into api
Code: Select all
sudo apt-get -y update &
sudo apt-get -y upgrade &
But I suggest to use the manual way. you might see an error message
if you want to get the latest RPI OPSYS image with ALL programs apps etc you need to do:
Code: Select all
sudo apt-get -y update &
sudo apt-get dist-upgrade &
I do not suggest to download a fresh copy from raspberry as there are many libs needed by pibeacon you would need to be install manually.
The latest posted SSD (November2016 ) in downloads has all the new RPi version and configs libs .. installed. (it took me a day to create that one with all downloads, sizing, imaging redoing things ....)
I have ~15 RPI. Some of them are still on the original SSD (feb this year) and some have the latest. All of them work.
Whenever I have an issue on an RPI, I pop in the latest SSD . But then I need to set the network config on a monitor when I use WiFi on the RPI.
anyway if it works don't break it .. but the new pibeacon has some really nice features with groups and significant reduced CPU on the indigo server when you use i7
so if you like to tinker . download the new SSD from the pibeacon download, configure network, . that should be it.
you could also just use the new pibeacon plugin
hope that answers your questions..
Karl
Re: piBeacon: 6- tips and tricks
Perfect.
I added and now I have my quarterly maintenance routine.
Thank you!
I added
Code: Select all
sudo shutdown now -rThank you!
Sean
Re: piBeacon: 6- tips and tricks
and please when you use the latest plugin enable RAM disk usage in RPI device edit. this will reduce the write to the SSD significantly.
Re: piBeacon: 6- tips and tricks
reducing syslog logging on the RPI:
the following are easy to do and can reduce system loging by 90% on the RPI
disable avahi client = apple file sharing
Dec 31 18:04:01 raspberrypi avahi-daemon[385]: Withdrawing address record for fe80::eab9:d86e
bf9b on wlan0.
Dec 31 18:04:01 raspberrypi avahi-daemon[385]: Withdrawing address record for 192.168.1.38 on wlan0.
Dec 31 18:04:01 raspberrypi avahi-daemon[385]: Withdrawing workstation service for wlan0.
Dec 31 18:04:01 raspberrypi avahi-daemon[385]: Withdrawing workstation service for lo.
do:
remove entries like these:
Dec 31 18:57:28 raspberrypi rsyslogd-2007: action 'action 17' suspended, next retry is Fri Dec 31 18:58:58 1999 [try http://www.rsyslog.com/e/2007 ]
do:
to remove:
Jul 27 10:59:07 raspberrypi vncserver-x11[565]: AgentInitCheck: agent comms failure
Jul 27 10:59:12 raspberrypi vncserver-x11[565]: AgentInitCheck: no response from agent
to remove:
w1_master_driver w1_bus_master1: Family 0 for 00.700000000000.f8 is not registered.
do
if you do not use 1wire temp disable 1wire in
All of that together has reduced /var/log/syslog entries by 90% on my RPIs.. then you only see there real stuff
Karl
the following are easy to do and can reduce system loging by 90% on the RPI
disable avahi client = apple file sharing
Dec 31 18:04:01 raspberrypi avahi-daemon[385]: Withdrawing address record for fe80::eab9:d86e
Dec 31 18:04:01 raspberrypi avahi-daemon[385]: Withdrawing address record for 192.168.1.38 on wlan0.
Dec 31 18:04:01 raspberrypi avahi-daemon[385]: Withdrawing workstation service for wlan0.
Dec 31 18:04:01 raspberrypi avahi-daemon[385]: Withdrawing workstation service for lo.
do:
Code: Select all
sudo systemctl disable avahi-daemonDec 31 18:57:28 raspberrypi rsyslogd-2007: action 'action 17' suspended, next retry is Fri Dec 31 18:58:58 1999 [try http://www.rsyslog.com/e/2007 ]
do:
Code: Select all
sudo nano /etc/rsyslog.conf
and comment last 4 lines:
#daemon.*;mail.*;\
# news.err;\
# *.=debug;*.=info;\
# *.=notice;*.=warn |/dev/xconsole
ctrl-o to save
ctrl-x to exit
Jul 27 10:59:07 raspberrypi vncserver-x11[565]: AgentInitCheck: agent comms failure
Jul 27 10:59:12 raspberrypi vncserver-x11[565]: AgentInitCheck: no response from agent
Code: Select all
sudo raspi-config / interfaces
disable vnc w1_master_driver w1_bus_master1: Family 0 for 00.700000000000.f8 is not registered.
do
if you do not use 1wire temp disable 1wire in
Code: Select all
sudo raspi-config / interfaces /
disable one wire
Karl
Re: piBeacon: 6- tips and tricks
HOW to replace an RPI
==============
0. power down..
1. take SD out from the old put into new
2. boot up new
3. find new ip number of the new api (unifi, fingscan, your router)
4. ssh pi@newip (old password should still be fine
5. sudo ifconfig eth0 --oldIP-- netmask 255.255.255.0 ## set old IP number if you want that or change the ip number to the new one in menu basic initial setup
may be also in your router: set this IP-MAC number to the old IP number
==============
that worked for me, about 5 minutes total
Karl
==============
0. power down..
1. take SD out from the old put into new
2. boot up new
3. find new ip number of the new api (unifi, fingscan, your router)
4. ssh pi@newip (old password should still be fine
5. sudo ifconfig eth0 --oldIP-- netmask 255.255.255.0 ## set old IP number if you want that or change the ip number to the new one in menu basic initial setup
may be also in your router: set this IP-MAC number to the old IP number
==============
that worked for me, about 5 minutes total
Karl
Re: piBeacon: 6- tips and tricks
issue: when RPI shuts down, it does not restart on its own when power is not interrupted.. need to connect reset pin to ground to do that.
The attached drawing should do that automatically.
If you have an RPI UPS HAT for the RPI: here a way to reset the RPI when +5V comes back online.
setup:
1. when +5V raw goes down, RPI starts counter (connect +5V raw to GPI-IN through resistor divider), When > 1 hour time w/o raw power, do auto shutdown.
2. when +5 raw comes back: T2 gets triggered (through R 10k+C100nF ) and the RPi resets = starts
when RPI is running a GPIO output pin is set high and disables T2 through T1. This disables shutdowns eg when you have a short power interruption.
Karl
The attached drawing should do that automatically.
If you have an RPI UPS HAT for the RPI: here a way to reset the RPI when +5V comes back online.
setup:
1. when +5V raw goes down, RPI starts counter (connect +5V raw to GPI-IN through resistor divider), When > 1 hour time w/o raw power, do auto shutdown.
2. when +5 raw comes back: T2 gets triggered (through R 10k+C100nF ) and the RPi resets = starts
when RPI is running a GPIO output pin is set high and disables T2 through T1. This disables shutdowns eg when you have a short power interruption.
Karl
- Attachments
-
- Screen Shot 2018-11-13 at 22.14.17.png (66.42 KiB) Viewed 9149 times
Re: piBeacon: 6- tips and tricks
==== with RPI UPS HAT and this little piece of electronics you have ==== ====
- backup power of several hours
- soft / controlled shut shutdown before battery runs out
- restart when +5V per is back
==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ====
this actually works!!
with the RPI UPS HAT you can have a battery back that can keep the RPI running for xx minutes = keepRunning(*) (set in rpi device edit) (3.7Ah = 12 hours for an rpiZero W)
after keep running is expired and +5V raw is not back the rpi will do a soft shutdown.
T2 will pull the "reset/RUN" pin down for some millisecs when +5Vraw is back and start the RPI
While RPI is running T1 will short the basis of T2 so that any change of V+5 raw does NOT trigger a reset / run.
Normally when the RPI (like the MAC) was shutdown in a regular way and power is still present (battery is still a charged) while shutting down it can only be restarted through a power cycle or a reset/run short to ground
To setup: in RPI device edit define
= shutdown input pin
= shutdown output pin
= keepRunning time
I was thinking about this for some years.. it finally works.
Will be working out the kinks(***), but this is very promising.. It will keep the SSD cards alive (damage due to wild power shutdowns) And will cover power failures ...
Karl
(*)how long does shut down input pin have to be active (= 0 Volt on R 3.3k) == keepRunning time
(***) things like : if power comes back for a short period of time and goes on/off while battery is not yet charged ie can not run for eg 5 hours
- backup power of several hours
- soft / controlled shut shutdown before battery runs out
- restart when +5V per is back
==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ==== ====
this actually works!!
with the RPI UPS HAT you can have a battery back that can keep the RPI running for xx minutes = keepRunning(*) (set in rpi device edit) (3.7Ah = 12 hours for an rpiZero W)
after keep running is expired and +5V raw is not back the rpi will do a soft shutdown.
T2 will pull the "reset/RUN" pin down for some millisecs when +5Vraw is back and start the RPI
While RPI is running T1 will short the basis of T2 so that any change of V+5 raw does NOT trigger a reset / run.
Normally when the RPI (like the MAC) was shutdown in a regular way and power is still present (battery is still a charged) while shutting down it can only be restarted through a power cycle or a reset/run short to ground
To setup: in RPI device edit define
= shutdown input pin
= shutdown output pin
= keepRunning time
I was thinking about this for some years.. it finally works.
Will be working out the kinks(***), but this is very promising.. It will keep the SSD cards alive (damage due to wild power shutdowns) And will cover power failures ...
Karl
(*)how long does shut down input pin have to be active (= 0 Volt on R 3.3k) == keepRunning time
(***) things like : if power comes back for a short period of time and goes on/off while battery is not yet charged ie can not run for eg 5 hours
- Attachments
-
- Screen Shot 2018-11-13 at 22.02.06.png (35.33 KiB) Viewed 9155 times
Re: piBeacon: 6- tips and tricks
If you have your RPI in a place where it is difficult to get to the SD, and you need to swap the SD more than once here an extender that seems to work fine. They have a 10cm option (shortest)
At amazon for $7:
>>OUSHE 10cm TF/Micro SD to Micro SD Extension Cable Flexible 4 8 16 32GB TF Memory Card Reader Adapter Zip Extender Cord for MacBook/Kindle/Raspberry Pi/Camera/Arduino/3D Printer/Monitoring System/TV<<
Karl
At amazon for $7:
>>OUSHE 10cm TF/Micro SD to Micro SD Extension Cable Flexible 4 8 16 32GB TF Memory Card Reader Adapter Zip Extender Cord for MacBook/Kindle/Raspberry Pi/Camera/Arduino/3D Printer/Monitoring System/TV<<
Karl
- Attachments
-
- Screen Shot 2019-06-14 at 11.54.03.png (150.38 KiB) Viewed 7640 times
Re: piBeacon: 6- tips and tricks
if you have many RPi (or beacons) and want to know if any / which is offline you can use this script:
or for beacons:
or for BLEconnect:
Code: Select all
# show which rpi is offline
# create trigger on variable changed (eg b_PI_nHome) , add condition value < number of rpi you have
for dev in indigo.devices.iter(u"props.isRPIDevice"):
if dev.states["status"] != u"up":
indigo.server.log(u"rpi is not up: {:25s} last message received:{}".format(dev.name, dev.states["last_MessageFromRpi"]))
Code: Select all
# show which family beacon went down
# 1. add beacons to one group eg family (in device edit)
# 2. create trigger on variable changed (eg beacons_family_home) , add condition value < number of beacons in your family you have
for dev in indigo.devices.iter(u"props.isBeaconDevice"):
if dev.states["status"] != u"up":
if dev.states["groupMember"].find(u"Family") >-1:
indigo.server.log(u"Family beacon is not home: {:30s} last message received:{}".format(dev.name, dev.lastChanged))Code: Select all
# show which BLEconnect phone went down
# 2. create trigger on variable changed b_BLEconnect_nHome , add condition value < number of beacons in your family you have
for dev in indigo.devices.iter(u"props.isBLEconnectDevice"):
if dev.states["status"] != u"up":
indigo.server.log(u"beacon is not home: {:30s} last message received:{}".format(dev.name, dev.lastChanged))