Anwesenheitserkennung Bluetooth PebbleBee

Begonnen von tomster, 06 November 2014, 10:01:16

Vorheriges Thema - Nächstes Thema

justme1968

dein device scheint sich anders zu melden als das von mitch und du bekommst nur mit --duplicates regelmäßig eine info. d.h. du musst das --duplicates  im PRESENCED modul in den aufruf mit einbauen. entweder du änderst es direkt im code oder du versuchst mal das komplette kommando am ende des define mit anzugeben. das ist zwar eingebaut aber ich weiss nicht ob es geht. also etwa so:define <pd> PRESENCED /usr/bin/hcitool lescan --duplicates

zum gleichzeitigen aufruf: siehe oben. der usb dongle ist nicht gleichzeitig nutzbar.

gruss
  andre
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

Steffen

Zitat von: justme1968 am 23 November 2014, 11:03:58
dein device scheint sich anders zu melden als das von mitch und du bekommst nur mit --duplicates regelmäßig eine info. d.h. du musst das --duplicates  im PRESENCED modul in den aufruf mit einbauen. entweder du änderst es direkt im code oder du versuchst mal das komplette kommando am ende des define mit anzugeben. das ist zwar eingebaut aber ich weiss nicht ob es geht. also etwa so:define <pd> PRESENCED /usr/bin/hcitool lescan --duplicates

zum gleichzeitigen aufruf: siehe oben. der usb dongle ist nicht gleichzeitig nutzbar.

gruss
  andre

