mirror of
https://github.com/misiektoja/xbox_monitor.git
synced 2026-04-26 23:45:50 +03:00
[GH-ISSUE #2] 'Last time user was available' is stale if user set to 'appear offline' #3
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/xbox_monitor#3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tomballgithub on GitHub (Jan 21, 2026).
Original GitHub issue: https://github.com/misiektoja/xbox_monitor/issues/2
If user sets themself to 'appear offline', the LastSeenRecord timestamp no longer updates.
However, the timestamp on when they've played individual titles does update.
Can we use that to check for when user becomes active/inactive?
For instance, here is the PresenceRecord for a user, showing no activiity since Dec 8th:
[PresenceItem(xuid='XXX', state='Offline', last_seen=LastSeen(device_type='Scarlett', title_id='750323071', title_name='', timestamp='2025-12-08T09:45:16.8363999'), devices=None)]However, if you do the command titlehub.get_title_history, the following is provided for this user, showing a game played on Jan 10th.
I don't know if that information is updated real-time or after-title-is-exited.
I need to look at this while a user is active/online.
[remaining is truncated for brevity]
@tomballgithub commented on GitHub (Jan 22, 2026):
I verified that the 'last played' time as shown using the -i command line argument does update, but it seems to be set to the last time the user started playing the game, as opposed to updating while they are playing. I haven't confirmed if there is an update when a user end play.
User became active at approximately 21:31
@tomballgithub commented on GitHub (Jan 22, 2026):
I verified that the last played only updates at the start of a play session, not during or at the end.
@misiektoja commented on GitHub (Jan 23, 2026):
Ok, I think i fixed it in
a36c7a4. The last_time_played timestamp only updates when a game session starts, not during or at the end. So we can detect when someone became active, but not when they stopped. Let me know how it works for you.@tomballgithub commented on GitHub (Jan 23, 2026):
I'll test it out. Thanks!
@tomballgithub commented on GitHub (Jan 24, 2026):
Looks good to me for both -i and normal mode! startup
@tomballgithub commented on GitHub (Jan 24, 2026):
So, I think you literally fixed the issue I reported, which is 'last time user was available' now reflects accurately.
Your last comment said 'can detect when someone became active', but the code doesn't actually do that, right? It simply shows the correct last online time for -i or at startup.
Can you make it treat detection of a new "xbox_get_latest_title_played_ts()" as becoming 'active'? And in this mode, I guess there's no need to send 'offline' messages. I would take just a new email & console update each time "xbox_get_latest_title_played_ts()" indicates new activity in this case.
Regardless, you added this code in the main loop, but I don't see that it does anything, as
lastonline_tsis not used after that point. In fact, it doesn't seem to be used in the main loop at all:@tomballgithub commented on GitHub (Jan 24, 2026):
And there's a bug. I am seeing the following when I loaded a new instance for someone who is not blocking activity.
@tomballgithub commented on GitHub (Jan 24, 2026):
If I disable the new title timestamp feature, it should look like this. The above example is missing the "User is Online for 8 minutes"
@misiektoja commented on GitHub (Jan 25, 2026):
You are absolutely right!
The initial implementation had a few bugs — it was incorrectly triggering for online users and wasn't actually detecting new activity in real-time.
I've fixed this (
e84413f) so the title history fallback now only applies when a user is truly appearing offline.Additionally, the tool now actively tracks changes in title history while monitoring, so you'll receive a notification whenever a new game session is detected for an 'offline' user.
Let me know how it looks for you now!
@tomballgithub commented on GitHub (Jan 26, 2026):
With latest code, I see user is offline, then it says active from a past game on Jan 10.
There was not a JSON file for this user with any saved state.
When I restarted, and there was a JSON, it didn't go 'active' and send the email like the 1st time.
So likely just a corner case when there is no JSON
@tomballgithub commented on GitHub (Jan 26, 2026):
Actually, I did see it on a restart with a JSON, shown here by 'loaded from file'
@misiektoja commented on GitHub (Jan 26, 2026):
Good catch, I missed that. Just pushed the fix (
38ef438).@tomballgithub commented on GitHub (Jan 28, 2026):
I'm still seeing something:
Another random observation:
@misiektoja commented on GitHub (Feb 6, 2026):
It should be fixed in
d715aa704a. Please test and let me know!@tomballgithub commented on GitHub (Feb 21, 2026):
Fixed