Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teams presence sensor enhancement #197

Closed
NightMean opened this issue Jan 4, 2024 · 17 comments
Closed

Teams presence sensor enhancement #197

NightMean opened this issue Jan 4, 2024 · 17 comments
Labels
enhancement New feature or request

Comments

@NightMean
Copy link

Hi,
First of all, thanks for working on this integration!

With the reference to #19 I've noticed that Microsoft allows to write a presence status via Presence.ReadWrite as per their documentation

Having this, I could sync my Teams status with Webex and other stuff that I'm currently doing when I don't want to be bothered :)
There is also Presence.Read.All which could be used to let me know once colleague is back at office for example.
Would it be possible to add this feature ?

image

@RogerSelwyn
Copy link
Owner

I'll take a look ReadWrite. I don't see me doing anything with Read.All, because you will need to input who's presence you want to read somehow, but I'll take a look.

@NightMean
Copy link
Author

Thank you! I assume that Read.All it would require to input user email address at best or at the worst, their User ID. I know it would be pretty specific but I could also see a use case for other colleagues who might not be able to get their admin approval. It's way easier to send the status from my HomeAssistant to theirs rather than fighting with a security admin haha :)

Of course, the ReadWrite would be the most useful.

@RogerSelwyn
Copy link
Owner

Currently there is no support in the library I use to access O365. Previous experience is that it can take a long time to get features added to the library. This is the python code set that supports Teams elements - https://github.com/O365/python-o365/blob/master/O365/teams.py.

@NightMean
Copy link
Author

Ah, that's a pity.. Is there no other way to add it? I found this https://alexholmeset.blog/2022/01/09/set-presence-for-an-end-user-in-microsoft-teams/ which doesn't look that bad, only if it was a python code :)

I fully understand if you don't want to add something outside the library that you are using.

@RogerSelwyn
Copy link
Owner

I'm not going to start using random other bits of code I'm afraid (certainly not PowerShell). I didn't say it wouldn't get done, I said it will likely take time (months). I have contributed to that library before, so I will consider if I do the same again.

@NightMean
Copy link
Author

Understood. Thanks for your effort.

@RogerSelwyn
Copy link
Owner

I think it needs this:-

https://learn.microsoft.com/en-us/graph/api/presence-setuserpreferredpresence?view=graph-rest-1.0&tabs=http

Not:-

https://learn.microsoft.com/en-us/graph/api/presence-setpresence?view=graph-rest-1.0&tabs=http

Set Presence requires a sessionId, which I guess is created by Teams or the like. No idea, and can't easily see. Anyway Set Preferred Presence seems to do the job when I tried it in Graph Explorer.

@NightMean
Copy link
Author

Hm interesting. The preferredpresence does have the same options for status as Teams does in UI while the setpresence shows activities that are set only by another apps. I think it would require combination from both of those 2.
When I'm in Webex call, I'd like to set the presence as InACall instead of just Busy. However I'm not sure if it would be possible to get the SessionID of currently running Teams easily.

@RogerSelwyn
Copy link
Owner

Done some more reading, looks like I should use client_id (application_id) in the session_id field. I'll take a look at it some time next week.

@RogerSelwyn RogerSelwyn added the enhancement New feature or request label Jan 6, 2024
@RogerSelwyn
Copy link
Owner

I have submitted a PR for the library updates here - O365/python-o365#1038 - I'll look to work on the integration when that has been merged and released (last release was in September).

@NightMean
Copy link
Author

Wow, cool! Thanks for the update.

@RogerSelwyn
Copy link
Owner

Whilst the change has been released in the library, there are other changes in the library which have broken the integration. I have had some interaction with the library owner, but I'm awaiting resolution before I can progress.

Copy link

This issue is stale because it has been open for 30 days with no activity.

@RogerSelwyn
Copy link
Owner

I've added the ability to update user status, it will be in the next release. I need to think about the other part of this request, to monitor another users presence.

@NightMean
Copy link
Author

Perfect! Thanks a lot!
I will test it once it's released :)

@RogerSelwyn
Copy link
Owner

@RogerSelwyn
Copy link
Owner

I'll probably tag a few posts, but I'm trying to get some views. I'm considering breaking up the monolithic O365 integration into smaller, more manageable items. If you have a view, please comment here:

O365 --> MS365 - A potential big change - your views needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants