diff --git a/custom_components/homeassistantedupage/sensor.py b/custom_components/homeassistantedupage/sensor.py index 113047d..e302bea 100644 --- a/custom_components/homeassistantedupage/sensor.py +++ b/custom_components/homeassistantedupage/sensor.py @@ -22,7 +22,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry, async_add_e """Set up EduPage sensors for each student and their grades.""" _LOGGER.debug("SENSOR called async_setup_entry") coordinator = hass.data[DOMAIN][entry.entry_id] - + student = coordinator.data.get("student", {}) subjects = coordinator.data.get("subjects", []) grades = coordinator.data.get("grades", []) @@ -98,6 +98,8 @@ def extra_state_attributes(self): for i, grade in enumerate(self._grades): attributes[f"grade_{i+1}_title"] = grade.title attributes[f"grade_{i+1}_grade_n"] = grade.grade_n + attributes[f"grade_{i+1}_max_points"] = grade.max_points + attributes[f"grade_{i+1}_percent"] = grade.percent attributes[f"grade_{i+1}_date"] = grade.date.strftime("%Y-%m-%d %H:%M:%S") teacher_name = grade.teacher.name if grade.teacher else "unknown"