Emporia Energy rencontre Jeedom... le tuto

C’est exactement l’approche du script. Et la méthode utilisée pour le plugin home-assistant.
J’avais commencé à m’appuyer dessus: il est open source et bien documenté.

Ainsi que

Hello
Je viens de créer un post dans le plugin script pour le même souci que les informations citées ci-dessus n’ont pas résolu.
Je le reposte ici au cas où l’un d’entre vous saurait quoi faire pour mon cas

Je suis en train de passer mon installation Jeedom depuis une machine physique NUC sur Debian 10 vers un Jeedom Debian 11 sur Proxmox (aussi sur un NUC Intel).
J’ai un script qui s’exécute normalement sur la machine en v10 mais se plante sur la machine en v11 avec le message :

Erreur sur /var/www/html/plugins/script/data/PyEmVue/PyEmVue.PY 2>&1 valeur retournée : 127. Détails : sh: 1: /var/www/html/plugins/script/data/PyEmVue/PyEmVue.PY: not found

Bien entendu, j’ai vérifié que PyEmVue.PY existait bien dans le répertoire spécifié. J’ai même recréé le script en allant chercher le .PY dans son répertoire.
Quand je lance le script en ligne de commande depuis son répertoire avec python3 PyEmVue.PY, en root, il s’exécute sans souci.
Quand je le lance avec mon utilisateur Debian, il se plante :

