Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Manage Fritzbox session expiry #176

Open
zakx opened this issue Sep 16, 2018 · 4 comments
Open

Manage Fritzbox session expiry #176

zakx opened this issue Sep 16, 2018 · 4 comments
Labels
API Related to the exposed API of this project Enhancement Improvements on existing features pinned

Comments

@zakx
Copy link

zakx commented Sep 16, 2018

I've been trying to use a project built on your library that exposes Fritz!DECT smart home devices via HomeKit. In order for that to work, their application needs to run continuously, so it can answer to HomeKit API requests. They will do the Fritzbox login on application start, and everything works well then. After a few minutes (I didn't measure it, I guess about 30 minutes) On/Off requests via HomeKit will stop working. When I call Login() before On(), it will work indefinitely. Therefore I assume that the Fritzbox I am using has some kind of session expiry and I would love if your library would just transparently handle this, for example by checking if the current session would be expired and then logging in again before handling the original API request.

I assume it makes way more sense to fix this here than in the homekit-fritz project. I don't think I can contribute any code though, as I've never done any Go and my frist tries probably shouldn't end up in a decent library. I would appreciate it very much if somebody would consider implementing this. Thanks!

@bpicode bpicode added Enhancement Improvements on existing features API Related to the exposed API of this project labels Sep 17, 2018
@bpicode
Copy link
Owner

bpicode commented Sep 17, 2018

Hi @zakx,

thx for bringing this up.

Therefore I assume that the Fritzbox I am using has some kind of session expiry

That is correct. Sessions can expire after some time of inactivity. According to the docs it remains valid for 60 minutes after its last use. I have seen boxes behave differently in practice though.

if your library would just transparently handle this, for example by checking if the current session would be expired and then logging in again before handling the original API request.

That sounds like reasonable proposal. The main problem here is that currently there is no bullet-proof way to tell if a session is expired (from a client's perspective). Neither the API by AVM tells when a session loses validity nor do most FBoxes return an interpretable status code (like 401) when trying to use an invalid session.

I assume it makes way more sense to fix this here than in the homekit-fritz project.

I agree that it could be fixed here, provided one can come up with a reliable solution to detect session expiry.

As a side note, it is not uncommon for users of the api to work around this problem, see e.g. jayme-github/fritzbox_smarthome_exporter.

Anyway, I will give this some more thought.

Greets

@stale
Copy link

stale bot commented Mar 16, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Wontfix label Mar 16, 2019
@bpicode bpicode removed the Wontfix label Mar 16, 2019
@stale
Copy link

stale bot commented Sep 12, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Wontfix label Sep 12, 2019
@stale stale bot closed this as completed Oct 12, 2019
@bpicode bpicode removed the Wontfix label Dec 14, 2019
@bpicode bpicode reopened this Dec 14, 2019
@stale
Copy link

stale bot commented Jun 12, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Wontfix label Jun 12, 2020
@bpicode bpicode added pinned and removed Wontfix labels Jun 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API Related to the exposed API of this project Enhancement Improvements on existing features pinned
Projects
None yet
Development

No branches or pull requests

2 participants