piBeacon: presence monitoring plugin discussions

Posted on
Mon Dec 04, 2017 10:13 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

doing :
Code: Select all
sudo timeout -s SIGINT 5s hcitool cc 11:22:33:44:55:66; hcitool rssi 11:22:33:44:55:66; hcitool tpl 11:22:33:44:55:66
==>
Can't create connection: Connection timed out
Read RSSI failed: Input/output error
HCI read transmit power level request failed: Input/output error

will slow down Wifi: e.g. doing a ifconfig will wait until the hcitool is finished, it looks as if ifconfig is hanging, but it is actually the ssh communication terminal that is not sending / receiving

You can try this yourself: open 2 ssh session to the RPI, in one window do the hcitool command in the other do e.g. ifconfig
On an RPI with ethernet connection there is no impact .

will need to think about how to address this, (e.g. when hcitool is active delay sending or visa versa..)

Karl

Posted on
Mon Dec 04, 2017 11:37 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

I believe there is little hope to fix this from a software point of view, played around with waits ..

1. the hcitool can have a long timeout (..10 seconds) during this time Wifi will not work.
2. we could add a wait for wifi until hcitool is over, but that would not address e.g. sending configs from indigo to the RPI, that would still hang.
3. adding a wait to the hcitool until wifi is finished does not add a lot of value, as the sending of data to indigo takes < 0.5 secs and then hcitool would block again wifi

Only solution I see for RPI3 + WiFi is to add a BLE dongle and use that one for BLEconnect. That would require a rewrite of some section to manage 2 BLE stacks ..

I guess if there is NOT a lot of demand:
1. if you have to use Wifi: use an RPI2 (that has 2 separate dongles one for Wifi and one for BLE)
2. with RPI3 use ethernet if you need BLEconnect


if you have suggestions.. advice .. let me know.


Karl

Posted on
Mon Dec 04, 2017 1:06 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

tested the same scenario on an RPI2 with wifi and BLE dongle and everything seems to work for BLEconnect..

does not hang the RPI, and the status for the iPhone goes up,... but still not very reliable BLE info for the iPhone


if you want to continue to use the RPI3 w WiFi use BLE timeout =0.5 seconds in device edit. that will put the least burden on the RPI-WiFi and should work ok


Karl

Posted on
Mon Dec 04, 2017 4:56 pm
GlennNZ offline
User avatar
Posts: 1555
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

Thanks Karl

Can confirm issues have gone away with BLEconnect off for the wifi devices - even added another one.

Can I confirm this is also a Jessie issue? Otherwise would using the Jessie image be an option?
(if that is the case - is there a potential that software update of Stretch/rpi might address in future)

Glenn

Posted on
Mon Dec 04, 2017 5:11 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

Glenn,

have a RPI2 wifi and BLEconnect running with 3 BLE devices down and no issue,
ping shows ~ 1 missed ping every 200 pings, I guess thats normal for WiFi.

have not done any Jessie testing recently, need to find one that is still on that OS and switch to wifi..


Karl

will post a new version that does some fancier things around BLEconnect
it looks as if the timeout should be as short as 0.5 secs and then check RSSI and followup w RSSI check ~ 1 sec later if no answer. That seems to work nicely and does not hold the BLE stack hostage - max 0.5 secs instead of 10 as the previous default.

Posted on
Mon Dec 04, 2017 6:24 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

piBeacon: presence monitoring plugin discussions

I just added a second BLE dongle and it now runs fine on the RPI3 with WiFI.

the regular beacon stack seems to run on hci0 while the BLEconnect seems to use the hci1 dongle..
the beacon uses hci0 the onboard BLE by command ..
why BLEconnect uses the other one,, don't know why.. but it works

