Plugins Python

Forum dédié aux problématiques concernant les scripts pour DomoticZ.
Entourez votre code et les logs avec les balises nommées code grâce au bouton <\>.
ziaziung
Messages : 183
Inscription : 13 févr. 2015, 14:04

Plugins Python

Message par ziaziung »

Bonjour à tous.

J'ai installé deux plugins Python : Domoticz-TUYA-Plugin et PluginDomoticzFreebox.
Je vois bien les repertoires :

Code : Tout sélectionner

pi@raspberrypi:~/domoticz/plugins $ ls
AwoxSMP  Domoticz-TUYA-Plugin  examples  PluginDomoticzFreebox
dans chaque repertoire les fichiers sont executables :

Code : Tout sélectionner

pi@raspberrypi:~/domoticz/plugins/Domoticz-TUYA-Plugin $ ls -al
total 44
drwxr-xr-x 4 pi pi  4096 mai    3 15:29 .
drwxr-xr-x 6 pi pi  4096 mai    3 18:34 ..
-rwxr-xr-x 1 pi pi    81 mai    3 15:29 fakeDomoticz.py
drwxr-xr-x 8 pi pi  4096 mai    3 15:29 .git
-rwxr-xr-x 1 pi pi 16775 mai    3 15:29 plugin.py
-rw-r--r-- 1 pi pi  3068 mai    3 15:29 README.md
drwxr-xr-x 2 pi pi  4096 mai    3 15:29 tools

pi@raspberrypi:~/domoticz/plugins/PluginDomoticzFreebox $ ls -al
total 56
drwxr-xr-x 3 pi pi  4096 mai    3 18:34 .
drwxr-xr-x 6 pi pi  4096 mai    3 18:34 ..
-rwxr-xr-x 1 pi pi 10772 mai    3 18:34 freebox.py
drwxr-xr-x 8 pi pi  4096 mai    3 18:34 .git
-rw-r--r-- 1 pi pi  1157 mai    3 18:34 .gitignore
-rwxr-xr-x 1 pi pi 16425 mai    3 18:34 plugin.py
-rw-r--r-- 1 pi pi  5235 mai    3 18:34 README.md



Une fois redémarré le raspi je ne vois rien dans les logs!!!!

Code : Tout sélectionner


    Tout
    Statut
    Erreur

	Filtre: X
2021-05-03 18:40:40.954 Status: Domoticz V4.10761 (c)2012-2019 GizMoCuz
2021-05-03 18:40:40.957 Status: Build Hash: ca1256bf, Date: 2019-05-15 16:24:19
2021-05-03 18:40:40.966 Status: Startup Path: /home/pi/domoticz/
2021-05-03 18:40:42.215 Sunrise: 06:39:00 SunSet: 20:59:00
2021-05-03 18:40:42.215 Day length: 14:20:00 Sun at south: 13:49:00
2021-05-03 18:40:42.215 Civil twilight start: 06:06:00 Civil twilight end: 21:31:00
2021-05-03 18:40:42.215 Nautical twilight start: 05:26:00 Nautical twilight end: 22:11:00
2021-05-03 18:40:42.215 Astronomical twilight start: 04:41:00 Astronomical twilight end: 22:57:00
2021-05-03 18:40:43.684 Active notification Subsystems: email, http, pushbullet, telegram (4/13)
2021-05-03 18:40:43.843 Starting shared server on: :::6144
2021-05-03 18:40:43.533 Status: PluginSystem: Started, Python version '3.4.2'.
2021-05-03 18:40:43.720 Status: WebServer(HTTP) started on address: :: with port 8080
2021-05-03 18:40:43.811 Status: WebServer(SSL) started on address: :: with port 443
2021-05-03 18:40:43.857 Status: TCPServer: shared server started...
2021-05-03 18:40:43.857 Status: RxQueue: queue worker started...
2021-05-03 18:40:45.863 Status: Hardware Monitor: Started
2021-05-03 18:40:45.950 Status: AppLamp: Worker Started...
2021-05-03 18:40:45.952 Status: EventSystem: reset all events...
2021-05-03 18:40:45.954 Status: Darksky: Started...
2021-05-03 18:40:45.954 Status: RFXCOM: Worker started...
2021-05-03 18:40:45.954 Status: Wunderground: Worker started...
2021-05-03 18:40:46.000 Status: EventSystem: reset all device statuses...
2021-05-03 18:40:46.357 Status: PluginSystem: Entering work loop.
2021-05-03 18:40:46.508 Status: Python EventSystem: Initalizing event module.
2021-05-03 18:40:46.511 Status: EventSystem: Queue thread started...
2021-05-03 18:40:46.511 Status: EventSystem: Started
2021-05-03 18:40:46.960 Status: RFXCOM: Using serial port: /dev/ttyUSB0
2021-05-03 18:40:47.537
2021-05-03 18:40:47.198 Status: AppLamp: Bridge found!... 
On dirait que Python ne vois rien de ces plugins!
Une idée?
Raspi B+ et 2. RfxcomE. Volets Somfy. Sondes de température "AliExpress". Domoticz version 4.10761
Neutrino
Messages : 2662
Inscription : 10 juil. 2015, 15:42
Localisation : Les Herbiers(85)

