Skip to content

feat: Improve timetable source options #209

Open
sevorl wants to merge 1 commit intoJonasJoKuJonas:mainfrom
sevorl:main
Open

feat: Improve timetable source options #209
sevorl wants to merge 1 commit intoJonasJoKuJonas:mainfrom
sevorl:main

Conversation

@sevorl
Copy link
Contributor

@sevorl sevorl commented Sep 2, 2025

It is now possible to change the time table source for an existing configuration.
It is not needed to delete the existing configuration and start from scratch

…guration

- Fix timetable query to respect school year boundaries
- Add configurable timetable source options flow with separate sub-forms
- Update integration to read timetable_source from options instead of data
- Add proper validation for all timetable source types (Personal, Class, Teacher, Student)
- Add translation keys for new options flow steps in all languages (en, de, nl)
- Restructure options flow to use dedicated forms for each source type
- Fix saving and validation issues in options configuration
@sevorl
Copy link
Contributor Author

sevorl commented Sep 4, 2025

@JonasJoKuJonas : Would you mind taking a look at this pull request?
This implements an option to choose the time table source later on, not only during the intial setup.

@JonasJoKuJonas
Copy link
Owner

I originally decided against it because all the entities have fixed names. If the source is changed to a new class, the names are no longer correct.
Are the sensor getting renamed after reconfiguration? Or what do you think how the naming should be handled?

I currently have no way of testing you code because I'm finished with Abitur so to implement you changes I have to be sure you thought of edge case's and implement proper error handling.

@sevorl
Copy link
Contributor Author

sevorl commented Sep 4, 2025

Hi @JonasJoKuJonas,
First of all congrats to your Abitur an thanks for your great work on this project. The untis integration is a central part of our family dashboard and incredibly helpful!

The sensors don't get renamed automatically, so that existing automations etc. wont break.. They could be renamed manually of course

self.password = config.data["password"]
self.timetable_source = config.data["timetable_source"]
self.timetable_source_id = config.data["timetable_source_id"]
self.timetable_source = config.options.get("timetable_source", config.data.get("timetable_source"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data should always be read from options, never from ether options or config.
When creating a new entry, the data must be stored in options.
For existing entries, migrate the data using CONFIG_ENTRY_VERSION so that all information is consistently kept in options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants