Skip to content

Feature/implement event when token has been refreshed or changed - #17

Closed
NMauel wants to merge 3 commits into
KoenZomers:masterfrom
NMauel:feature/implement-event-when-token-has-been-refreshed-or-changed
Closed

Feature/implement event when token has been refreshed or changed#17
NMauel wants to merge 3 commits into
KoenZomers:masterfrom
NMauel:feature/implement-event-when-token-has-been-refreshed-or-changed

Conversation

@NMauel

@NMauel NMauel commented Nov 20, 2025

Copy link
Copy Markdown

When token is changed/refreshed, you will be notified by the TokenChangedEvent...

Such way you can store the token locally so you don't need to re-register @ Tado on a restart (within the 30 days the refresh token is still valid).

Using this in a dockerized application on a RPi with auto-(re)start... ;-)

@NMauel

NMauel commented Nov 25, 2025

Copy link
Copy Markdown
Author

@KoenZomers, heb je misschien tijd om dit te reviewen? ;-)

@KoenZomers

Copy link
Copy Markdown
Owner

@NMauel Thanks for your efforts again here. Can you elaborate a bit more on the situation you're trying to fix here? I'm also using it in an unattended Docker container and do not recognize the issue of the token timing out so keen on learning more on where our scenarios deviate.

@NMauel

NMauel commented Nov 25, 2025

Copy link
Copy Markdown
Author

Are you able to shutdown the container for 10 minutes or more when it has been running for at least 10 minutes?

When the token is refreshed (after 10 minutes), the refresh token is also renewed. When you try to use the old token after a reboot (after more than 10 minutes) the refresh token is invalid. You need to re-register again (using the URL). Now, when the token is refreshed (including the refresh token) I get an event from the lib which provides me the new token.

I serialize it to Json and save it on disk (mounted volume). This way I can deserialize it on a reboot and use the refresh token to get me a new token (within 30 days) without re-registering my device again using the URL.

@NMauel
NMauel force-pushed the feature/implement-event-when-token-has-been-refreshed-or-changed branch from 450f88f to 50396d8 Compare November 26, 2025 21:20
@NMauel

NMauel commented Nov 26, 2025

Copy link
Copy Markdown
Author

Rebased on latest master...

@NMauel

NMauel commented Dec 3, 2025

Copy link
Copy Markdown
Author

@KoenZomers, I solved it by managing the token myself and re-authenticate at the library each time i have renewed the token. Closing PR.

@NMauel NMauel closed this Dec 3, 2025
@NMauel
NMauel deleted the feature/implement-event-when-token-has-been-refreshed-or-changed branch December 3, 2025 14:07
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