Das hatte ich auch schon im Code geändert aber wieder das selbe Ergebnis :(

Mfg Steffen

justme1968

was siehst du bei einem list auf das device? ändern sich die timestamps?
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

Steffen

Zitat von: justme1968 am 23 November 2014, 11:11:39
was siehst du bei einem list auf das device? ändern sich die timestamps?

Meinst du über Fhem?

dann PRESENCED:

Internals:
   CMD        /usr/bin/hcitool lescan --duplicates
   CONNECTS   1
   DEF        /usr/bin/hcitool lescan --duplicates
   FD         5
   LAST_CONNECT 2014-11-23 11:12:31
   NAME       pd
   NR         422
   NTFY_ORDER 50-Te
   PARTIAL
   STATE      Connected
   TYPE       PRESENCED
   Helper:
     Devices:
Attributes:


Device:

Internals:
   ADDRESS    D0:FF:50:7A:24:08
   DEF        local-PRESENCED D0:FF:50:7A:24:08
   MODE       local-PRESENCED
   NAME       TestBlue
   NR         421
   STATE      absent
   TIMEOUT_NORMAL 30
   TIMEOUT_PRESENT 30
   TYPE       PRESENCE
   Readings:
     2014-11-23 13:33:28   state           absent
   Helper:
Attributes:


Hoffe du meintest das?!

Mfg

justme1968

läuft dein fhem als root?

wenn nicht musst du das lescan mit sudo aufrufen und dafür sorgen das es ohne password möglich ist.

gruss
  andre
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

Steffen

Zitat von: justme1968 am 23 November 2014, 13:39:18
läuft dein fhem als root?

wenn nicht musst du das lescan mit sudo aufrufen und dafür sorgen das es ohne password möglich ist.

gruss
  andre

Das komische daran ist, das es ja bei den scripten von Mitch&Gero mit den Befehlen auch funktionierte!
Darum wundert mich das es bei deinem nicht geht.

Sorry aber woran erkenne ich nochmal das fhem als root läuft? Sieht man es an der berechtigung zum Ordner?


oliv06

I had the 73_PRESENCE.pm and 73_PRESENCED.pm installed and it seems to work

However :
- CPU usage increased drastically on my cubieboard 2
- I get frequently grep: write error: Broken pipe errors on the stderr

Did anyone noticed the same ?

justme1968

have you deactivated all of the shellsctipt versions?

which process is causing the cpu usage? see top? if the cpu usage is indeed from fhem what does apptime give?

the module itself does not use grep in any form. i have no idea at the momment where the error message comes from.

hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

oliv06

#113
I had not tested the scripts, only PRESENCED + PRESENCE.
Hungry process seems to be mmcqd/0 and bluetoothd , and occasionaly perl (fhem) which goes to up to 25%. Load average had increased a lot (0,05 before, can go to 1,5 with the feature)
After a reboot and 50 mn uptime here is results of top.
You can see on the CPU graph the impact of activating the feature.

Something else : I cannot stop fhem with /etc/init.d/fhem stop. I need to kill the hcitool process before manually.

justme1968

mmcqd is related to writing to out sd card and bluetoothd is related to the system bluetooth software.

i think there is sind sort of conflict between the system bluetooth software and the fhem module. probably related to the exklusive access.

have a look in the system logfiles and try to disable and system blutetooth software.

about the stopping: i will have a look at this.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

Mitch

So, bei mir liefen die Module ja das ganze WE.

Alles (grundsätzlich) ohne Probleme mit ein paar Schönheitsfehlern:

1. Ein paar Warnings im Log, wenn fhem bzw. das PRESENCED Modul startet:
2014.11.24 09:19:41 1: PERL WARNING: Subroutine PRESENCED_Read redefined at ./FHEM/73_PRESENCED.pm line 152.
2014.11.24 09:19:41 1: PERL WARNING: Subroutine PRESENCED_Get redefined at ./FHEM/73_PRESENCED.pm line 138.
2014.11.24 09:19:41 1: PERL WARNING: Subroutine PRESENCED_Set redefined at ./FHEM/73_PRESENCED.pm line 128.
2014.11.24 09:19:41 1: PERL WARNING: Subroutine PRESENCED_Undefine redefined at ./FHEM/73_PRESENCED.pm line 118.
2014.11.24 09:19:41 1: PERL WARNING: Subroutine PRESENCED_Disconnect redefined at ./FHEM/73_PRESENCED.pm line 99.
2014.11.24 09:19:41 1: PERL WARNING: Subroutine PRESENCED_Connect redefined at ./FHEM/73_PRESENCED.pm line 70.
2014.11.24 09:19:41 1: PERL WARNING: Subroutine PRESENCED_Notify redefined at ./FHEM/73_PRESENCED.pm line 59.
2014.11.24 09:19:41 1: PERL WARNING: Subroutine PRESENCED_Define redefined at ./FHEM/73_PRESENCED.pm line 32.
2014.11.24 09:19:41 1: PERL WARNING: Subroutine PRESENCED_Initialize redefined at ./FHEM/73_PRESENCED.pm line 13.


2. wird wohl bei einem shutdown restart der hcitool Prozess nicht beendet, was zur Folge hat, das beim Start von fhem ein DICONNECT im PRESENCED Modul zur Folge hat.
Abhilfe schaft ein sudo hciconfig hci0 down und danach  sudo hciconfig hci0 up.
Habe mir als Workaround ein notify auf GLOBAL erstellt, der die zwei Befehle ausführt.

Bezüglich Ressourcen (I switch to english):

After testing with top I found the following:
- perl process take 0,3% to max. 1,3% of CPU ( 9662 fhem      20   0  326380 134644   4976 S   1,3  3,3   0:44.81 perl)
- hcitool process take 0,3% of CPU

So I think everything is fine.
FHEM im Proxmox Container

justme1968

ich schaue mir beides an.

gruß
  andre
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

justme1968

ich schaue mir beides an.

gruß
  andre
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

justme1968

#118
bist du sicher das die perl warnungen beim fhem start kommen? oder gab es irgendwo ein reload von hand? dann wären die meldungen ok.

zum killen von hidtool: das baue ich heute abend ein.

ich würde auch gerne das modul noch mal umbenennen. zb. in irgendetwas mit lescan. presence-lescand oder so.

@markus: wie wäre es zusätzlich zu function noch einen typ function-no-fork zu haben. dann könnte man die lescan geschichte generisch damit erledigen. um einmal in {helper}->{DEVCICES} nachzusehen ist ein BlockingCall wirklich übertrieben.

gruss
  andre

und noch was: könntest du das ganze noch zusätzlich in den presenced einbauen damit auch mehrere räume überwachbar werden. es gibt ja tags die lassen sich in der sendeleistung konfigurieren.
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

oliv06

Thanks to justme1968 and Mitch for their time.
I have to check-out why bluetoothd is so CPU intensive. Did not find anything special in logs. What is your bluez version ?