Bonjour à tous, c'est akenad
,
Aujourd'hui je vais vous présenter un retour d'expérience sur la mise en œuvre du plugin BLEA sur une JeedomSmart Stretch et antenne BLEA déportée SENA UD100a sur un Odroid-C2.
Les équipements et logiciels utilisés sont les suivants :
- JeedomSmart Stretch, Jeedom 3.2.11, plugin BLEA 2018-06-15
- Odroid-C2 Armbian Stretch Kernel 4.x
- clé USB Bluetooth BLE 4.0 SENA Model Parani-UD100a, avec une antenne additionnelle SMA ominidirectionnelle 2,4 Ghz 12dbi
- Awox Smartplug, Nodon NIU, iTag
J'ai procédé en 3 étapes :
-installation sur l’Odroid-C2 de Armbian Stretch avec un Kernel 4.x
-installation et configuration du plugin BLEA sur la JeedomSmart Stretch
-prise d'informations système sur l’Odroid-C2
1) Installation sur l’Odroid-C2 de Armbian Stretch avec un Kernel 4.x
pour installer c’est ici :
viewtopic.php?f=128&t=32932&p=630489&#p630241
puis :
Code : Tout sélectionner
$ sudo apt-get update && sudo apt-get upgrade
$ sudo apt-get install bluez
$ sudo apt-get install bluetooth
2) installation et configuration du plugin BLEA sur la JeedomSmart Stretch
Pour configurer le plugin, la documentation Jeedom officielle ici :
https://jeedom.github.io/plugin-blea/fr_FR/
avec les précisions suivantes :
- ne pas sélectionner de Contrôleur Bluetooth, c’est-à-dire définir « Aucun » comme port clef bluetooth dans la Configuration et cliquer sur le bouton sauvegarder.
Le démon du plugin est en statut et Configuration « NOK ».
Ce qui est normal car il n’y a pas de clé Bluetooth de connecté sur la JeedomSmart elle même car je ne veux pas utiliser d’Antenne BLEA en local mais uniquement une antenne BLEA déportée (Remote), à savoir l’UD100a sur Odroid-C2 avec une seule antenne suffisamment puissante pour rayonner sur tout le logement.
- AntenneBLEA.png (532.42 Kio) Consulté 5102 fois
Installation de l’Antenne BLEA déportée :
(inspiré d’ici :
http://sarakha63-domotique.fr/rasberry- ... t-possible)
Jeedom → Plugins -> Protocole domotique -> Bluetooth Advertisement
-cliquez sur “Antennes” puis “Ajouter” et remplissez les champs :
Nom: AntenneBLEA (ou autre)
Ip: IP OdroidC2
Port: 22
User: nom user crée à l’installation d’Armbian sur OdroidC2
Password: mot de passe du user
Device: hci
-Cliquez sur “Sauvegarder” puis sur “Envoyer les fichiers”
-depuis une session ssh de l’OdroidC2, contrôlez la présence des fichiers envoyés :
ls /home/pluginblea/blead/resources (doit contenir le dossier “blead” et le fichier “install.sh”)
-cliquez sur “Lancer les dépendances”
-depuis la session ssh de l’OdroidC2, contrôlez l’installation des dépendances :
tail -f /tmp/blea_dependancy
-attendre la fin de l’installation
-Cliquez sur “Lancer” pour démarrer le démon BLEA
-depuis la session ssh de l’OdroidC2, contrôlez les logs du démon :
tail -f /tmp/blea
-Fermez et ouvrez à nouveau la fenêtre « Antennes »
-le cœur de l’antenne doit passer de la couleur rouge à verte
3) prise d'informations système sur l’Odroid-C2
Le système :
Code : Tout sélectionner
$ uname -a
Linux domobox 4.18.8-odroidc2 #264 SMP PREEMPT Wed Sep 19 12:35:18 CEST 2018 aarch64 GNU/Linux
$ cat /etc/issue
Debian GNU/Linux 9 \n \l
La clé Bluetooth UD100a :
Code : Tout sélectionner
$ lsusb
Bus 001 Device 003: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
$ sudo hciconfig -a
hci0: Type: Primary Bus: USB
BD Address: #Adr-MAC-cle# ACL MTU: 310:10 SCO MTU: 64:8
UP RUNNING
RX bytes:894701776 acl:265 sco:0 events:51254159 errors:0
TX bytes:116246015 acl:310 sco:0 commands:16032458 errors:0
Features: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'domobox'
Class: 0x000000
Service Classes: Unspecified
Device Class: Miscellaneous,
HCI Version: 4.0 (0x6) Revision: 0x2031
LMP Version: 4.0 (0x6) Subversion: 0x2031
Manufacturer: Cambridge Silicon Radio (10)
les système et USB :
Code : Tout sélectionner
$ dmesg | grep usb
[ 0.000000] Kernel command line: root=UUID=4722b364-ae1f-42d6-ad8f-831b86997837 rootwait rootfstype=ext4 panic=10 consoleblank=0 loglevel=1 ubootpart=0d190000-01 usb-storage.quirks=0x2537:0x1066:u,0x2537:0x1068:u cgroup_enable=memory swapaccount=1
[ 0.373115] usbcore: registered new interface driver usbfs
[ 0.373154] usbcore: registered new interface driver hub
[ 0.373213] usbcore: registered new device driver usb
[ 0.554946] GPIO line 501 (usb-hub-reset) hogged as output/high
[ 1.637759] usbcore: registered new interface driver usb-storage
[ 1.668507] usbcore: registered new interface driver usbhid
[ 1.668509] usbhid: USB HID core driver
[ 1.683886] dwc2 c9000000.usb: c9000000.usb supply vusb_d not found, using dummy regulator
[ 1.683922] dwc2 c9000000.usb: c9000000.usb supply vusb_a not found, using dummy regulator
[ 1.685182] dwc2: probe of c9000000.usb failed with error -22
[ 1.685412] dwc2 c9100000.usb: c9100000.usb supply vusb_d not found, using dummy regulator
[ 1.685452] dwc2 c9100000.usb: c9100000.usb supply vusb_a not found, using dummy regulator
[ 1.738352] dwc2 c9100000.usb: dwc2_check_params: Invalid parameter lpm=1
[ 1.738356] dwc2 c9100000.usb: dwc2_check_params: Invalid parameter lpm_clock_gating=1
[ 1.738359] dwc2 c9100000.usb: dwc2_check_params: Invalid parameter besl=1
[ 1.738363] dwc2 c9100000.usb: dwc2_check_params: Invalid parameter hird_threshold_en=1
[ 1.738730] dwc2 c9100000.usb: DWC OTG Controller
[ 1.738745] dwc2 c9100000.usb: new USB bus registered, assigned bus number 1
[ 1.738769] dwc2 c9100000.usb: irq 34, io mem 0xc9100000
[ 1.738927] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.18
[ 1.738931] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[ 1.738934] usb usb1: Product: DWC OTG Controller
[ 1.738937] usb usb1: Manufacturer: Linux 4.18.8-odroidc2 dwc2_hsotg
[ 1.738940] usb usb1: SerialNumber: c9100000.usb
[ 2.111655] usb 1-1: new high-speed USB device number 2 using dwc2
[ 2.292278] usb 1-1: New USB device found, idVendor=05e3, idProduct=0610, bcdDevice=32.98
[ 2.292340] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[ 2.292503] usb 1-1: Product: USB2.0 Hub
[ 2.580387] usb 1-1.3: new full-speed USB device number 3 using dwc2
[ 2.661169] usb 1-1.3: New USB device found, idVendor=0a12, idProduct=0001, bcdDevice=82.41
[ 2.661207] usb 1-1.3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 34.257670] usbcore: registered new interface driver btusb
Le service Bluetooth :
Code : Tout sélectionner
$ dmesg | grep Blue
[ 34.240503] Bluetooth: Core ver 2.22
[ 34.240561] Bluetooth: HCI device and connection manager initialized
[ 34.240576] Bluetooth: HCI socket layer initialized
[ 34.240581] Bluetooth: L2CAP socket layer initialized
[ 34.240599] Bluetooth: SCO socket layer initialized
[ 38.906607] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 38.906613] Bluetooth: BNEP filters: protocol multicast
[ 38.906628] Bluetooth: BNEP socket layer initialized
$ systemctl status bluetooth -l
● bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2018-12-29 19:42:41 CET; 5min ago
Docs: man:bluetoothd(8)
Main PID: 1822 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 4915)
CGroup: /system.slice/bluetooth.service
└─1822 /usr/lib/bluetooth/bluetoothd
Dec 29 19:42:41 domobox systemd[1]: Starting Bluetooth service...
Dec 29 19:42:41 domobox bluetoothd[1822]: Bluetooth daemon 5.43
Dec 29 19:42:41 domobox bluetoothd[1822]: Starting SDP server
Dec 29 19:42:41 domobox systemd[1]: Started Bluetooth service.
Dec 29 19:42:41 domobox bluetoothd[1822]: Bluetooth management interface 1.14 initialized
Dec 29 19:42:41 domobox bluetoothd[1822]: Failed to obtain handles for "Service Changed" characteristic
Dec 29 19:42:41 domobox bluetoothd[1822]: Sap driver initialization failed.
Dec 29 19:42:41 domobox bluetoothd[1822]: sap-server: Operation not permitted (1)
Les paquets BlueZ, Bluetooth et python :
Code : Tout sélectionner
$ dpkg -l | grep blue
ii bluetooth 5.43-2+deb9u1 all Bluetooth support
ii bluez 5.43-2+deb9u1 arm64 Bluetooth tools and daemons
ii libbluetooth3:arm64 5.43-2+deb9u1 arm64 Library to use the BlueZ Linux Bluetooth stack
$ dpkg -l | grep python
ii dh-python 2.20170125 all Debian helper tools for packaging Python libraries and applications
ii libpython-dev:arm64 2.7.13-2 arm64 header files and a static library for Python (default)
ii libpython-stdlib:arm64 2.7.13-2 arm64 interactive high-level object-oriented language (default python version)
ii libpython2.7:arm64 2.7.13-2+deb9u3 arm64 Shared Python runtime library (version 2.7)
ii libpython2.7-dev:arm64 2.7.13-2+deb9u3 arm64 Header files and a static library for Python (v2.7)
ii libpython2.7-minimal:arm64 2.7.13-2+deb9u3 arm64 Minimal subset of the Python language (version 2.7)
ii libpython2.7-stdlib:arm64 2.7.13-2+deb9u3 arm64 Interactive high-level object-oriented language (standard library, version 2.7)
ii libpython3-stdlib:arm64 3.5.3-1 arm64 interactive high-level object-oriented language (default python3 version)
ii libpython3.5-minimal:arm64 3.5.3-1+deb9u1 arm64 Minimal subset of the Python language (version 3.5)
ii libpython3.5-stdlib:arm64 3.5.3-1+deb9u1 arm64 Interactive high-level object-oriented language (standard library, version 3.5)
ii python 2.7.13-2 arm64 interactive high-level object-oriented language (default version)
ii python-apt-common 1.4.0~beta3 all Python interface to libapt-pkg (locales)
ii python-chardet 2.3.0-2 all universal character encoding detector for Python2
ii python-dev 2.7.13-2 arm64 header files and a static library for Python (default)
ii python-gdbm 2.7.13-1 arm64 GNU dbm database support for Python
ii python-minimal 2.7.13-2 arm64 minimal subset of the Python language (default version)
ii python-pip 9.0.1-2 all Python package installer
ii python-pip-whl 9.0.1-2 all Python package installer
ii python-pkg-resources 33.1.1-1 all Package Discovery and Resource Access using pkg_resources
ii python-requests 2.12.4-1 all elegant and simple HTTP library for Python2, built for human beings
ii python-six 1.10.0-3 all Python 2 and 3 compatibility library (Python 2 interface)
ii python-urllib3 1.19.1-1 all HTTP library with thread-safe connection pooling for Python
ii python2.7 2.7.13-2+deb9u3 arm64 Interactive high-level object-oriented language (version 2.7)
ii python2.7-dev 2.7.13-2+deb9u3 arm64 Header files and a static library for Python (v2.7)
ii python2.7-minimal 2.7.13-2+deb9u3 arm64 Minimal subset of the Python language (version 2.7)
ii python3 3.5.3-1 arm64 interactive high-level object-oriented language (default python3 version)
ii python3-apt 1.4.0~beta3 arm64 Python 3 interface to libapt-pkg
ii python3-dbus 1.2.4-1+b1 arm64 simple interprocess messaging system (Python 3 interface)
ii python3-gi 3.22.0-2 arm64 Python 3 bindings for gobject-introspection libraries
ii python3-minimal 3.5.3-1 arm64 minimal subset of the Python language (default python3 version)
ii python3-pycurl 7.43.0-2 arm64 Python bindings to libcurl (Python 3)
ii python3-software-properties 0.96.20.2-1 all manage the repositories that you install software from
ii python3.5 3.5.3-1+deb9u1 arm64 Interactive high-level object-oriented language (version 3.5)
ii python3.5-minimal 3.5.3-1+deb9u1 arm64 Minimal subset of the Python language (version 3.5)
module python bluepy :
Code : Tout sélectionner
$ pip show bluepy
Name: bluepy
Version: 1.1.2
Summary: Python module for interfacing with BLE devices through Bluez
Home-page: https://github.com/IanHarvey/bluepy
Author: Ian Harvey
Author-email: website-contact@fenditton.org
License: UNKNOWN
Location: /usr/local/lib/python2.7/dist-packages
Requires:
ATTENTION /!\ :
Si l’ampoule Awox Mesh est allumé (elle n’est pas incluse dans le plugin BLEA), de nombreux messages d’avertissement sons visibles dans le fichier dmesg.
extrait dans dmesg :
Code : Tout sélectionner
[1310829.326021] Bluetooth: hci0: advertising data len corrected
[1310839.292046] Bluetooth: hci0: advertising data len corrected
[1313944.179057] Bluetooth: hci0: request failed to create LE connection: status 0x0c
[1313997.073008] Bluetooth: hci0: advertising data len corrected
[1314226.564040] Bluetooth: hci0: advertising data len corrected
[1314327.644010] Bluetooth: hci0: advertising data len corrected
[1314406.675041] Bluetooth: hci0: advertising data len corrected
[1315069.083041] Bluetooth: hci0: advertising data len corrected
[1315286.191033] Bluetooth: hci0: advertising data len corrected
[1316054.446002] Bluetooth: hci0: advertising data len corrected
A noter que le plugin BLEA, pour communiquer avec les équipements BLE, s’appuie sur le module python bluepy 1.1.2, qui lui-même s’appuie sur BlueZ 5.43.
En fonction des versions on peut s’attendre à des comportements différents qui ne seront pas forcement liés directement au plugin BLEA.
Ici c’est un OdroidC2 Armbian stretch kernel 4.x avec SENA UD100a.
En début d’année (voir plus haut) j’avais rencontré quelques difficultés avec une SENA UD100a sur une JeedomSmart Jessie (bluepy 1.1.2 et BlueZ 5.23).
J’ai pu constaté des perturbations bluetooth provoquant éventuelles des décrochages du plugin BLEA avec l’association
SENA UD100a / BlueZ / présence équipement Bluetooth Mesh.
Se serait peut-être à creuser plus avant.
Par exemple une mise à jour en bluepy 1.3.0 et BlueZ 5.47 ou 5.50 et une mise à jour du firmware de la SENA UD100a (je n’ai pas trouvé) pourrait peut-être améliorer.
Les versions de bluepy sont décrites ici :
https://github.com/IanHarvey/bluepy
et les problèmes ici :
https://github.com/IanHarvey/bluepy/issues
Les versions de BlueZ ici :
http://www.bluez.org
En attendant je n’utilise plus l'ampoule Awox Mesh.
Voila j'espère que ce retour d’expérience sera utile aux membres Jeedom.
akenad