la commande envoyée par le plugin est « hcitool -i hci0 name 4c:02:xx:xx:xx:xx »
Je vous conseille de vérifier également le « controller bluetooth » dans la section configuration du plugin.
je vous suggère de redémarrer le démon et de vérifier l’état. Peut-être un problème de multi-threading sur le téléphone.
Est-ce que le téléphone est systématiquement vu « absent », ou alors est ce que ça bagotte (absent → present → absent, …).
Il n’y a pas de raison que la même commande retourne 2 résultats différents
est ce que vous avez as bien installe les dépendances ?
Quelle version de jeedom utilisez-vous, et sur quelle plateforme ?
Est-ce que vous utilisez la version « stable » ou la version « beta » du plugin ?
Normalement, vous devriez avoir ce genre de message toutes les 10 secondes,
« 4c:xxx is present » or « 4c:xxx is absent », ensuite seulement les changements d’états sont envoyés a jeedom.
Dans la version beta, j’ai entre autre rajouté un renvoie systématique toutes les 5 minutes, ainsi qu’une meilleure gestion des erreurs de la commande ‹ hcitool ›. Peut-etre que l’on aurait plus d’information avec la version beta.
J’ai redéfini l’appareil. Cette fois dans la version bêta.
Il n’est disponible que la première fois. Lorsque je désactive le bluetooth et le réactive, le plugin ne le détecte plus.
Signal 15 caught, exiting...
[2021-09-28 18:32:15][DEBUG] : Lanzamiento de :/var/www/html/core/class/../../core/php/jeePlugin.php plugin_id=phone_detection function=remove callInstallFunction=1
[2021-09-28 18:32:21][INFO] : Début d'activation du plugin
[2021-09-28 18:32:22][INFO] : Info sur le démon : {"launchable_message":"","launchable":"nok","state":"nok","log":"nok","auto":0}
[2021-09-28 18:32:22][DEBUG] : Lanzamiento de :/var/www/html/core/class/../../core/php/jeePlugin.php plugin_id=phone_detection function=install callInstallFunction=1
Signal 15 caught, exiting...
[2021-09-28 18:36:24][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:36:54][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:37:24][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:37:54][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:38:08][DEBUG] : postInsert()
[2021-09-28 18:38:16][DEBUG] : postUpdate()
[2021-09-28 18:38:16][INFO] : deviceType must be set to phone
[2021-09-28 18:38:16][DEBUG] : postUpdate()
[2021-09-28 18:38:16][DEBUG] : callDaemons update_device Array ( [0] => 550 [1] => pirracas [2] => 4C:02:20:xx:xx:xx )
[2021-09-28 18:38:16][DEBUG] : callDaemon (unix:///tmp/jeedom/phone_detection/daemon.sock) Array ( [action] => update_device [args] => Array ( [0] => 550 [1] => pirracas [2] => 4C:02:xx:xx:xx:xx ) [apikey] => xxxx )
[2021-09-28 18:38:16][DEBUG] : error 0 :
[2021-09-28 18:38:16][INFO] : Receive get_status for from antenna local
[2021-09-28 18:38:16][DEBUG] : id: 550
[2021-09-28 18:38:16][DEBUG] : result callDaemon Array ( [result] => Insert OK [success] => 1 )
[2021-09-28 18:38:16][DEBUG] : callDaemons update_device Array ( [0] => 550 [1] => pirracas [2] => 4C:02:20:xx:xx:xx )
[2021-09-28 18:38:16][DEBUG] : callDaemon (unix:///tmp/jeedom/phone_detection/daemon.sock) Array ( [action] => update_device [args] => Array ( [0] => 550 [1] => pirracas [2] => 4C:02:xx:xx:xx:xx ) [apikey] => xxxx )
[2021-09-28 18:38:16][DEBUG] : error 0 :
[2021-09-28 18:38:16][DEBUG] : result callDaemon Array ( [result] => Update OK [success] => 1 )
[2021-09-28 18:38:16][INFO] : Update device status from antenna local
[2021-09-28 18:38:16][DEBUG] : id: 550, value:1
[2021-09-28 18:38:16][DEBUG] : Device Name: [Casica][pirracas]
[2021-09-28 18:38:16][DEBUG] : State property name: [Casica][pirracas][Etat_local]
[2021-09-28 18:38:16][DEBUG] : Update value to . 1 for [Casica][pirracas][Etat_local]
[2021-09-28 18:38:16][INFO] : updateGlobalDevice()
[2021-09-28 18:38:24][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:38:54][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:39:24][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:39:54][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:39:58][INFO] : Update device status from antenna local
[2021-09-28 18:39:58][INFO] : Update device status from antenna local
[2021-09-28 18:40:24][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:40:54][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:41:19][INFO] : Update device status from antenna local
[2021-09-28 18:41:19][DEBUG] : id: 550, value:0
[2021-09-28 18:41:19][DEBUG] : Device Name: [Casica][pirracas]
[2021-09-28 18:41:19][DEBUG] : State property name: [Casica][pirracas][Etat_local]
[2021-09-28 18:41:19][DEBUG] : Update value to . 0 for [Casica][pirracas][Etat_local]
[2021-09-28 18:41:19][INFO] : updateGlobalDevice()
[2021-09-28 18:41:24][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:41:54][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:42:24][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:42:54][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:43:20][INFO] : Update device status from antenna local
[2021-09-28 18:43:20][DEBUG] : id: 550, value:0
[2021-09-28 18:43:20][DEBUG] : Device Name: [Casica][pirracas]
[2021-09-28 18:43:20][DEBUG] : State property name: [Casica][pirracas][Etat_local]
[2021-09-28 18:43:25][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:43:55][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:44:25][DEBUG] : This is a heartbeat from antenna local
[2021-09-28 18:44:55][DEBUG] : This is a heartbeat from antenna local
Bonsoir,
d’apres ton screenshot tu n’as pas rentré les valeurs " intervalle de mise à jour " etc.
ces valeurs sont grisées donc pas validées. Une fois que j’ai rentré ces valeurs mon tel a été détecté!
Alors pour ce qui est du debug il faudrait avoir les debug du démon en plus de ceux de jeedom.
Dans la page de configuration, sur la partie debug, vous avez « forcer le mode de debug » . Je ne me rappelle plus s’il faut relancer le démon, mais avant de le faire, regarde dans les logs, il devrait y avoir un nouveau fichier (_local)
C’est dans ce fichier qu’on devrait trouver des informations plus parlantes
Je reviens à la version bêta et force le mode débogage.
Il n’y a aucune information pertinente dans le journal principal.
Il n’y a pas non plus de fichier « _local »
[2021-09-29 11:27:29][DEBUG][root](Thread-2) : Message received in socket
[2021-09-29 11:27:29][DEBUG][root](Thread-2) : {'action': 'logdebug', 'args': ''}
[2021-09-29 11:27:29][DEBUG][root](Thread-2) : Dynamically change log to debug
[2021-09-29 11:27:29][DEBUG][root](Thread-2) : logging level is now DEBUG
[2021-09-29 11:27:29][DEBUG] : result callDaemon Array ( [result] => logdebug OK [success] => 1 )
[2021-09-29 11:27:35][DEBUG][root](Thread-3) : Get phone information 553
[2021-09-29 11:27:35][DEBUG][root](Thread-4) : Get phone information 551
[2021-09-29 11:27:35][DEBUG][root](Thread-3) : 553 is absent
[2021-09-29 11:27:35][DEBUG][root](Thread-4) : 551 is absent
[2021-09-29 11:27:35][DEBUG][root](Thread-3) : lastStateDate: 2021-09-29 11:16:58
[2021-09-29 11:27:35][DEBUG][root](Thread-4) : lastStateDate: 2021-09-29 11:16:58
[2021-09-29 11:27:35][DEBUG][root](Thread-3) : thresholdDate: 2021-09-29 11:19:58
[2021-09-29 11:27:35][DEBUG][root](Thread-4) : thresholdDate: 2021-09-29 11:19:58
[2021-09-29 11:27:35][DEBUG][root](Thread-3) : datetime.utcnow(): 2021-09-29 09:27:35.500624
[2021-09-29 11:27:35][DEBUG][root](Thread-4) : datetime.utcnow(): 2021-09-29 09:27:35.500876
[2021-09-29 11:27:35][DEBUG][root](Thread-3) : is datetime.utcnow() > thresholdDate ? False
[2021-09-29 11:27:35][DEBUG][root](Thread-4) : is datetime.utcnow() > thresholdDate ? False
[2021-09-29 11:27:35][DEBUG][root](Thread-3) : 553 is up to date
[2021-09-29 11:27:35][DEBUG][root](Thread-4) : 551 is up to date
[2021-09-29 11:27:41][DEBUG][root](Thread-1) : Send to jeedom : {'action': 'heartbeat', 'source': 'local'}
[2021-09-29 11:27:41][DEBUG] : This is a heartbeat from antenna local
[2021-09-29 11:27:41][DEBUG][root](Thread-1) : Status Code : 200
[2021-09-29 11:27:41][DEBUG][root](Thread-1) : Jeedom reply : {'success': True, 'value': 0}
[2021-09-29 11:27:45][DEBUG][root](Thread-3) : Get phone information 553
[2021-09-29 11:27:45][DEBUG][root](Thread-4) : Get phone information 551
[2021-09-29 11:27:45][DEBUG][root](Thread-3) : 553 is absent
[2021-09-29 11:27:45][DEBUG][root](Thread-3) : lastStateDate: 2021-09-29 11:16:58
[2021-09-29 11:27:45][DEBUG][root](Thread-3) : thresholdDate: 2021-09-29 11:19:58
[2021-09-29 11:27:45][DEBUG][root](Thread-3) : datetime.utcnow(): 2021-09-29 09:27:45.638339
[2021-09-29 11:27:45][DEBUG][root](Thread-3) : is datetime.utcnow() > thresholdDate ? False
[2021-09-29 11:27:45][DEBUG][root](Thread-3) : 553 is up to date
[2021-09-29 11:27:45][DEBUG][root](Thread-4) : 551 is absent
[2021-09-29 11:27:45][DEBUG][root](Thread-4) : lastStateDate: 2021-09-29 11:16:58
[2021-09-29 11:27:45][DEBUG][root](Thread-4) : thresholdDate: 2021-09-29 11:19:58
[2021-09-29 11:27:45][DEBUG][root](Thread-4) : datetime.utcnow(): 2021-09-29 09:27:45.639569
[2021-09-29 11:27:45][DEBUG][root](Thread-4) : is datetime.utcnow() > thresholdDate ? False
[2021-09-29 11:27:45][DEBUG][root](Thread-4) : 551 is up to date
[2021-09-29 11:27:55][DEBUG][root](Thread-3) : Get phone information 553
[2021-09-29 11:27:55][DEBUG][root](Thread-4) : Get phone information 551
[2021-09-29 11:27:55][DEBUG][root](Thread-3) : 553 is absent
[2021-09-29 11:27:55][DEBUG][root](Thread-4) : 551 is absent
[2021-09-29 11:27:55][DEBUG][root](Thread-3) : lastStateDate: 2021-09-29 11:16:58
[2021-09-29 11:27:55][DEBUG][root](Thread-4) : lastStateDate: 2021-09-29 11:16:58
[2021-09-29 11:27:55][DEBUG][root](Thread-3) : thresholdDate: 2021-09-29 11:19:58
[2021-09-29 11:27:55][DEBUG][root](Thread-4) : thresholdDate: 2021-09-29 11:19:58
[2021-09-29 11:27:55][DEBUG][root](Thread-3) : datetime.utcnow(): 2021-09-29 09:27:55.788518
[2021-09-29 11:27:55][DEBUG][root](Thread-4) : datetime.utcnow(): 2021-09-29 09:27:55.788770
[2021-09-29 11:27:55][DEBUG][root](Thread-3) : is datetime.utcnow() > thresholdDate ? False
[2021-09-29 11:27:55][DEBUG][root](Thread-4) : is datetime.utcnow() > thresholdDate ? False
[2021-09-29 11:27:55][DEBUG][root](Thread-3) : 553 is up to date
[2021-09-29 11:27:55][DEBUG][root](Thread-4) : 551 is up to date
J’ai ajouté des lignes supplémentaires avant et après la commande dans le code.
(Je ne suis pas un développeur, faites le moi savoir s’ils se trompent)
logging.debug('Get phone information {}'.format(self.device.deviceId))
logging.debug('Get phone information {}'.format(self.device.macAddress))
logging.debug('Get phone information {}'.format(self.btController))
result = subprocess.run(['sudo', 'hcitool', '-i', self.btController, 'name', self.device.macAddress], stdout = subprocess.PIPE)
logging.debug('Get phone information {}'.format(result))
logging.debug('Get phone information {}'.format(result.stdout))
c’est le résultat
[2021-09-29 11:46:51][DEBUG][root](Thread-4) : Get phone information CompletedProcess(args=['sudo', 'hcitool', '-i', 'hci0', 'name', '4C:02:20:xx:xx:xx'], returncode=0, stdout=b'')
[2021-09-29 11:46:51][DEBUG][root](Thread-4) : Get phone information b''
[2021-09-29 11:46:51][DEBUG][root](Thread-3) : Get phone information CompletedProcess(args=['sudo', 'hcitool', '-i', 'hci0', 'name', '64:89:F1:xx:xx:xx'], returncode=0, stdout=b'')
[2021-09-29 11:46:51][DEBUG][root](Thread-4) : 551 is absent
[2021-09-29 11:46:51][DEBUG][root](Thread-3) : Get phone information b''
[2021-09-29 11:46:51][DEBUG][root](Thread-4) : lastStateDate: 2021-09-29 11:16:58
[2021-09-29 11:46:51][DEBUG][root](Thread-3) : 553 is absent
bonjour,
j’ai vérifié et les logs devraient être dans le même fichier (phone_detection.log).
Pour le log que vous avez fourni, on voit que l’antenne bluetooth est hci0 et non pas hci1 comme indique dans la configuration precedente.
quel est le résultat quand vous exécutez la même commande manuellement ?
sudo hcitool -i hci0 name 4c:02:20:xx:xx:xx
le résultat de la commande via python retourne une chaîne vide (stdout=b"")’ c’est pourquoi le téléphone est vu comme absent. Si la chaîne de retour avait été « Mi 10T », il aurait été vu comme présent.
Pouvez vous rejouer la commande avec « time sudo » devant la commande, pour voir si cela impact le résultat. et l’exécuter plusieurs fois de suite (au moins 3 fois), pour mesurer le temps de réponse de la commande
jeedom@jeedom:~$ time hcitool -i hci0 name 4C:02:20:xx:xx:xx
Mi 10T
real 0m1.209s
user 0m0.003s
sys 0m0.000s
jeedom@jeedom:~$ time hcitool -i hci0 name 4C:02:20:xx:xx:xx
Mi 10T
real 0m0.491s
user 0m0.003s
sys 0m0.000s
jeedom@jeedom:~$ time hcitool -i hci0 name 4C:02:20:xx:xx:xx
real 0m0.108s
user 0m0.003s
sys 0m0.000s
jeedom@jeedom:~$ time hcitool -i hci0 name 4C:02:20:xx:xx:xx
Mi 10T
real 0m2.202s
user 0m0.001s
sys 0m0.002s
jeedom@jeedom:~$ time hcitool -i hci0 name 4C:02:20:xx:xx:xx
Mi 10T
real 0m0.482s
user 0m0.003s
sys 0m0.000s
jeedom@jeedom:~$ time hcitool -i hci0 name 4C:02:20:xx:xx:xx
Mi 10T
real 0m0.595s
user 0m0.003s
sys 0m0.000s
jeedom@jeedom:~$ time hcitool -i hci0 name 4C:02:20:xx:xx:xx
Mi 10T
real 0m0.580s
user 0m0.001s
sys 0m0.003s
jeedom@jeedom:~$ time hcitool -i hci0 name 4C:02:20:xx:xx:xx
Mi 10T
real 0m0.629s
user 0m0.003s
sys 0m0.000s
jeedom@jeedom:~$ time hcitool -i hci0 name 4C:02:20:xx:xx:xx
Mi 10T
real 0m0.677s
user 0m0.003s
sys 0m0.000s
jeedom@jeedom:~$ time hcitool -i hci0 name 4C:02:20:xx:xx:xx
real 0m0.010s
user 0m0.001s
sys 0m0.003s
Bonsoir,
Les temps de réponse sont bon, donc il n’y a pas de timeout sur la commande .
Je n explique pas pourquoi le programme python retourne une chaîne vide, sauf la première fois.
La je sèche , d’autant plus que personne n’a reporté ce genre de problème
Benoit