[phone_detection] Besoin de beta testers pour un nouveau plugin

ma configuration est bien sur 60 secondes mais il ne se passe rien

Traceback (most recent call last):
File "/var/www/html/plugins/phone_detection/core/class/../../resources/phone_detectiond/phone_detectiond.py", line 396, in <module>
DEVICES = jc.getDevices()
File "/var/www/html/plugins/phone_detection/core/class/../../resources/phone_detectiond/phone_detectiond.py", line 240, in getDevices
r[key].lastStateDate = datetime.fromisoformat(item['lastValueDate'])
AttributeError: type object 'datetime.datetime' has no attribute 'fromisoformat'
[2019-11-18 15:19:34][DEBUG][root](MainThread) : Signal 15 caught, exiting...
[2019-11-18 15:19:34][INFO][root](MainThread) : =========== Shutdown ===========
[2019-11-18 15:19:34][INFO][root](MainThread) : Stopping all threads
[2019-11-18 15:19:34][INFO][root](MainThread) : Shutting down local server
[2019-11-18 15:19:35][INFO][root](MainThread) : Removing Socket file /tmp/jeedom/phone_detection/daemon.sock
[2019-11-18 15:19:35][INFO][root](MainThread) : Removing PID file /tmp/jeedom/phone_detection/daemon.pid
[2019-11-18 15:19:35][INFO][root](MainThread) : Exit 0
[2019-11-18 15:19:35][INFO][root](MainThread) : =================================
Signal 15 caught, exiting...
[2019-11-18 15:19:35][INFO] : Lancement démon phone_detection : /usr/bin/python3 /var/www/html/plugins/phone_detection/core/class/../../resources/phone_detectiond/phone_detectiond.py  --device hci0 --loglevel debug --apikey qIcYq2Kw7ybq81X7SIWaHVCemt8XX:XX --pidfile /tmp/jeedom/phone_detection/daemon.pid --socket /tmp/jeedom/phone_detection/daemon.sock --callback http://127.0.0.1:80/plugins/phone_detection/core/php/phone_detection.php --interval 10 --present_interval 30 --absentThreshold 60
[2019-11-18 15:19:37][INFO][root](MainThread) : Start phone_detectiond
[2019-11-18 15:19:37][INFO][root](MainThread) : Log level : debug
[2019-11-18 15:19:37][INFO][root](MainThread) : Socket : /tmp/jeedom/phone_detection/daemon.sock
[2019-11-18 15:19:37][INFO][root](MainThread) : PID file : /tmp/jeedom/phone_detection/daemon.pid
[2019-11-18 15:19:37][INFO][root](MainThread) : Device : hci0
[2019-11-18 15:19:37][INFO][root](MainThread) : Callback : http://127.0.0.1:80/plugins/phone_detection/core/php/phone_detection.php
[2019-11-18 15:19:37][INFO][root](MainThread) : Interval : 10
[2019-11-18 15:19:37][INFO][root](MainThread) : Present Interval : 30
[2019-11-18 15:19:37][INFO][root](MainThread) : AbsentThreshold: 60
[2019-11-18 15:19:37][INFO][root](MainThread) : Python version : 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516]
[2019-11-18 15:19:37][DEBUG][root](MainThread) : Writing PID 27420 to /tmp/jeedom/phone_detection/daemon.pid
[2019-11-18 15:19:37][INFO][root](MainThread) : Create phone_detection daemon
[2019-11-18 15:19:37][DEBUG][root](MainThread) : Send to test to jeedom
[2019-11-18 15:19:37][DEBUG][root](MainThread) : Send to jeedom :  {'action': 'test'}
[2019-11-18 15:19:37][DEBUG] : id:
[2019-11-18 15:19:37][DEBUG][root](MainThread) : Status Code :  200
[2019-11-18 15:19:37][DEBUG][root](MainThread) : Jeedom reply :  {'success': True, 'value': 0}
[2019-11-18 15:19:37][INFO][root](MainThread) : Get devices from Jeedom
[2019-11-18 15:19:37][DEBUG][root](MainThread) : Send to jeedom :  {'action': 'get_devices'}
[2019-11-18 15:19:37][DEBUG] : id:
[2019-11-18 15:19:37][DEBUG][root](MainThread) : Status Code :  200
[2019-11-18 15:19:37][DEBUG][root](MainThread) : Jeedom reply :  {'success': True, 'value': {'53': {'humanName': '[Monitoring][TEL_Steph_GalaxyS7]', 'id': '53', 'lastValueDate': '2019-11-18 08:38:10', 'state': True, 'name': 'TEL_Steph_GalaxyS7', 'macAddress': '3C:BB:FD:6D:XX:XX'}}}
[2019-11-18 15:19:37][INFO] : Démon phone_detection lancé
[2019-11-18 15:20:40][DEBUG] : cmdId:refresh
[2019-11-18 15:20:40][DEBUG] : eqLogic Id:53
[2019-11-18 15:20:40][DEBUG] : mac address: 3C:BB:FD:6D:XX:XX
[2019-11-18 15:20:40][INFO] : BT Device: hci0
[2019-11-18 15:20:41][DEBUG] : device name: Samsung Galaxy S7 edge
[2019-11-18 15:20:41][DEBUG] : device state: 1
[2019-11-18 15:20:41][INFO] : updateGlobalDevice()
[2019-11-18 15:38:25][DEBUG] : cmdId:refresh
[2019-11-18 15:38:25][DEBUG] : eqLogic Id:53
[2019-11-18 15:38:25][DEBUG] : mac address: 3C:BB:FD:6D:XX:XX
[2019-11-18 15:38:25][INFO] : BT Device: hci0
[2019-11-18 15:38:30][DEBUG] : device name:
[2019-11-18 15:38:30][DEBUG] : device state: 0
[2019-11-18 15:38:30][INFO] : updateGlobalDevice()


