EcoleDirecte connector

Hello à tous,

Ma fille est au collège avec Ecole Directe pour la gestion de l’emploi du temps, notes, etc.
Je sais qu’il existe un connecteur pour Pronote mais rien trouvé sur Ecole Directe, certains ont reussi a plugger ca dans leur HA ?

3 « J'aime »

Salut

A priori, ça n’existe pas (encore).
J’utilise Ecole directe, mais mes filles sont encore à l’école primaire, donc pas trop intéressant pour moi pour le moment.
Mais ça doit être possible de faire une intégration avec ça: GitHub - EduWireApps/ecoledirecte-api-docs

Je serais également extrêmement interessé par une intégration École Directe :star_struck::star_struck::star_struck:

me too, j’ai regarder rapidement et c’est pas possible d’utiliser du scrap ou multiscrape directement (car il faut renouveler son token d’accès).

Donc une petite extension HA serait le bienvenue. Ce qui ne devrait pas être trop compliqué au vue de l’API mais comme je suis pas développeur, c’est malheureusement pas dans mes cordes.

Je confirme que rien n’existe pour l’instant

mais les infos qui sont dans le GitHub - EduWireApps/ecoledirecte-api-docs sont pertinents et fonctionne bien.

De plus, le créateur du répo est prêt a aider et sympa !

J’ai réussi a avoir des valeurs de l’api via multiscrape, cf code en dessous mais les résultats retourner sont vraiment compliqué et long (trop ?) donc il faut vraiment une vrai extension pour ça et là, ça dépasse mes compétences…

surtout qu’il est possible de se connecter via le compte parents et les comptes enfants et que du coup, les infos retourner sont pas tous identiques

Mais au besoin, je peut tester (avec différents comptes) et faire des tests

Code Mutliscrape
  • récuperer un Token
- name: ecole_direct
 resource: https://api.ecoledirecte.com/v3/login.awp
 scan_interval: 0
 method: POST
 headers:
   Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
   Content-Type: application/x-www-form-urlencoded
   User-Agent: Wget/1.20.3 (linux-gnu)
 payload: 'data={"identifiant": "xxx", "motdepasse": "yyyy", "isRelogin": false, "uuid": ""}'
 button:
   - name: Ecole Direct Force refresh Information
     unique_id: ecole_direct
 sensor:
   - name: Ecole Direct Token
     value_template: "{{ value_json.token }}"
  • Notes
- name: ecole_direct_notes
  resource: https://api.ecoledirecte.com/v3/eleves/id_eleve/notes.awp?verbe=get
  scan_interval: 0
  method: POST
  headers:
    Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
    Content-Type: 'application/x-www-form-urlencoded'
    User-Agent: 'Wget/1.20.3 (linux-gnu)'
    X-Token: zzzz
  payload: 'data={"anneeScolaire": "2023-2024"}'
  button:
    - name: Ecole Direct Force refresh Notes
      unique_id: ecole_direct_notes
  sensor:
    - name: Ecole Direct Notes
      value_template: "{{ value_json }}"
  • Cahier de Text
- name: ecole_direct_cahier
 resource: https://api.ecoledirecte.com/v3/Eleves/id_eleve/cahierdetexte.awp?verbe=get
 scan_interval: 0
 method: POST
 headers:
   Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
   Content-Type: application/x-www-form-urlencoded
   User-Agent: Wget/1.20.3 (linux-gnu)
   X-Token: zzzz
 payload: 'data={}'
 button:
   - name: Ecole Direct Force refresh Cahier
     unique_id: ecole_direct_cahier
 sensor:
   - name: Ecole Direct Cahier
     value_template: "{{ value_json }}"
  • Cahier de text du jour
- name: ecole_direct_cahier_jour
 resource: https://api.ecoledirecte.com/v3/Eleves/id_eleve/cahierdetexte/2024-01-02.awp
 scan_interval: 0
 method: POST
 headers:
   Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
   Content-Type: application/x-www-form-urlencoded
   User-Agent: Wget/1.20.3 (linux-gnu)
   X-Token: zzzz
 button:
   - name: Ecole Direct Force refresh Cahier Jour
     unique_id: ecole_direct_cahier_jour
 sensor:
   - name: Ecole Direct Cahier Jour
     value_template: "{{ value_json }}"

Voila, je l’ai fait : Intégration Ecole Directe (version alpha)

