Passage V5 a V7 NOK , perte info

Bonjour,

Avec tout le travail fait par cddu33, a-t-on un espoir de voir l’authentification du plugin fonctionner en V7?

Peut-être dans un premier temps, juste en fournissant le token dans la config du plugin…

Ca ne semble pas très compliqué de faire une requête sur https://envoy/auth/check_jwt pour l’authentification , puis d’appeler l’API avec le bearer …

Je peux fournir un accès à mon boitier pour tester si nécessaire…

Slt, alors c’est un peu plus tordu que ça,
J’ai l’impression que Il y a aussi un cookies

Oui, apparemment il y a un cookie « sessionid ».

J’ai fait un test rapide en PowerShell (désolé je maitrise peu le PHP)…

Ça passe facilement…

$Token = ConvertTo-SecureString -AsPlainText -Force -String 'eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhdWQiOiIxMjIyMjUwNjIxMzciLCJpc3MiOiJFbnRyZXoiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNjkzNDYzNjUyLCJpYXQiOjE2NjE5Mjc2NTIsImp0aSI6IjA2NDRmOTEyLWViMDAtNDIwYy1iNDE0LTc3OWlvdC5jb20ifQ.id1SuJYuXwovpFGhpVR8nRq9ZbX4u6ZuN1s1pud3IhXiya1YV86wwcx_tyr6e06JhqeoIWNQbBaBfjbAkkQzlw'
Invoke-WebRequest 'https://envoy/auth/check_jwt' -SkipCertificateCheck -Authentication Bearer -Token $Token -SessionVariable Session
Invoke-WebRequest 'https://envoy/production.json?details=1' -SkipCertificateCheck -WebSession $Session

Je vais voir si on peut se passer du contexte de session locale, en passant explicitement le cookie.

Oui…
On peut simplement mettre dans le header les cookies renvoyés par l’authentification… ça passe.

$Token = ConvertTo-SecureString -AsPlainText -Force -String 'eyJraWQiOiI3ZDEwMDA1ZC03ODk5LTRkMGQtYmNiNC0yNDRmOThlZTE1NmIiLCJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NioiLCJlbnBoYXNlVXNlciI6Im93bmVyIiwiZXhwIjoxNjkzNDYzNjUyLCJpYXQiOjE2NjE5Mjc2NTIsImp0aSI6IjA2NDRmOTEyLWViMDAtNDIwYy1iNDE0LTc3OWNkRlbGlvdC5jb20ifQ.id1SuJYuXwovpFGhpVR8nRq9ZbX4u6ZuN1s1pud3IhXiya1YV86wwcx_tyr6e06JhqeoIWNQbBaBfjbAkkQzlw'
$Auth = Invoke-WebRequest 'https://envoy/auth/check_jwt' -SkipCertificateCheck -Authentication Bearer -Token $Token 
Invoke-WebRequest 'https://envoy/production.json?details=1' -SkipCertificateCheck -Headers @{Cookie=[String]$Auth.Headers["Set-Cookie"]}
1 « J'aime »

Il existe déjà un script en powershell sur git
Comme en python mais pas en php.

J’utilise pour mon plugin du python qui est plus facilement intégrable a jeedom

Ma version bêta évite justement de se loguer sur enphase et ne le fait que quand le token a expirée.
J’ai proposer la stable a jeedom mais toujours pas de validation.

Apres Mon plugin est totalement intégrable au plugin Officiel…

Bon… En PHP c’est un peu plus verbeux… mais pas forcément plus compliqué:

$token="eyJraWQiOiI3ZDE...";

