Skip to content
This repository was archived by the owner on Sep 1, 2025. It is now read-only.

Commit 7c07e37

Browse files
Fix error in specific calendar cases
1 parent 368d3ff commit 7c07e37

4 files changed

Lines changed: 27 additions & 15 deletions

File tree

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@
55
[![Open your Home Assistant instance and start setting up a new integration.](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=vulcan)
66
View your vulcan data as Home Assistant sensors and use it in automations. You can add multiple students by adding integration again.
77

8+
# Important note
9+
This integration will only work with Vulcan accounts that still use the old UONET+ API. If your school has already switched to the new API (eduVulcan), this integration will not work.
10+
811
## Get started
9-
If you already installed integration you can add it to home assistant by clicking [this link](https://my.home-assistant.io/redirect/config_flow_start/?domain=vulcan) (only v2021.3.0 with enabled ["my"](https://www.home-assistant.io/integrations/my/) integration) or add it manually this integrations page, then login as mobile app in Integrations page. In integration options you can select student and enable notifications. Actually only one student is supported.
12+
If you already installed integration you can add it to home assistant by clicking [this link](https://my.home-assistant.io/redirect/config_flow_start/?domain=vulcan) or add it manually this integrations page, then login as mobile app in Integrations page. In integration options you can select student and enable notifications. Actually only one student is supported.
1013
You can easily add sensors to the lovelace interface using the "Add to Lovelace UI" option in the device page.
1114
![image](https://raw.githubusercontent.com/Antoni-Czaplicki/vulcan-for-hassio/master/docs/images/dashboard.png)
1215

@@ -16,7 +19,7 @@ All integration settings are available in the options in the integration configu
1619

1720
## Timetable
1821
### Calendar
19-
Calendar view with all lessons.
22+
Calendar view with all lessons, homeworks and exams.
2023

2124
#### Month
2225
![image](https://raw.githubusercontent.com/Antoni-Czaplicki/vulcan-for-hassio/master/docs/images/calendar-month.png)

custom_components/vulcan/calendar.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,21 @@ async def async_get_events(
134134

135135
event_list = []
136136
for item in events:
137-
event = CalendarEvent(
138-
start=datetime.combine(item["date"], item["time"].from_).replace(
139-
tzinfo=ZoneInfo("Europe/Warsaw")
140-
),
141-
end=datetime.combine(item["date"], item["time"].to).replace(
142-
tzinfo=ZoneInfo("Europe/Warsaw")
143-
),
144-
summary=item["lesson"],
145-
location=item["room"],
146-
description=item["teacher"],
147-
)
148-
137+
try:
138+
event = CalendarEvent(
139+
start=datetime.combine(item["date"], item["time"].from_).replace(
140+
tzinfo=ZoneInfo("Europe/Warsaw")
141+
),
142+
end=datetime.combine(item["date"], item["time"].to).replace(
143+
tzinfo=ZoneInfo("Europe/Warsaw")
144+
),
145+
summary=item["lesson"],
146+
location=item["room"],
147+
description=item["teacher"],
148+
)
149+
except Exception as err:
150+
_LOGGER.error("Error: %s", err)
151+
continue
149152
event_list.append(event)
150153

151154
return event_list

custom_components/vulcan/fetch_data.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ async def get_lessons(
4747
temp_dict["lesson"] = (
4848
lesson.subject.name if lesson.subject is not None else None
4949
)
50+
if lesson.event is not None:
51+
temp_dict["lesson"] = (
52+
lesson.event + f" - {temp_dict['lesson']}"
53+
if temp_dict["lesson"] is not None
54+
else lesson.event
55+
)
5056
if lesson.room is not None:
5157
temp_dict["room"] = lesson.room.code
5258
else:

custom_components/vulcan/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"issue_tracker": "https://github.com/Antoni-Czaplicki/vulcan-for-hassio/issues",
99
"quality_scale": "silver",
1010
"requirements": ["vulcan-api==2.4.0"],
11-
"version": "0.16.1"
11+
"version": "0.17.0"
1212
}

0 commit comments

Comments
 (0)