J’ai mis les notes et le cahier de texte, mais avec mon compte, ç’est désactiver…
@roumano je veux bien que tu testes :stuck_out_tongue_winking_eye:

Salut, je vient de tester, avec mon compte ou celui d’un de mes fils : impossible de se connecter, voici les logs d’erreurs :

mars 10 22:47:51 pi hass[19365]: 2024-03-10 22:47:51.164 DEBUG (MainThread) [custom_components.ecole_directe.config_flow] _User Inputs UP: {'username': 'XXXXX', 'password': 'YYYYY'}
mars 10 22:47:51 pi hass[19365]: 2024-03-10 22:47:51.164 ERROR (MainThread) [aiohttp.server] Error handling request
mars 10 22:47:51 pi hass[19365]: Traceback (most recent call last):
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
mars 10 22:47:51 pi hass[19365]:     resp = await request_handler(request)
mars 10 22:47:51 pi hass[19365]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
mars 10 22:47:51 pi hass[19365]:     resp = await handler(request)
mars 10 22:47:51 pi hass[19365]:            ^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
mars 10 22:47:51 pi hass[19365]:     return await handler(request)
mars 10 22:47:51 pi hass[19365]:            ^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware
mars 10 22:47:51 pi hass[19365]:     return await handler(request)
mars 10 22:47:51 pi hass[19365]:            ^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
mars 10 22:47:51 pi hass[19365]:     return await handler(request)
mars 10 22:47:51 pi hass[19365]:            ^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/request_context.py", line 25, in request_context_middleware
mars 10 22:47:51 pi hass[19365]:     return await handler(request)
mars 10 22:47:51 pi hass[19365]:            ^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/auth.py", line 235, in auth_middleware
mars 10 22:47:51 pi hass[19365]:     return await handler(request)
mars 10 22:47:51 pi hass[19365]:            ^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/headers.py", line 31, in headers_middleware
mars 10 22:47:51 pi hass[19365]:     response = await handler(request)
mars 10 22:47:51 pi hass[19365]:                ^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/http.py", line 68, in handle
mars 10 22:47:51 pi hass[19365]:     result = await handler(request, **request.match_info)
mars 10 22:47:51 pi hass[19365]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/decorators.py", line 72, in with_admin
mars 10 22:47:51 pi hass[19365]:     return await func(self, request, *args, **kwargs)
mars 10 22:47:51 pi hass[19365]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/config/config_entries.py", line 197, in post
mars 10 22:47:51 pi hass[19365]:     return await super().post(request, flow_id)
mars 10 22:47:51 pi hass[19365]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/data_validator.py", line 72, in wrapper
mars 10 22:47:51 pi hass[19365]:     result = await method(view, request, data, *args, **kwargs)
mars 10 22:47:51 pi hass[19365]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/data_entry_flow.py", line 111, in post
mars 10 22:47:51 pi hass[19365]:     result = await self._flow_mgr.async_configure(flow_id, data)
mars 10 22:47:51 pi hass[19365]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/data_entry_flow.py", line 359, in async_configure
mars 10 22:47:51 pi hass[19365]:     result = await self._async_configure(flow_id, user_input)
mars 10 22:47:51 pi hass[19365]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/data_entry_flow.py", line 405, in _async_configure
mars 10 22:47:51 pi hass[19365]:     result = await self._async_handle_step(
mars 10 22:47:51 pi hass[19365]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/data_entry_flow.py", line 502, in _async_handle_step
mars 10 22:47:51 pi hass[19365]:     result: FlowResult = await getattr(flow, method)(user_input)
mars 10 22:47:51 pi hass[19365]:                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]:   File "/opt/homeassistant/.homeassistant/custom_components/ecole_directe/config_flow.py", line 57, in async_step_user
mars 10 22:47:51 pi hass[19365]:     return self.async_create_entry(title=session.identifiant, data=self._user_inputs)
mars 10 22:47:51 pi hass[19365]:                                          ^^^^^^^^^^^^^^^^^^^
mars 10 22:47:51 pi hass[19365]: AttributeError: 'NoneType' object has no attribute 'identifiant'

J’ai mis à jour le github.
Remplace le contenu du répertoire ecole_directe, et redémarre HA.