$handler = curl_init();
curl_setopt($handler, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($handler, CURLOPT_URL, "https://envoy/auth/check_jwt");

//Disable certificate checking
curl_setopt($handler, CURLOPT_SSL_VERIFYSTATUS, false);
curl_setopt($handler, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($handler, CURLOPT_SSL_VERIFYPEER, false);

//Keep cookie in memory
curl_setopt($handler, CURLOPT_COOKIEFILE, "");
curl_setopt($handler, CURLOPT_COOKIEJAR, "");

//Put the token to Bearer header
$headers=[];
$headers[]="Authorization: Bearer ".$token;
curl_setopt($handler, CURLOPT_HTTPHEADER, $headers);

//Run the authentication query
curl_exec($handler);

//Get the cookie
foreach(curl_getinfo($handler, CURLINFO_COOKIELIST) as $cookie_line)
curl_close($handler);


$handler = curl_init();


curl_setopt($handler, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($handler, CURLOPT_URL, "https://envoy/production.json?details=1");

//Disable certificate checking
curl_setopt($handler, CURLOPT_SSL_VERIFYSTATUS, false);
curl_setopt($handler, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($handler, CURLOPT_SSL_VERIFYPEER, false);

//Keep cookie in memory
curl_setopt($handler, CURLOPT_COOKIEFILE, "");
curl_setopt($handler, CURLOPT_COOKIEJAR, "");

//Push the cokkie includingthe SessionID
curl_setopt($handler, CURLOPT_COOKIELIST, $cookie_line);

//Run the production query
$response = curl_exec($handler);
var_dump($response);

curl_close($handler);

Tu l’as testé ?
Il manque la partie récupération du token.

Oui… développé, testé et validé par mes soins… Ça marche très bien…

Pour le Token, je le récupère manuellement…
Celui que j’utilise pour mes tests, je l’ai généré il y a plusieurs semaines…

Beau boulot
Je ne m’étais pas trop penché sur le php car je voulais mettre en place un démon pour descendre sous la minute de rafraîchissement.
Donc le python est plus facile car documenté chez Jeedom dans la Doc

par contre tu dis ne pas avoir changé de token depuis longtemps,

actuellement avec la méthode que j’utilise sur mon plugin sa durée est de 12h environ… j’avais crus voir passé sur internet une méthode pour avoir un token sur du plus long terme mais j’ai oublié ou

Je n’ai aucune idée de la politique d’expiration de token…

J’ai demandé un token ici https://entrez.enphaseenergy.com/ fin aout… et c’est ce token que j’utilise dans tous mes tests depuis.

Il y a peut-être une notion de nombre d’appel…

A chaque fois, je le met dans le formulaire lors de connexion locales, ou une appel à https://envoy/auth/check_jwt

Je n’utilise pas le cookie de session très longtemps.
Je refait un appel avec le token à chaque tests…

dac , en soit ce n’est pas un soucis vu que c’est automatisé mais bon, moins ya d’appel extérieur mieux c’est je trouve ^^

j’ai trouvé la réponse

les jetons pour les propriétaires de systèmes sont valables 6 mois et présentent donc des inconvénients et un risque extrêmement faibles qu’un jeton expire pendant une panne prolongée. Si vous recevez un jeton plus court (1 heure ou 12 heures), le problème est probablement que vous vous connectez en tant qu’« installateur » et vous devrez plutôt utiliser un compte éclairé « propriétaire du système ».

Bonjour,
J’ai installer le plugin , il marche très chez moi mais serait il possible d’avoir les données des batteries comme l’ancien : puissance charge/decharge et % de charge

Pour ceux qui souhaite passer de forc en V7 il y a une solution : (personnes qui connaissent/maitrisent toolkit uniquement)
sur installer toolkit :
faire un ajout d’une IQ Batterie 3.5KW
faire un scan du numero de la batterie (manuellement) : N° 1220 … (moi j’ai scanner le numero du support metallique de la batterie)
il dit qu’il n’est reconnu , on s’en f…
connecter le tool kit et là il propose la MAJ en V7 …
une fois MAJ faite, supprimer la batterie fictive
relancer un scan des elements pour retablir le matériel correct

A faire en connaissant et mesurant les risques , je ne suis pas responsable en cas de matériel ne fonctionnant plus … ;o)

Slt oui, envoie moi les log du daemon en debug et je regarderai

Je n’ai pas de batterie donc pas d’exemple :grin:

comment dois je m’y prendre ?
est ce ça ?

[2022-11-11 20:32:06][ERROR] : Fatal error : The read operation timed out
[2022-11-11 20:34:54][ERROR] : Fatal error : The read operation timed out
[2022-11-11 20:37:25][ERROR] : Fatal error : The read operation timed out
[2022-11-11 20:42:08][ERROR] : Fatal error : The read operation timed out
[2022-11-11 20:57:01][ERROR] : Fatal error : The read operation timed out
[2022-11-11 20:58:49][ERROR] : Fatal error : timed out
[2022-11-11 21:00:00][ERROR] : Fatal error : [Errno 111] Connection refused
[2022-11-11 21:01:17][ERROR] : Fatal error : The read operation timed out
[2022-11-11 21:56:11][ERROR] : Fatal error : The read operation timed out
[2022-11-11 22:00:49][ERROR] : Fatal error : The read operation timed out
[2022-11-11 22:15:45][ERROR] : Fatal error : The read operation timed out
[2022-11-11 22:20:51][ERROR] : Fatal error : The read operation timed out
[2022-11-11 22:48:24][ERROR] : Fatal error : The read operation timed out
[2022-11-11 22:50:08][ERROR] : Fatal error : The read operation timed out
[2022-11-11 23:01:19][ERROR] : Fatal error : The read operation timed out
[2022-11-11 23:22:13][ERROR] : Fatal error : The read operation timed out
[2022-11-11 23:52:32][ERROR] : Fatal error : The read operation timed out
[2022-11-12 08:00:02][ERROR] : Fatal error : The read operation timed out
[2022-11-12 08:45:55][ERROR] : Fatal error : The read operation timed out
[2022-11-12 09:18:35][ERROR] : Fatal error : The read operation timed out
[2022-11-12 09:23:06][ERROR] : Fatal error : The read operation timed out
[2022-11-12 09:25:00][ERROR] : Fatal error : The read operation timed out
[2022-11-12 09:28:34][ERROR] : Fatal error : timed out
[2022-11-12 09:29:50][ERROR] : Fatal error : timed out
[2022-11-12 09:31:03][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:32:17][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:33:31][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:34:45][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:36:00][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:37:14][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:38:28][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:39:42][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:40:57][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:42:11][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:43:26][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:44:40][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:45:54][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:47:08][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:48:22][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:49:37][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:50:51][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:52:05][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:53:19][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:54:34][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:55:48][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:57:02][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 09:58:16][ERROR] : Fatal error : [Errno 113] No route to host
[2022-11-12 13:16:08][ERROR] : Fatal error : The read operation timed out
[2022-11-12 13:17:36][ERROR] : Fatal error : The read operation timed out

Il faut d’abord passer en debug puis relancer le demon

comment passe t on en debug : en cliquant sur debug au dessus de demon ?

ça : ?

[2022-11-12 17:13:26][DEBUG] : HTTP Request: GET https://192.168./production.json?details=1 « HTTP/1.1 200 OK »
[2022-11-12 17:13:26][DEBUG] : {‹ production ›: [{‹ type ›: ‹ inverters ›, ‹ activeCount ›: 6, ‹ readingTime ›: 1668269587, ‹ wNow ›: 14, ‹ whLifetime ›: 263690}, {‹ type ›: ‹ eim ›, ‹ activeCount ›: 1, ‹ measurementType ›: ‹ production ›, ‹ readingTime ›: 1668269605, ‹ wNow ›: 1.424, ‹ whLifetime ›: 268715.696, ‹ varhLeadLifetime ›: 0.0, ‹ varhLagLifetime ›: 122118.654, ‹ vahLifetime ›: 356959.49, ‹ rmsCurrent ›: 0.415, ‹ rmsVoltage ›: 230.18, ‹ reactPwr ›: 93.852, ‹ apprntPwr ›: 95.687, ‹ pwrFactor ›: 0.0, ‹ whToday ›: 3258.696, ‹ whLastSevenDays ›: 27176.696, ‹ vahToday ›: 3536.49, ‹ varhLeadToday ›: 0.0, ‹ varhLagToday ›: 751.654, ‹ lines ›: [{‹ wNow ›: 1.424, ‹ whLifetime ›: 268715.696, ‹ varhLeadLifetime ›: 0.0, ‹ varhLagLifetime ›: 122118.654, ‹ vahLifetime ›: 356959.49, ‹ rmsCurrent ›: 0.415, ‹ rmsVoltage ›: 230.18, ‹ reactPwr ›: 93.852, ‹ apprntPwr ›: 95.687, ‹ pwrFactor ›: 0.0, ‹ whToday ›: 3258.696, ‹ whLastSevenDays ›: 27176.696, ‹ vahToday ›: 3536.49, ‹ varhLeadToday ›: 0.0, ‹ varhLagToday ›: 751.654}]}], ‹ consumption ›: [{‹ type ›: ‹ eim ›, ‹ activeCount ›: 1, ‹ measurementType ›: ‹ total-consumption ›, ‹ readingTime ›: 1668269605, ‹ wNow ›: 462.995, ‹ whLifetime ›: 435306.322, ‹ varhLeadLifetime ›: 258861.018, ‹ varhLagLifetime ›: 141763.902, ‹ vahLifetime ›: 493641.615, ‹ rmsCurrent ›: 3.013, ‹ rmsVoltage ›: 230.229, ‹ reactPwr ›: -389.843, ‹ apprntPwr ›: 693.758, ‹ pwrFactor ›: 0.67, ‹ whToday ›: 5021.322, ‹ whLastSevenDays ›: 62216.322, ‹ vahToday ›: 3974.615, ‹ varhLeadToday ›: 1172.018, ‹ varhLagToday ›: 1071.902, ‹ lines ›: [{‹ wNow ›: 462.995, ‹ whLifetime ›: 435306.322, ‹ varhLeadLifetime ›: 258861.018, ‹ varhLagLifetime ›: 141763.902, ‹ vahLifetime ›: 493641.615, ‹ rmsCurrent ›: 3.013, ‹ rmsVoltage ›: 230.229, ‹ reactPwr ›: -389.843, ‹ apprntPwr ›: 693.758, ‹ pwrFactor ›: 0.67, ‹ whToday ›: 5021.322, ‹ whLastSevenDays ›: 62216.322, ‹ vahToday ›: 3974.615, ‹ varhLeadToday ›: 1172.018, ‹ varhLagToday ›: 1071.902}]}, {‹ type ›: ‹ eim ›, ‹ activeCount ›: 1, ‹ measurementType ›: ‹ net-consumption ›, ‹ readingTime ›: 1668269605, ‹ wNow ›: 461.571, ‹ whLifetime ›: 204095.636, ‹ varhLeadLifetime ›: 258861.018, ‹ varhLagLifetime ›: 19645.248, ‹ vahLifetime ›: 493641.615, ‹ rmsCurrent ›: 2.599, ‹ rmsVoltage ›: 230.277, ‹ reactPwr ›: -295.991, ‹ apprntPwr ›: 598.485, ‹ pwrFactor ›: 0.77, ‹ whToday ›: 0, ‹ whLastSevenDays ›: 0, ‹ vahToday ›: 0, ‹ varhLeadToday ›: 0, ‹ varhLagToday ›: 0, ‹ lines ›: [{‹ wNow ›: 461.571, ‹ whLifetime ›: 204095.636, ‹ varhLeadLifetime ›: 258861.018, ‹ varhLagLifetime ›: 19645.248, ‹ vahLifetime ›: 493641.615, ‹ rmsCurrent ›: 2.599, ‹ rmsVoltage ›: 230.277, ‹ reactPwr ›: -295.991, ‹ apprntPwr ›: 598.485, ‹ pwrFactor ›: 0.77, ‹ whToday ›: 0, ‹ whLastSevenDays ›: 0, ‹ vahToday ›: 0, ‹ varhLeadToday ›: 0, ‹ varhLagToday ›: 0}]}], ‹ storage ›: [{‹ type ›: ‹ acb ›, ‹ activeCount ›: 1, ‹ readingTime ›: 1668269461, ‹ wNow ›: -5, ‹ whNow ›: 198, ‹ state ›: ‹ idle ›, ‹ percentFull ›: 16}]}
[2022-11-12 17:13:26][INFO] : Send to jeedom : {‹ production ›: [{‹ type ›: ‹ inverters ›, ‹ activeCount ›: 6, ‹ readingTime ›: 1668269587, ‹ wNow ›: 14, ‹ whLifetime ›: 263690}, {‹ type ›: ‹ eim ›, ‹ activeCount ›: 1, ‹ measurementType ›: ‹ production ›, ‹ readingTime ›: 1668269605, ‹ wNow ›: 1.424, ‹ whLifetime ›: 268715.696, ‹ varhLeadLifetime ›: 0.0, ‹ varhLagLifetime ›: 122118.654, ‹ vahLifetime ›: 356959.49, ‹ rmsCurrent ›: 0.415, ‹ rmsVoltage ›: 230.18, ‹ reactPwr ›: 93.852, ‹ apprntPwr ›: 95.687, ‹ pwrFactor ›: 0.0, ‹ whToday ›: 3258.696, ‹ whLastSevenDays ›: 27176.696, ‹ vahToday ›: 3536.49, ‹ varhLeadToday ›: 0.0, ‹ varhLagToday ›: 751.654, ‹ lines ›: [{‹ wNow ›: 1.424, ‹ whLifetime ›: 268715.696, ‹ varhLeadLifetime ›: 0.0, ‹ varhLagLifetime ›: 122118.654, ‹ vahLifetime ›: 356959.49, ‹ rmsCurrent ›: 0.415, ‹ rmsVoltage ›: 230.18, ‹ reactPwr ›: 93.852, ‹ apprntPwr ›: 95.687, ‹ pwrFactor ›: 0.0, ‹ whToday ›: 3258.696, ‹ whLastSevenDays ›: 27176.696, ‹ vahToday ›: 3536.49, ‹ varhLeadToday ›: 0.0, ‹ varhLagToday ›: 751.654}]}], ‹ consumption ›: [{‹ type ›: ‹ eim ›, ‹ activeCount ›: 1, ‹ measurementType ›: ‹ total-consumption ›, ‹ readingTime ›: 1668269605, ‹ wNow ›: 462.995, ‹ whLifetime ›: 435306.322, ‹ varhLeadLifetime ›: 258861.018, ‹ varhLagLifetime ›: 141763.902, ‹ vahLifetime ›: 493641.615, ‹ rmsCurrent ›: 3.013, ‹ rmsVoltage ›: 230.229, ‹ reactPwr ›: -389.843, ‹ apprntPwr ›: 693.758, ‹ pwrFactor ›: 0.67, ‹ whToday ›: 5021.322, ‹ whLastSevenDays ›: 62216.322, ‹ vahToday ›: 3974.615, ‹ varhLeadToday ›: 1172.018, ‹ varhLagToday ›: 1071.902, ‹ lines ›: [{‹ wNow ›: 462.995, ‹ whLifetime ›: 435306.322, ‹ varhLeadLifetime ›: 258861.018, ‹ varhLagLifetime ›: 141763.902, ‹ vahLifetime ›: 493641.615, ‹ rmsCurrent ›: 3.013, ‹ rmsVoltage ›: 230.229, ‹ reactPwr ›: -389.843, ‹ apprntPwr ›: 693.758, ‹ pwrFactor ›: 0.67, ‹ whToday ›: 5021.322, ‹ whLastSevenDays ›: 62216.322, ‹ vahToday ›: 3974.615, ‹ varhLeadToday ›: 1172.018, ‹ varhLagToday ›: 1071.902}]}, {‹ type ›: ‹ eim ›, ‹ activeCount ›: 1, ‹ measurementType ›: ‹ net-consumption ›, ‹ readingTime ›: 1668269605, ‹ wNow ›: 461.571, ‹ whLifetime ›: 204095.636, ‹ varhLeadLifetime ›: 258861.018, ‹ varhLagLifetime ›: 19645.248, ‹ vahLifetime ›: 493641.615, ‹ rmsCurrent ›: 2.599, ‹ rmsVoltage ›: 230.277, ‹ reactPwr ›: -295.991, ‹ apprntPwr ›: 598.485, ‹ pwrFactor ›: 0.77, ‹ whToday ›: 0, ‹ whLastSevenDays ›: 0, ‹ vahToday ›: 0, ‹ varhLeadToday ›: 0, ‹ varhLagToday ›: 0, ‹ lines ›: [{‹ wNow ›: 461.571, ‹ whLifetime ›: 204095.636, ‹ varhLeadLifetime ›: 258861.018, ‹ varhLagLifetime ›: 19645.248, ‹ vahLifetime ›: 493641.615, ‹ rmsCurrent ›: 2.599, ‹ rmsVoltage ›: 230.277, ‹ reactPwr ›: -295.991, ‹ apprntPwr ›: 598.485, ‹ pwrFactor ›: 0.77, ‹ whToday ›: 0, ‹ whLastSevenDays ›: 0, ‹ vahToday ›: 0, ‹ varhLeadToday ›: 0, ‹ varhLagToday ›: 0}]}], ‹ storage ›: [{‹ type ›: ‹ acb ›, ‹ activeCount ›: 1, ‹ readingTime ›: 1668269461, ‹ wNow ›: -5, ‹ whNow ›: 198, ‹ state ›: ‹ idle ›, ‹ percentFull ›: 16}]}

Yep c’est ca