le bluettoth de mon tel est coupé depuis plus d’1h et le plugin le voie tjrs « true »

Bonjour,

Ce soir en arrivant, plantage du plugin…


[2019-11-18 08:36:34][INFO][root](Thread-2) : Set "OnePlusPro 7 BT" phone absent
[2019-11-18 08:36:34][INFO] : updateGlobalDevice()
[2019-11-18 17:49:52][INFO][root](Thread-2) : Set OnePlusPro 7 BT's phone present
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:849: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
[2019-11-18 17:49:52][ERROR][root](Thread-2) : Error during update status

Après 30 minutes, statut toujours à 0
Redémarrage manuel qui donne une petite errreur coté apache

[Mon Nov 18 18:21:01.743066 2019] [php7:notice] [pid 19327] [client 127.0.0.1:32924] PHP Notice:  Undefined variable: success in /var/www/html/plugins/phone_detection/core/php/phone_detection.php on line 83

et qui boucle coté log du demon

[2019-11-18 17:49:52][ERROR][root](Thread-2) : Error during update status
[2019-11-18 18:21:00][INFO][root](MainThread) : =========== Shutdown ===========
[2019-11-18 18:21:00][INFO][root](MainThread) : Stopping all threads
[2019-11-18 18:21:00][INFO][root](MainThread) : 	==> OnePlusPro 7 BT
[2019-11-18 18:21:00][INFO][root](MainThread) : Stop thread detection for OnePlusPro 7 BT [40:01:C5:06:78:C1]
[2019-11-18 18:21:00][INFO][root](MainThread) : Shutting down local server
[2019-11-18 18:21:00][INFO][root](MainThread) : Removing Socket file /tmp/jeedom/phone_detection/daemon.sock
[2019-11-18 18:21:00][INFO][root](MainThread) : Removing PID file /tmp/jeedom/phone_detection/daemon.pid
[2019-11-18 18:21:00][INFO][root](MainThread) : Exit 0
[2019-11-18 18:21:00][INFO][root](MainThread) : =================================
Signal 15 caught, exiting...
[2019-11-18 18:21:01][INFO] : Lancement démon phone_detection : /usr/bin/python3 /var/www/html/plugins/phone_detection/core/class/../../resources/phone_detectiond/phone_detectiond.py  --device hci0 --loglevel info --apikey DtyeOsTi9wJUe12ZJ6TOxauGXRVKlqMN --pidfile /tmp/jeedom/phone_detection/daemon.pid --socket /tmp/jeedom/phone_detection/daemon.sock --callback http://127.0.0.1:80/plugins/phone_detection/core/php/phone_detection.php --interval 10 --present_interval 30 --absentThreshold 180
[2019-11-18 18:21:01][INFO][root](MainThread) : Start phone_detectiond
[2019-11-18 18:21:01][INFO][root](MainThread) : Log level : info
[2019-11-18 18:21:01][INFO][root](MainThread) : Socket : /tmp/jeedom/phone_detection/daemon.sock
[2019-11-18 18:21:01][INFO][root](MainThread) : PID file : /tmp/jeedom/phone_detection/daemon.pid
[2019-11-18 18:21:01][INFO][root](MainThread) : Device : hci0
[2019-11-18 18:21:01][INFO][root](MainThread) : Callback : http://127.0.0.1:80/plugins/phone_detection/core/php/phone_detection.php
[2019-11-18 18:21:01][INFO][root](MainThread) : Interval : 10
[2019-11-18 18:21:01][INFO][root](MainThread) : Present Interval : 30
[2019-11-18 18:21:01][INFO][root](MainThread) : AbsentThreshold: 180
[2019-11-18 18:21:01][INFO][root](MainThread) : Python version : 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.2.0]
[2019-11-18 18:21:01][INFO][root](MainThread) : Create phone_detection daemon
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:849: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
[2019-11-18 18:21:01][ERROR][root](MainThread) : Calling jeedom failed
[2019-11-18 18:21:06][ERROR] : Impossible de lancer le démon phone_detection, relancer le démon en debug et vérifiez la log
[2019-11-18 18:21:55][INFO] : BT Device: hci0
[2019-11-18 18:21:57][INFO] : updateGlobalDevice()
[2019-11-18 18:21:57][INFO] : BT Device: hci0
[2019-11-18 18:21:58][INFO] : updateGlobalDevice()
[2019-11-18 18:25:03][INFO] : Lancement démon phone_detection : /usr/bin/python3 /var/www/html/plugins/phone_detection/core/class/../../resources/phone_detectiond/phone_detectiond.py  --device hci0 --loglevel info --apikey DtyeOsTi9wJUe12ZJ6TOxauGXRVKlqMN --pidfile /tmp/jeedom/phone_detection/daemon.pid --socket /tmp/jeedom/phone_detection/daemon.sock --callback http://127.0.0.1:80/plugins/phone_detection/core/php/phone_detection.php --interval 10 --present_interval 30 --absentThreshold 180
[2019-11-18 18:25:04][INFO][root](MainThread) : Start phone_detectiond
[2019-11-18 18:25:04][INFO][root](MainThread) : Log level : info
[2019-11-18 18:25:04][INFO][root](MainThread) : Socket : /tmp/jeedom/phone_detection/daemon.sock
[2019-11-18 18:25:04][INFO][root](MainThread) : PID file : /tmp/jeedom/phone_detection/daemon.pid
[2019-11-18 18:25:04][INFO][root](MainThread) : Device : hci0
[2019-11-18 18:25:04][INFO][root](MainThread) : Callback : http://127.0.0.1:80/plugins/phone_detection/core/php/phone_detection.php
[2019-11-18 18:25:04][INFO][root](MainThread) : Interval : 10
[2019-11-18 18:25:04][INFO][root](MainThread) : Present Interval : 30
[2019-11-18 18:25:04][INFO][root](MainThread) : AbsentThreshold: 180
[2019-11-18 18:25:04][INFO][root](MainThread) : Python version : 3.7.3 (default, Apr  3 2019, 05:39:12) 
[GCC 8.2.0]
[2019-11-18 18:25:04][INFO][root](MainThread) : Create phone_detection daemon
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:849: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecureRequestWarning)
[2019-11-18 18:25:04][ERROR][root](MainThread) : Calling jeedom failed
[2019-11-18 18:25:04][INFO] : Démon phone_detection lancé