Re: Plugins Python

Message par Neutrino »

Tu les as ajoutés dans 'Matériel' ?
Ma maison à plein d'IP ! :mrgreen:
SAV Bonjour. Vous avez vidé le cache ?
ziaziung
Messages : 183
Inscription : 13 févr. 2015, 14:04

Re: Plugins Python

Message par ziaziung »

Heu...... ;) non. Merci.

C'est fait.
Par contre voila ce que j'obtiens dans le log :

Code : Tout sélectionner


2021-05-03 20:57:07.941 Error: (tuya) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/Domoticz-TUYA-Plugin/:/usr/lib/python3.4/:/usr/lib/python3.4/plat-arm-linux-gnueabihf:/usr/lib/python3.4/lib-dynload:/usr/local/lib/python3.4/dist-packages:/usr/lib/python3/dist-packages:/usr/lib/python3.4/dist-packages:/usr/lib/dist-python'.
2021-05-03 20:57:07.941 Error: (TuyaPlug) Module Import failed, exception: 'SyntaxError'
2021-05-03 20:57:07.941 Error: (TuyaPlug) Import detail: File: /usr/local/lib/python3.4/dist-packages/tuyaha/tuyaapi.py, Line: 69, offset: 87
2021-05-03 20:57:07.941 Error: (TuyaPlug) Error Line ' f"Discovery interval below {MIN_DISCOVERY_INTERVAL} seconds is invalid"
2021-05-03 20:57:07.941 ' 
Une idée?
Raspi B+ et 2. RfxcomE. Volets Somfy. Sondes de température "AliExpress". Domoticz version 4.10761
Keros
Messages : 6638
Inscription : 23 juil. 2019, 20:57

Re: Plugins Python

Message par Keros »

La première ligne d'erreur indique un problème de librairie avec python 3.4. Est-ce que tu as python 3.4 d'installer ?
Comment bien utiliser le forum : Poser une question, Mettre un script, un fichier, une image ou des logs
Mes petits guides : Débuter en programmation, Le débogage, Le choix de matériel, Les sauvegardes
Ma présentation - Mes Tutos
ziaziung
Messages : 183
Inscription : 13 févr. 2015, 14:04

Re: Plugins Python

Message par ziaziung »

En fait je m'y perd. En verifiant ma version de Python, voila ce que je trouve :

Code : Tout sélectionner

pi@raspberrypi:~ $ python -V
Python 2.7.9
pi@raspberrypi:~ $ python3 -V
Python 3.4.2
pi@raspberrypi:~ $ 
J'aurai deux Pythons dans ma fraise :roll: !!!? A priori ce n'est pas un problème.
Raspi B+ et 2. RfxcomE. Volets Somfy. Sondes de température "AliExpress". Domoticz version 4.10761
Neutrino
Messages : 2662
Inscription : 10 juil. 2015, 15:42
Localisation : Les Herbiers(85)

Re: Plugins Python

Message par Neutrino »

une version 2 et une version 3, c'est normal.
Tu as bien fait cette manip ?

Code : Tout sélectionner

sudo pip3 install tuyaha requests
Ma maison à plein d'IP ! :mrgreen:
SAV Bonjour. Vous avez vidé le cache ?
ziaziung
Messages : 183
Inscription : 13 févr. 2015, 14:04

Re: Plugins Python

Message par ziaziung »

Oui, oui.
J'ai l'impression que cela s'est bien passé.
Raspi B+ et 2. RfxcomE. Volets Somfy. Sondes de température "AliExpress". Domoticz version 4.10761
Thorgal
Messages : 913
Inscription : 16 août 2018, 20:02
Contact :

Re: Plugins Python

Message par Thorgal »

C'est la ou j'ai un doute

Code : Tout sélectionner

2021-05-03 20:57:07.941 Error: (TuyaPlug) Import detail: File: /usr/local/lib/python3.4/dist-packages/tuyaha/tuyaapi.py,
Or justement le plugin a son propre repertoire avec la lib tuyaha, peut etre une version speciale cf https://github.com/guino/tuyaha
ziaziung
Messages : 183
Inscription : 13 févr. 2015, 14:04

Re: Plugins Python

Message par ziaziung »

Merci pour l'aide.
Je vais retenter l'installation via git dans le repertoire plugin de domoticz de tuyaha après avoir viré les autres repertoires contenant les autres plugin tuya et redémarré.
Je vous donne le résultat.

Le résultat :
* avec le plugin "Guino" mon identifiant et mot de passe sont reconnus. Le plugin Tuya démarre (je le vois dans les logs). Et après c'est le drame : domoticz me dit que je n'est p;lus de matériel, plus de dispositif plus d'interrupteur. Puis Domoticz ne fait plus rien : planté!

* avec le plugin "Xenomes" : Domoticz ne plante pas mais le plugin ne demarre pas (les logs sont ceux que j'ai donné plus haut).

Au final, j'ai restauré un backup récent.
Raspi B+ et 2. RfxcomE. Volets Somfy. Sondes de température "AliExpress". Domoticz version 4.10761
Répondre