Salut,
En copiant manuellement les fichiers (et un rm -rf __pycache__/* avant le restart) , j’ai une nouvelle option « student » ou « familly » mais pareil, j’arrive pas a me connecter ni a l’un ni a l’autre comptes , …

Mar 11 00:48:59 pi hass[24408]: 2024-03-11 00:48:59.618 DEBUG (MainThread) [custom_components.ecole_directe.config_flow] _User Inputs UP: {'username': 'XXXX', 'password': 'YYYY', 'account_type': 'famille'}
Mar 11 00:48:59 pi hass[24408]: 2024-03-11 00:48:59.618 ERROR (MainThread) [aiohttp.server] Error handling request
Mar 11 00:48:59 pi hass[24408]: Traceback (most recent call last):
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
Mar 11 00:48:59 pi hass[24408]:     resp = await request_handler(request)
Mar 11 00:48:59 pi hass[24408]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
Mar 11 00:48:59 pi hass[24408]:     resp = await handler(request)
Mar 11 00:48:59 pi hass[24408]:            ^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
Mar 11 00:48:59 pi hass[24408]:     return await handler(request)
Mar 11 00:48:59 pi hass[24408]:            ^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware
Mar 11 00:48:59 pi hass[24408]:     return await handler(request)
Mar 11 00:48:59 pi hass[24408]:            ^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
Mar 11 00:48:59 pi hass[24408]:     return await handler(request)
Mar 11 00:48:59 pi hass[24408]:            ^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/request_context.py", line 25, in request_context_middleware
Mar 11 00:48:59 pi hass[24408]:     return await handler(request)
Mar 11 00:48:59 pi hass[24408]:            ^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/auth.py", line 235, in auth_middleware
Mar 11 00:48:59 pi hass[24408]:     return await handler(request)
Mar 11 00:48:59 pi hass[24408]:            ^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/headers.py", line 31, in headers_middleware
Mar 11 00:48:59 pi hass[24408]:     response = await handler(request)
Mar 11 00:48:59 pi hass[24408]:                ^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/http.py", line 68, in handle
Mar 11 00:48:59 pi hass[24408]:     result = await handler(request, **request.match_info)
Mar 11 00:48:59 pi hass[24408]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/decorators.py", line 72, in with_admin
Mar 11 00:48:59 pi hass[24408]:     return await func(self, request, *args, **kwargs)
Mar 11 00:48:59 pi hass[24408]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/config/config_entries.py", line 197, in post
Mar 11 00:48:59 pi hass[24408]:     return await super().post(request, flow_id)
Mar 11 00:48:59 pi hass[24408]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/components/http/data_validator.py", line 72, in wrapper
Mar 11 00:48:59 pi hass[24408]:     result = await method(view, request, data, *args, **kwargs)
Mar 11 00:48:59 pi hass[24408]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/data_entry_flow.py", line 111, in post
Mar 11 00:48:59 pi hass[24408]:     result = await self._flow_mgr.async_configure(flow_id, data)
Mar 11 00:48:59 pi hass[24408]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/data_entry_flow.py", line 359, in async_configure
Mar 11 00:48:59 pi hass[24408]:     result = await self._async_configure(flow_id, user_input)
Mar 11 00:48:59 pi hass[24408]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/data_entry_flow.py", line 405, in _async_configure
Mar 11 00:48:59 pi hass[24408]:     result = await self._async_handle_step(
Mar 11 00:48:59 pi hass[24408]:              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/lib/python3.12/site-packages/homeassistant/data_entry_flow.py", line 502, in _async_handle_step
Mar 11 00:48:59 pi hass[24408]:     result: FlowResult = await getattr(flow, method)(user_input)
Mar 11 00:48:59 pi hass[24408]:                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]:   File "/opt/homeassistant/.homeassistant/custom_components/ecole_directe/config_flow.py", line 58, in async_step_user
Mar 11 00:48:59 pi hass[24408]:     return self.async_create_entry(title=session.identifiant, data=self._user_inputs)
Mar 11 00:48:59 pi hass[24408]:                                          ^^^^^^^^^^^^^^^^^^^
Mar 11 00:48:59 pi hass[24408]: AttributeError: 'NoneType' object has no attribute 'identifiant'

Merci pour ton aide et a bientot

Il doit y avoir une autre erreur avant. J’ai corrigé pour avoir une seule erreur plus claire.
J’ai remis à jour le github. Supprime le contenu du répertoire ecole_directe, prends le contenu du github et redémarre HA.