Allez, on doit pas être loin d’une solution définitive

Question d un novice: faut t il un adaptateur bluetooth sur le boitier ? ou bien c est different ?

Dans la mesure où il faut saisir la mac address bluetooth, tu voudrais que ça marche comment ?

Bonjour
Moi j’ai ça comme erreur.
Signal 15 caught, exiting…
Traceback (most recent call last):
File « /var/www/html/plugins/phone_detection/core/class/…/…/resources/phone_detectiond/phone_detectiond.py », line 396, in
DEVICES = jc.getDevices()
File « /var/www/html/plugins/phone_detection/core/class/…/…/resources/phone_detectiond/phone_detectiond.py », line 240, in getDevices
r[key].lastStateDate = datetime.fromisoformat(item[‹ lastValueDate ›])
AttributeError: type object ‹ datetime.datetime › has no attribute ‹ fromisoformat ›
Signal 15 caught, exiting…

Merci

Deuxième jour sans plantage, je l’utilise pour faire de la présence et il va très bien en plus mes 2 téléphones sont bien détectés…

1 « J'aime »

Bonjour à tous,

Merci pour vos retours.
Désolé, si je n’ai pas été très réactif ces derniers jours : j’ai eu beaucoup de boulot et peu de temps pour corriger et/ou faire évoluer le plugin.

