Skip to content

Commit

Permalink
load max_points and percent to grate attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrfilipmarek committed Dec 13, 2024
1 parent 1e8b209 commit b1eff2c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion custom_components/homeassistantedupage/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", [])
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit b1eff2c

Please sign in to comment.