ClementNerma / tapo-rest

An unofficial REST API to remotely control Tapo devices
43 stars 3 forks source link

Session ID lifespan #11

Closed marshallartsoz closed 2 months ago

marshallartsoz commented 2 months ago

Not an issue, just a question... Does the Session ID returned from the login call have a lifespan, or can it effectively last forever? By "forever", I mean could my monitoring app do the login call at startup and then use that Session ID for as long as it runs? If the ID expires at some time, then I guess I will need to do the login call again every so often. If so, do you know how often? Is it just time-based or does it depend on activity, that is, if I keep making calls e.g. for P110 energy usage on a regular basis, will that keep the Session ID valid? Thanks.

ClementNerma commented 2 months ago

Currently these sessions never expire. I may introduce in the future options to limit their lifespan, but by default they don't have such limit. So for your use case, this will work perfectly. The session ID is basically an access token for the server, but the actual authentication process to the Tapo devices is separated from it.