En vrac :

  • L’erreur AttributeError: type object ‘datetime.datetime’ has no attribute ‘fromisoformat’ doit venir d’une dépendance Python manquante, je vais forcer son installation dans les dépendances
  • L’erreur [Mon Nov 18 18:21:01.743066 2019] [php7:notice] [pid 19327] [client 127.0.0.1:32924] PHP Notice: Undefined variable: success in /var/www/html/plugins/phone_detection/core/php/phone_detection.php on line 83 est incompréhensible : toutes les variables sont déclarées et initialisées

là, il y a quelque chose que je ne comprends pas : la log que tu partages montre bien la détection du téléphone (device state : 1 et affichage de son nom) puis une perte de connexion (device state : 0 et nom introuvable)… donc normalement, le démon fonctionne… je creuse pour trouver d’où ça vient

Côté nouvelles fonctionnalités, je vais essayer d’ajouter la détection de périphérique BLE (type montre/bracelet connecté)

Sébastien

2 « J'aime »

le problème est que le daemon ne tourne pas… mon dernier relevé dans les log date du 18/11/2019 15:38
pas de mise a jour…

Es-tu essayer de le relancer et de le mettre en automatique ?

voilà ma conf

Etonnant… et tu n’as rien dans les logs ?
Tu peux le relancer ?

Quelles versions utilises-tu ?

  • Jeedom
  • Debian
  • Python
  • php

@Sebastien_Ferrand
voilà ce que j’ai.
image


Log des dépendance du plugin

log apés redemarrage du daemon

Tout à l’air de démarrer correctement pourtant :thinking::face_with_raised_eyebrow:

si ca peut aider dans le log http.error

Thu Nov 21 16:21:16.191624 2019] [:error] [pid 23419] [client 127.0.0.1:38104] PHP Notice:  Undefined index: id in /var/www/html/plugins/phone_detection/core/php/phone_detection.php on line 15
[Thu Nov 21 16:21:16.221515 2019] [:error] [pid 20869] [client 127.0.0.1:38106] PHP Notice:  Undefined index: id in /var/www/html/plugins/phone_detection/core/php/phone_detection.php on line 15

et il est 17:36 et le log Phone_detection est tjrs a 16:21

Merci pour ton aide…

Je viens de fixer ce bug, normalement, ça devrait aller plus loin maintenant.
Bizarrement, avec PHP7.3, cette erreur ne remonte pas !

Sébastien

mise a jour faite… plus d’erreur dans http.error
mais le demon reste stoique…
mon tel est eteint depuis 30 min et il me voi tjr present depuis le 18… j’ai l’impression que le demon ne ce lance pas ni ne scan