(do hciconfig at the prompt and you will see both like this:
Code: Select all
hciconfig
hci1:   Type: Primary  Bus: USB
   BD Address: 5C:F3:70:69:69:FB  ACL MTU: 1021:8  SCO MTU: 64:1
   UP RUNNING
   RX bytes:66332 acl:550 sco:0 events:3377 errors:0
   TX bytes:30485 acl:550 sco:0 commands:2142 errors:0

hci0:   Type: Primary  Bus: UART
   BD Address: B8:27:EB:D4:E3:35  ACL MTU: 1021:8  SCO MTU: 64:1
   UP RUNNING
   RX bytes:1704308 acl:92 sco:0 events:47819 errors:0
   TX bytes:17650 acl:92 sco:0 commands:937 errors:0



everything is happy

Glenn, could you just try that..
with the latest changes:
https://www.dropbox.com/s/c89afb6qd524gte/piBeacon-v-7.74.179.zip?dl=1

Posted on
Mon Dec 04, 2017 7:45 pm
GlennNZ offline
User avatar
Posts: 1555
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

kw123 wrote:
I just added a second BLE dongle and it now runs fine on the RPI3 with WiFI.

the regular beacon stack seems to run on hci0 while the BLEconnect seems to use the hci1 dongle..
the beacon uses hci0 the onboard BLE by command ..
why BLEconnect uses the other one,, don't know why.. but it works

(do hciconfig at the prompt and you will see both like this:
Code: Select all
hciconfig
hci1:   Type: Primary  Bus: USB
   BD Address: 5C:F3:70:69:69:FB  ACL MTU: 1021:8  SCO MTU: 64:1
   UP RUNNING
   RX bytes:66332 acl:550 sco:0 events:3377 errors:0
   TX bytes:30485 acl:550 sco:0 commands:2142 errors:0

hci0:   Type: Primary  Bus: UART
   BD Address: B8:27:EB:D4:E3:35  ACL MTU: 1021:8  SCO MTU: 64:1
   UP RUNNING
   RX bytes:1704308 acl:92 sco:0 events:47819 errors:0
   TX bytes:17650 acl:92 sco:0 commands:937 errors:0



everything is happy

Glenn, could you just try that..
with the latest changes:
https://www.dropbox.com/s/c89afb6qd524gte/piBeacon-v-7.74.179.zip?dl=1


Hi Karl,

Do I need a BLE dongle to try the version posted? If so will get a few.

Glenn

Posted on
Mon Dec 04, 2017 8:09 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

yes..

I still have 10 left overs from the RPI2 times..

but before you buy.. its looks as if sometimes the HCI channels are chosen randomly..

first need to understand how to direct the BLEconnect scanner to hci1

Karl

Posted on
Mon Dec 04, 2017 10:54 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

piBeacon: presence monitoring plugin discussions

Glenn,

got a pure python version working, without hcitool etc. can now set all the parameters. will have a version ready tomorrow

Karl

Posted on
Sun Dec 17, 2017 1:09 am
GlennNZ offline
User avatar
Posts: 1555
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

Hi Karl

Thanks for all your previously help - and hope you are enjoying Germany.

Just thought I would note down a couple of things to potentially update in the new year!

Sensors Data:

1. Sensor Data eg. temp 27.5 -- appears to be string?

As can't trigger within indigo on greater than/less than etc Only Equal to.
(obviously can convert to float in python and then run comparison - but.... )
Some of the Pi data I note you can trigger on greater than/equal to - just not the sensor data.

2. Can we have amaxtemp, maxhumidity, maxpressure, mintemp, minhumidity, minpressure (updated 24 hours) ?
Similar to the data in RFXCOM for their sensors.

3. Report the rpi's Temperature?
I have one that I have cooked - outside in waterproof box for gate sensor data. Currently 59.1 Celcius!
e.g with this
Code: Select all
/opt/vc/bin/vcgencmd measure_temp

4. Last Updated custom State
Again similar to RFXCOM sensors.
Indigo does create the Last Update State - but this is not accessible within a control page; however a Custom State is.




Thanks, enjoy your trip.

If I think of anything else - might update this post if that is okay.

Cheers


Glenn
Last edited by GlennNZ on Thu Dec 28, 2017 6:36 pm, edited 4 times in total.

Posted on
Sun Dec 17, 2017 4:07 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

Seems like good suggestions. But it will require a bit of work.
Nice challenge for next year.

I also want to add temp and pressure data raw data state.
Ie pressure is measured in pascal and then converted to eg mbar and the original info is not stored.
Same for temp base is Celsius and then converted to Fahrenheit. Would like to keep the original value.

Anyway will look at it in January




Sent from my iPhone using Tapatalk

Posted on
Tue Dec 19, 2017 3:53 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

Glenn
Thinking about min/max values.
What do you want to do with it? Do you need it for actions or reporting?
The values would reset every day at midnight

If you want to have it now: there is a minMax plugin that does
Min, Max, ave, count: for this hour, lastHour, today, yesterday, this week, last week , this month, lastMonth for any device/state or variable.

But it only works with sqlite, need to add postgres to the options

Karl
Sent from my iPhone using Tapatalk

Posted on
Tue Dec 19, 2017 6:49 pm
GlennNZ offline
User avatar
Posts: 1555
Joined: Dec 07, 2014
Location: Central Coast, Australia

Re: piBeacon: presence monitoring plugin discussions

kw123 wrote:
Glenn
Thinking about min/max values.
What do you want to do with it? Do you need it for actions or reporting?
The values would reset every day at midnight

If you want to have it now: there is a minMax plugin that does
Min, Max, ave, count: for this hour, lastHour, today, yesterday, this week, last week , this month, lastMonth for any device/state or variable.

But it only works with sqlite, need to add postgres to the options

Karl
Sent from my iPhone using Tapatalk


Yep essentially that - reset at midnight. Prefer to avoid sql / Other complications/plug-ins.

Use would be Mainly for control pages - have max/min values for rfxcom sensors on pages and nice to similarly access them for pibeacon sensors

Glenn


Sent from my iPhone using Tapatalk

Posted on
Fri Jan 05, 2018 9:48 am
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

Glenn,

temp, hum,press, air quality have now min/max today and yesterday coded.
also temp,... states are now numbers.

Still need to do some debugging with number of digits shown (decimal places for raw values )
this might create increased updates for indigo due to rounding differences. e.g. 24.00000001 C should be compared to 24.00 C. That is much easier with strings
for pressure that is different as it has MANY scales mB, TORR, inch HG .. Pascal ...

but it looks good .

Karl

Posted on
Fri Jan 05, 2018 12:55 pm
kw123 offline
User avatar
Posts: 8333
Joined: May 12, 2013
Location: Dallas, TX

Re: piBeacon: presence monitoring plugin discussions

added "Report the rpi's Temperature" in a RPI device state, also w min/max, update every ~60 secs



still thinking about:
Code: Select all
4. Last Updated custom State
Again similar to RFXCOM sensors.
Indigo does create the Last Update State - but this is not accessible within a control page; however a Custom State is.

should release this weekend


Karl

Page 62 of 78 1 ... 59, 60, 61, 62, 63, 64, 65 ... 78

Who is online

Users browsing this forum: No registered users and 4 guests