-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PR - Emploi du temps avec EDT #9
Conversation
modified: custom_components/ecole_directe/ecole_directe_formatter.py modified: custom_components/ecole_directe/ecole_directe_helper.py modified: custom_components/ecole_directe/sensor.py
modified: custom_components/ecole_directe/sensor.py
modified: custom_components/ecole_directe/sensor.py
modified: custom_components/ecole_directe/coordinator.py modified: custom_components/ecole_directe/ecole_directe_helper.py modified: custom_components/ecole_directe/sensor.py
Mon fork sur la version 0.25 fonctionne sur les Notes et les Devoir. L'EDT indique cette Error getting Lessons from ecole directe: Error with URL:[https://api.ecoledirecte.com/v3/eleves/2204/emploidutemps.awp?verbe=get&v=4.55.0]: b'Oups une erreur est survenue ...: \r\n522' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarde les commentaires que j'ai laissé
@@ -72,6 +74,10 @@ async def _async_update_data(self) -> dict[Platform, dict[str, Any]]: | |||
else: | |||
year_data = f"{str(current_year)}-{str(current_year + 1)}" | |||
|
|||
#EDT BODY | |||
edt_date_start = "2024-05-02" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ici, il ne faut pas avoir la date en dur
] = await self.hass.async_add_executor_job( | ||
get_lessons, session.token, eleve, edt_date_start, edt_date_end | ||
) | ||
#self.compare_data( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pour l'emploi du temps pas besoin de comparer
Je ne vois pas l'utilité, chaque jour va forcément être différent.
"""get lessons""" | ||
json_resp = get_response( | ||
token, | ||
f"{APIURL}/eleves/{eleve.eleve_id}/emploidutemps.awp?verbe=get&v={APIVERSION}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l'url ici n'est pas bonne :
{APIURL}/E/{eleve.eleve_id}/emploidutemps.awp
source : https://github.com/EduWireApps/ecoledirecte-api-docs
@@ -9,4 +9,5 @@ | |||
# default values for options | |||
DEFAULT_REFRESH_INTERVAL = 30 | |||
GRADES_TO_DISPLAY = 15 | |||
LESSONS_TO_DISPLAY = 15 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ce n'est pas utilisé, tu peux le supprimer
@@ -83,3 +83,37 @@ def format_grade(grade) -> dict: | |||
except Exception as ex: | |||
_LOGGER.warning("Error: %s - format_grade: %s", ex, grade) | |||
return {} | |||
|
|||
|
|||
def format_lesson(lesson) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adapte avec la fonction Pronote (pour utiliser les cartes Pronotes):
def format_lesson(lesson, lunch_break_time):
return {
'start_at': lesson.start,
'end_at': lesson.end,
'start_time': lesson.start.strftime("%H:%M"),
'end_time': lesson.end.strftime("%H:%M"),
'lesson': format_displayed_lesson(lesson),
'classroom': lesson.classroom,
'canceled': lesson.canceled,
'status': lesson.status,
'background_color': lesson.background_color,
'teacher_name': lesson.teacher_name,
'teacher_names': lesson.teacher_names,
'classrooms': lesson.classrooms,
'outing': lesson.outing,
'memo': lesson.memo,
'group_name': lesson.group_name,
'group_names': lesson.group_names,
'exempted': lesson.exempted,
'virtual_classrooms': lesson.virtual_classrooms,
'num': lesson.num,
'detention': lesson.detention,
'test': lesson.test,
'is_morning': lesson.start.time() < lunch_break_time,
'is_afternoon': lesson.start.time() >= lunch_break_time,
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'avais deja pris en compte le lovelace pour certaines données. Pas 100% d'equivalence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oui, je m'en doute.
Mais si on veut utiliser les cartes Pronotes, il nous faut les attributs, même s'ils sont vides.
modified: custom_components/ecole_directe/ecole_directe_helper.py modified: custom_components/ecole_directe/sensor.py
Pourquoi as-tu fermé la PR ? |
J'ai voulu reprendre à partir de la 0.26. Je n'ai pas encore fait le formatage. |
Pour ça, tu fais une PR de ma version 2.6 vers ton fork. Automatiquement cette PR sera mise à jour. |
J'approuve et je finis le dév, merci |
Ajout des objets Associé a Emploi du temps
LESSONS_TO_DISPLAY = 15
EDLesson,
get_lessons (...... edt_date_start, edt_date_end)
format_lesson
EDLessonsSensor