[2019-11-21 16:21:16][DEBUG][root](MainThread) : Status Code :  200
[2019-11-21 16:21:16][DEBUG][root](MainThread) : Jeedom reply :  {'value': {'53': {'id': '53', 'name': 'TEL_Steph_GalaxyS7', 'state': True, 'humanName': '[Monitoring][TEL_Steph_GalaxyS7]', 'macAddress': '3C:BB:FD:6D:34:E6', 'lastValueDate': '2019-11-18 08:38:10'}}, 'success': True}
[2019-11-22 15:28:22][DEBUG] : Lancement de : /var/www/html/core/class/../../core/php/jeePlugin.php  plugin_id=phone_detection function=pre_update callInstallFunction=1
[2019-11-22 15:28:24][INFO] : Début d'activation du plugin
Traceback (most recent call last):
File "/var/www/html/plugins/phone_detection/core/class/../../resources/phone_detectiond/phone_detectiond.py", line 396, in <module>
DEVICES = jc.getDevices()
File "/var/www/html/plugins/phone_detection/core/class/../../resources/phone_detectiond/phone_detectiond.py", line 240, in getDevices
r[key].lastStateDate = datetime.fromisoformat(item['lastValueDate'])
AttributeError: type object 'datetime.datetime' has no attribute 'fromisoformat'
[2019-11-22 15:28:24][DEBUG][root](MainThread) : Signal 15 caught, exiting...
[2019-11-22 15:28:26][INFO][root](MainThread) : =========== Shutdown ===========
[2019-11-22 15:28:26][INFO][root](MainThread) : Stopping all threads
[2019-11-22 15:28:26][INFO][root](MainThread) : Shutting down local server
[2019-11-22 15:28:26][INFO][root](MainThread) : Removing Socket file /tmp/jeedom/phone_detection/daemon.sock
[2019-11-22 15:28:27][INFO][root](MainThread) : Removing PID file /tmp/jeedom/phone_detection/daemon.pid
[2019-11-22 15:28:27][INFO][root](MainThread) : Exit 0
[2019-11-22 15:28:27][INFO][root](MainThread) : =================================
Signal 15 caught, exiting...
[2019-11-22 15:28:28][INFO] : Info sur le démon : {"state":"nok","launchable":"ok","launchable_message":"Gestion automatique d\u00e9sactiv\u00e9e","log":"","auto":"0","last_launch":"2019-11-21 16:21:10"}
[2019-11-22 15:28:28][DEBUG] : Lancement de : /var/www/html/core/class/../../core/php/jeePlugin.php  plugin_id=phone_detection function=update callInstallFunction=1
[2019-11-22 15:29:04][INFO] : Lancement démon phone_detection : /usr/bin/python3 /var/www/html/plugins/phone_detection/core/class/../../resources/phone_detectiond/phone_detectiond.py  --device hci0 --loglevel debug --apikey qIcYq2Kw7ybq81X7SIWaHVCemt8ZeR4O --pidfile /tmp/jeedom/phone_detection/daemon.pid --socket /tmp/jeedom/phone_detection/daemon.sock --callback http://127.0.0.1:80/plugins/phone_detection/core/php/phone_detection.php --interval 10 --present_interval 30 --absentThreshold 60
[2019-11-22 15:29:06][INFO][root](MainThread) : Start phone_detectiond
[2019-11-22 15:29:06][INFO][root](MainThread) : Log level : debug
[2019-11-22 15:29:06][INFO][root](MainThread) : Socket : /tmp/jeedom/phone_detection/daemon.sock
[2019-11-22 15:29:06][INFO][root](MainThread) : PID file : /tmp/jeedom/phone_detection/daemon.pid
[2019-11-22 15:29:06][INFO][root](MainThread) : Device : hci0
[2019-11-22 15:29:06][INFO][root](MainThread) : Callback : http://127.0.0.1:80/plugins/phone_detection/core/php/phone_detection.php
[2019-11-22 15:29:06][INFO][root](MainThread) : Interval : 10
[2019-11-22 15:29:06][INFO][root](MainThread) : Present Interval : 30
[2019-11-22 15:29:06][INFO][root](MainThread) : AbsentThreshold: 60
[2019-11-22 15:29:06][INFO][root](MainThread) : Python version : 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516]
[2019-11-22 15:29:06][DEBUG][root](MainThread) : Writing PID 899 to /tmp/jeedom/phone_detection/daemon.pid
[2019-11-22 15:29:06][INFO][root](MainThread) : Create phone_detection daemon
[2019-11-22 15:29:06][DEBUG][root](MainThread) : Send to test to jeedom
[2019-11-22 15:29:06][DEBUG][root](MainThread) : Send to jeedom :  {'action': 'test'}
[2019-11-22 15:29:06][DEBUG][root](MainThread) : Status Code :  200
[2019-11-22 15:29:06][DEBUG][root](MainThread) : Jeedom reply :  {'value': 0, 'success': True}
[2019-11-22 15:29:06][INFO][root](MainThread) : Get devices from Jeedom
[2019-11-22 15:29:06][DEBUG][root](MainThread) : Send to jeedom :  {'action': 'get_devices'}
[2019-11-22 15:29:06][DEBUG][root](MainThread) : Status Code :  200
[2019-11-22 15:29:06][DEBUG][root](MainThread) : Jeedom reply :  {'value': {'53': {'id': '53', 'macAddress': '3C:BB:FD:6D:34:E6', 'state': True, 'humanName': '[Monitoring][TEL_Steph_GalaxyS7]', 'lastValueDate': '2019-11-18 08:38:10', 'name': 'TEL_Steph_GalaxyS7'}}, 'success': True}
[2019-11-22 15:29:06][INFO] : Démon phone_detection lancé
[2019-11-22 15:32:34][DEBUG] : cmdId:refresh
[2019-11-22 15:32:34][DEBUG] : eqLogic Id:53
[2019-11-22 15:32:34][DEBUG] : mac address: 3C:BB:FD:6D:34:E6
[2019-11-22 15:32:34][INFO] : BT Device: hci0
[2019-11-22 15:32:39][DEBUG] : device name:
[2019-11-22 15:32:39][DEBUG] : device state: 0
[2019-11-22 15:32:39][INFO] : updateGlobalDevice()