Traceback (most recent call last):
  File "/var/www/html/plugins/script/data/PyEmVue/PyEmVue.PY", line 34, in <module>
    vue.login(username=user, password=passuser, token_storage_file=token)
  File "/usr/local/lib/python3.9/dist-packages/pyemvue/pyemvue.py", line 207, in login
    self.auth = Auth(
  File "/usr/local/lib/python3.9/dist-packages/pyemvue/auth.py", line 51, in __init__
    self.tokens = self.refresh_tokens()
  File "/usr/local/lib/python3.9/dist-packages/pyemvue/auth.py", line 59, in refresh_tokens
    self.token_updater(tokens)
  File "/usr/local/lib/python3.9/dist-packages/pyemvue/pyemvue.py", line 231, in _store_tokens
    with open(self.token_storage_file, 'w') as f:
PermissionError: [Errno 13] Permission denied: 'keys.json'

J’ai essayé de renommer le keys.json pour qu’il en génère un autre, mais même log.
J’ai essayé de donner les droits (je comprends qu’il ne faut jamais faire ça, mais…) avec des chmod 766 sur les fichiers du répertoire (et le répertoire lui même), mais même chose.
Vu que c’est le même compte et mdp qui sont définis en début de script pour se connecter, et les mêmes que sur Debian 10 où ça fonctionne pour tous les utilisateurs, je pense que c’est un problème de droits, ou alors un changement entre debian 10 et 11 (j’ai cru voir que c’est Python 3.9 en Debian 11 et que c’était 3.7 en 10)
Je suis hélas totalement incompétent en Linux, tout ce que je sais faire c’est de copier sans jamais vraiment les comprendre des commandes données d’un forum à l’autre.

Ensuite dans l’autre post, je passais tout le script, mais tous ceux qui me liront ici le connaissent. Bien sûr, j’ai remplacé #!/usr/bin/pyrgon3.7 par 3.9, je ne sais pas à quoi ça sert, dans ma compréhension la ligne n’est qu’un commentaire.

J’ai même essayé de refaire toute l’install du script et des dépendances, pour un résultat pire qui m’a obligé à restaurer un snapshot.
SI quelqu’un peut être assez sympa pour m’aider. C’est le dernier truc qui me manque pour migrer sur la nouvelle machine. J’enrage de ne pas trouver.
Merci beaucoup

Le plugin emporiapro va être disponible en version beta semaine prochaine. Il permettra de récupérer automatiquement tous les capteurs (plus total & balance) avec les noms définis sur chaque capteur.

Il n’y a actuellement qu’une seule commande pour chaque équipement (capteur) indiquant la consommation de la minute précédente. Cette consommation est calculé à t+30s.
J’ajouterai dans quelques jours les consommations suivantes : heure, jour, semaine, mois, année
Ces consommations seront mis à jour toutes les 5 minutes.

@YODA69 @geraldelbaze : seriez-vous prêt à tester le plugin en beta ?

2 « J'aime »

Bonsoir.
Ok pour moi.

@thanaus dispo aussi si besoin

Je détecte quelques incohérences quand je demande en temps réel la consommation sur l’heure en cours :frowning:
Idem pour ce qui concerne la consommation chaque minute ou je récupère (quelque fois) la valeur de la minute t-2 au lieu de la minute précédente.

Voici un exemple de la consommation horaire total (requête chaque minute) :

On voit sur ce graphique ce type d’incohérence (tranche horaire de 8h à 9h par exemple) ou il y a une valeur inférieure à la valeur précédente… ce qui n’est pas tout à fait normal car normalement cumulatif.

J’investigue :wink:

salut. je peux le trouver où en version beta ? je viens d’aller sur le market, je ne le vois pas…

Il n’est toujours pas sur le market… car j’investigue le problème des valeurs quelques peu incohérentes.
Si je ne trouve rien d’ici ce soir, je le publie en beta mais les valeurs ne seront que temps réel à l’instant T

OK pour moi aussi

Hello,

Pour information, le plugin est en beta sur le market…
Il reste du taf sur la gestion des erreurs dans le daemon lorsqu’on interroge l’API Emporia mais globalement c’est fonctionnel.

Il n’y a actuellement qu’une seule commande par équipement qui indique la consommation électrique chaque minute.
Il y aura bien sur des évolutions de prévu pour avoir les autres types de consommation (journée, semaine, mois, année)

Merci de vos retours :wink:

Mis en place rapidement !

Au top rien à signaler pour l’instant.

Merci pour le travail.

N’hesite pas à me faire des retours !
Pour information, je vais faire quelques évolutions cette semaine pour stabiliser le daemon en cas d’erreur.

J’ai eu cette erreur dans le log emporiapro

[2023-05-04 14:57:17]ERROR : Exception while updating Emporia Vue channels (err= unsupported operand type(s) for *: 'NoneType' and 'int')

Depuis pas de remontée d’info. J’ai redémarré le demon et recliqué sur sauvegarder pour la partie configuration.

Je te met le log emporiapro_packages, j’ai vu des warning je ne sais pas si c’est important :

+ echo '*******************Begin of package installation******************'
*******************Begin of package installation******************
+ touch /tmp/jeedom_install_in_progress_emporiapro
+ echo 1
+ echo 2
++ cut -f 2-
++ awk '$1 <= 4'
++ find /usr/local/lib/python2.7/dist-packages/ /usr/local/lib/python3.7/dist-packages/ -mindepth 1 -maxdepth 1 -type d -exec du -ks '{}' +
+ RESULTTODELETE=
++ sed 's, ,\ ,g'
++ echo ''
+ RESULTTODELETE2=
+ echo ''
+ xargs rm -rf
+ echo 3
+ sudo pip3 cache purge
Files removed: 242
+ echo 4
+ sudo pip3 install --upgrade pip
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pip in /usr/local/lib/python3.7/dist-packages (22.3.1)
Collecting pip
Downloading https://www.piwheels.org/simple/pip/pip-23.1.2-py3-none-any.whl (2.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 4.2 MB/s eta 0:00:00
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 22.3.1
Uninstalling pip-22.3.1:
Successfully uninstalled pip-22.3.1
Successfully installed pip-23.1.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
+ echo 5
+ sudo pip3 install --force-reinstall --upgrade pyemvue
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyemvue
Downloading https://www.piwheels.org/simple/pyemvue/pyemvue-0.15.1-py3-none-any.whl (10 kB)
Collecting pycognito (from pyemvue)
Downloading https://www.piwheels.org/simple/pycognito/pycognito-2022.12.0-py3-none-any.whl (24 kB)
Collecting python-dateutil (from pyemvue)
Downloading https://www.piwheels.org/simple/python-dateutil/python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 kB 3.7 MB/s eta 0:00:00
Collecting requests (from pyemvue)
Downloading https://www.piwheels.org/simple/requests/requests-2.29.0-py3-none-any.whl (62 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.5/62.5 kB 3.5 MB/s eta 0:00:00
Collecting boto3>=1.10.49 (from pycognito->pyemvue)
Downloading https://www.piwheels.org/simple/boto3/boto3-1.26.124-py3-none-any.whl (132 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 132.9/132.9 kB 1.9 MB/s eta 0:00:00
Collecting envs>=1.3 (from pycognito->pyemvue)
Downloading https://www.piwheels.org/simple/envs/envs-1.4-py3-none-any.whl (10 kB)
Collecting python-jose[cryptography]>=3.2.0 (from pycognito->pyemvue)
Downloading https://www.piwheels.org/simple/python-jose/python_jose-3.3.0-py2.py3-none-any.whl (33 kB)
Collecting charset-normalizer<4,>=2 (from requests->pyemvue)
Downloading charset_normalizer-3.1.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (167 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 167.5/167.5 kB 2.7 MB/s eta 0:00:00
Collecting idna<4,>=2.5 (from requests->pyemvue)
Downloading https://www.piwheels.org/simple/idna/idna-3.4-py3-none-any.whl (61 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 61.5/61.5 kB 1.3 MB/s eta 0:00:00
Collecting urllib3<1.27,>=1.21.1 (from requests->pyemvue)
Downloading https://www.piwheels.org/simple/urllib3/urllib3-1.26.15-py2.py3-none-any.whl (140 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 140.9/140.9 kB 1.3 MB/s eta 0:00:00
Collecting certifi>=2017.4.17 (from requests->pyemvue)
Downloading https://www.piwheels.org/simple/certifi/certifi-2022.12.7-py3-none-any.whl (155 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 155.2/155.2 kB 1.7 MB/s eta 0:00:00
Collecting six>=1.5 (from python-dateutil->pyemvue)
Downloading https://www.piwheels.org/simple/six/six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting botocore<1.30.0,>=1.29.124 (from boto3>=1.10.49->pycognito->pyemvue)
Downloading https://www.piwheels.org/simple/botocore/botocore-1.29.124-py3-none-any.whl (10.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.7/10.7 MB 5.9 MB/s eta 0:00:00
Collecting jmespath<2.0.0,>=0.7.1 (from boto3>=1.10.49->pycognito->pyemvue)
Downloading https://www.piwheels.org/simple/jmespath/jmespath-1.0.1-py3-none-any.whl (20 kB)
Collecting s3transfer<0.7.0,>=0.6.0 (from boto3>=1.10.49->pycognito->pyemvue)
Downloading https://www.piwheels.org/simple/s3transfer/s3transfer-0.6.0-py3-none-any.whl (79 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.6/79.6 kB 4.1 MB/s eta 0:00:00
Collecting ecdsa!=0.15 (from python-jose[cryptography]>=3.2.0->pycognito->pyemvue)
Downloading https://www.piwheels.org/simple/ecdsa/ecdsa-0.18.0-py2.py3-none-any.whl (142 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 142.9/142.9 kB 3.9 MB/s eta 0:00:00
Collecting rsa (from python-jose[cryptography]>=3.2.0->pycognito->pyemvue)
Downloading rsa-4.9-py3-none-any.whl (34 kB)
Collecting pyasn1 (from python-jose[cryptography]>=3.2.0->pycognito->pyemvue)
Downloading https://www.piwheels.org/simple/pyasn1/pyasn1-0.5.0-py2.py3-none-any.whl (83 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 83.9/83.9 kB 2.1 MB/s eta 0:00:00
Collecting cryptography>=3.4.0 (from python-jose[cryptography]>=3.2.0->pycognito->pyemvue)
Downloading cryptography-40.0.2-cp36-abi3-manylinux_2_28_aarch64.whl (3.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.5/3.5 MB 10.0 MB/s eta 0:00:00
Collecting cffi>=1.12 (from cryptography>=3.4.0->python-jose[cryptography]>=3.2.0->pycognito->pyemvue)
Downloading cffi-1.15.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (435 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 435.6/435.6 kB 8.9 MB/s eta 0:00:00
Collecting pycparser (from cffi>=1.12->cryptography>=3.4.0->python-jose[cryptography]>=3.2.0->pycognito->pyemvue)
Downloading https://www.piwheels.org/simple/pycparser/pycparser-2.21-py2.py3-none-any.whl (119 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 119.7/119.7 kB 1.2 MB/s eta 0:00:00
Installing collected packages: urllib3, six, pycparser, pyasn1, jmespath, idna, envs, charset-normalizer, certifi, rsa, requests, python-dateutil, ecdsa, cffi, python-jose, cryptography, botocore, s3transfer, boto3, pycognito, pyemvue
Attempting uninstall: urllib3
Found existing installation: urllib3 1.26.13
Uninstalling urllib3-1.26.13:
Successfully uninstalled urllib3-1.26.13
Attempting uninstall: six
Found existing installation: six 1.16.0
Uninstalling six-1.16.0:
Successfully uninstalled six-1.16.0
Attempting uninstall: pycparser
Found existing installation: pycparser 2.20
Uninstalling pycparser-2.20:
Successfully uninstalled pycparser-2.20
Attempting uninstall: pyasn1
Found existing installation: pyasn1 0.4.8
Uninstalling pyasn1-0.4.8:
Successfully uninstalled pyasn1-0.4.8
Attempting uninstall: jmespath
Found existing installation: jmespath 1.0.1
Uninstalling jmespath-1.0.1:
Successfully uninstalled jmespath-1.0.1
Attempting uninstall: idna
Found existing installation: idna 3.4
Uninstalling idna-3.4:
Successfully uninstalled idna-3.4
Attempting uninstall: envs
Found existing installation: envs 1.4
Uninstalling envs-1.4:
Successfully uninstalled envs-1.4
Attempting uninstall: charset-normalizer
Found existing installation: charset-normalizer 2.0.12
Uninstalling charset-normalizer-2.0.12:
Successfully uninstalled charset-normalizer-2.0.12
Attempting uninstall: certifi
Found existing installation: certifi 2021.10.8
Uninstalling certifi-2021.10.8:
Successfully uninstalled certifi-2021.10.8
Attempting uninstall: rsa
Found existing installation: rsa 4.9
Uninstalling rsa-4.9:
Successfully uninstalled rsa-4.9
Attempting uninstall: requests
Found existing installation: requests 2.28.1
Uninstalling requests-2.28.1:
Successfully uninstalled requests-2.28.1
Attempting uninstall: python-dateutil
Found existing installation: python-dateutil 2.8.2
Uninstalling python-dateutil-2.8.2:
Successfully uninstalled python-dateutil-2.8.2
Attempting uninstall: ecdsa
Found existing installation: ecdsa 0.18.0
Uninstalling ecdsa-0.18.0:
Successfully uninstalled ecdsa-0.18.0
Attempting uninstall: cffi
Found existing installation: cffi 1.14.6
Uninstalling cffi-1.14.6:
Successfully uninstalled cffi-1.14.6
Attempting uninstall: python-jose
Found existing installation: python-jose 3.3.0
Uninstalling python-jose-3.3.0:
Successfully uninstalled python-jose-3.3.0
Attempting uninstall: cryptography
Found existing installation: cryptography 2.6.1
Uninstalling cryptography-2.6.1:
Successfully uninstalled cryptography-2.6.1
Attempting uninstall: botocore
Found existing installation: botocore 1.29.37
Uninstalling botocore-1.29.37:
Successfully uninstalled botocore-1.29.37
Attempting uninstall: s3transfer
Found existing installation: s3transfer 0.6.0
Uninstalling s3transfer-0.6.0:
Successfully uninstalled s3transfer-0.6.0
Attempting uninstall: boto3
Found existing installation: boto3 1.26.37
Uninstalling boto3-1.26.37:
Successfully uninstalled boto3-1.26.37
Attempting uninstall: pycognito
Found existing installation: pycognito 2022.11.2
Uninstalling pycognito-2022.11.2:
Successfully uninstalled pycognito-2022.11.2
Attempting uninstall: pyemvue
Found existing installation: pyemvue 0.15.1
Uninstalling pyemvue-0.15.1:
Successfully uninstalled pyemvue-0.15.1
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
aiohttp 3.8.3 requires charset-normalizer<3.0,>=2.0, but you have charset-normalizer 3.1.0 which is incompatible.
Successfully installed boto3-1.26.124 botocore-1.29.124 certifi-2022.12.7 cffi-1.15.1 charset-normalizer-2.0.7 cryptography-38.0.4 ecdsa-0.18.0 envs-1.4 idna-3.4 jmespath-1.0.1 pyasn1-0.5.0 pycognito-2022.12.0 pycparser-2.21 pyemvue-0.15.1 python-dateutil-2.8.2 python-jose-3.3.0 requests-2.29.0 rsa-4.9 s3transfer-0.6.0 six-1.16.0 urllib3-1.26.15
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
+ echo 6
+ php /var/www/html/core/class/../php/jeecli.php plugin dependancy_end emporiapro
+ rm /tmp/jeedom_install_in_progress_emporiapro
+ echo '*******************End of package installation******************'
*******************End of package installation******************

Intéressant car Emporia retourne la valeur ‹ None › au lieu d’un chiffre pour la consommation…
Je vais ajouter un test pour ne plus avoir cette erreur.

En redémarrant le daemon, tu devrais avoir de nouveau les données… Exact ?

Tout est ok pour ma part… et le warning est tout à fait normal

Oui une fois redémarré les données remontent ensuite.

Merci pour tous ces retours en tous les cas… car permet de stabiliser le plugin :wink:

Et les autres membres qui ont participé à ce topic ?

bonjour,
comment installer le plugin beta ? jamais fait auparavant…
sinon je veux bien tester.

Bonjour,

il faut se connecter sur le market : Jeedom Market

et activer dans votre page de profil :

Nouvelle version beta du plugin pour une meilleure gestion des erreurs par l’API Emporia
N’hésitez pas à me faire des retours

Je vois que ce sujet déchaîne les foules :wink:
Pour information, mise à jour de la documentation et je vais demander un passage en stable semaine prochaine.

https://thanaus.github.io/jeedom_docs/plugins/emporiapro/fr_FR/