Bonjour
J’ai mis a jour, cela a fonctionner quelque minute et toujours la même erreur.
Traceback (most recent call last):
File « /var/www/html/plugins/phone_detection/core/class/…/…/resources/phone_detectiond/phone_detectiond.py », line 396, in
DEVICES = jc.getDevices()
File « /var/www/html/plugins/phone_detection/core/class/…/…/resources/phone_detectiond/phone_detectiond.py », line 240, in getDevices
r[key].lastStateDate = datetime.fromisoformat(item[‹ lastValueDate ›])
AttributeError: type object ‹ datetime.datetime › has no attribute ‹ fromisoformat ›
Signal 15 caught, exiting…

Merci
Loup

Bonjour,
Avez-vous vérifier la version de python utilisée?
Si j’ai bien suivi, @Sebastien_Ferrand développe sous buster (car PHP7.3), du coup je ne serais pas étonné qu’il soit sous python 3.7 ou même 3.8.
Donc à tout ceux ayant une soucis (@Loup, @coke) et @Sebastien_Ferrand, si vous pouviez vérifier la version installée chez vous (et donné la version de dedian aussi, ca peut être utile)
python3 --version

datetime.datetime. fromisoformat a été ajouté en 3.7 je pense.

La plupart des personnes sont encore sous stretch ou même moins;
au passage la version par défaut de python est 2.7 sous stretch mais j’ai vérifié le code et tu lances bien le démon avec python 3.

Par contre sous stretch, la dernière version de python disponible est la 3.5.3 si je ne me trompe pas et donc si tu veux être compatible avec stretch, tu ne devrais pas utiliser de méthode ajoutée après la 3.5.

@Sebastien_Ferrand

Il manque un $ à la ligne 374 de phone_detection/core/class/phone_detection.class.php

if (**$**deviceType == 'GlobalGroup') {

Pour ma part, ça marche bien sinon !

Très bonne remarque, je vais donc corriger ça pour être compatible python 3.5.

Bien vu, je corrige !

Sébastien

1 « J'aime »