Jump to content

New Plugin - Device Locations


Recommended Posts

Thuzad
Posted

Hello, I have installed the plugin and I have executed the scheduled tasks but it seems that I do not have information on the location of uses.

Everything seems well configured and I've tried disconnecting/reconnecting to see as well as leaving the plugin running for several days.

 

Is there anything else I should do?

Thuzad
Posted (edited)

I think the request for activity log return nothing

2025-05-09 14:06:59.342 Info EmbyDeviceLocations.ScheduledTasks: Starting User Device Activity Sync
2025-05-09 14:06:59.342 Debug EmbyDeviceLocations: AuthenticationRepository - Devices2 table has IpAddress col: True
2025-05-09 14:06:59.342 Debug EmbyDeviceLocations: AuthenticationRepository - SQL query to run: SELECT Devices2.Id, Devices2.ReportedName, Tokens_2.UserId, Devices2.IpAddress from Devices2 INNER JOIN Tokens_2 on Devices2.Id = Tokens_2.DeviceId WHERE Tokens_2.UserId is not null
2025-05-09 14:06:59.415 Debug EmbyDeviceLocations: AuthenticationRepository - Emby user device count: 15942
2025-05-09 14:06:59.416 Debug EmbyDeviceLocations: GetActivityLogs - ActivityLog schema columns: Id, Name, Overview, ShortOverview, LogSeverity, DateCreatedMs, InternalItemId, InternalUserId, TypeId
2025-05-09 14:06:59.416 Debug EmbyDeviceLocations: GetActivityLogs - CommandText: SELECT Id, TypeId, Name, COALESCE(ShortOverview, Overview) as COverview, DateCreatedMs, InternalUserId from ActivityLog WHERE DateCreatedMs > 0  AND ActivityLog.TypeId in (2,24) AND InternalUserId IS NOT NULL AND LENGTH(COverview) > 0 ORDER BY DateCreatedMs
2025-05-09 14:06:59.650 Debug EmbyDeviceLocations: SyncUserDeviceActivity - Activity log rows count: 0
2025-05-09 14:06:59.697 Info EmbyDeviceLocations.ScheduledTasks: Finished User Device Activity Sync
2025-05-09 14:06:59.697 Info TaskManager: Sync activity data Completed after 0 minute(s) and 0 seconds

2025-05-09 14:07:04.735 Info ScheduledTaskService-0HNCEKMNB9G9I:00000010: http/1.1 POST http://‌streaming.domain‍‌/emby/ScheduledTasks/Running/685b10c1914834de917e9f965ce01695?X-Emby-Client=Emby Web&X-Emby-Device-Name=Chromium Linux&X-Emby-Device-Id=2b5082f5-3972-4523-a3ea-ae1f208c7121&X-Emby-Client-Version=4.9.0.52&X-Emby-Token=‌xxxxxx&X-Emby-Language=fr. Source Ip: ‌X.X.X.X, UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
2025-05-09 14:07:04.735 Info TaskManager: Executing Enrich location data
2025-05-09 14:07:04.735 Info ScheduledTaskService-0HNCEKMNB9G9I:00000010: http/1.1 Response 204 to ‌X.X.X.X. Time: 0ms. POST http://‌streaming.domain‍‌/emby/ScheduledTasks/Running/685b10c1914834de917e9f965ce01695?X-Emby-Client=Emby Web&X-Emby-Device-Name=Chromium Linux&X-Emby-Device-Id=2b5082f5-3972-4523-a3ea-ae1f208c7121&X-Emby-Client-Version=4.9.0.52&X-Emby-Token=‌xxxxxx&X-Emby-Language=fr. 
2025-05-09 14:07:04.736 Info EmbyDeviceLocations.ScheduledTasks: Starting enrich GeoIP
2025-05-09 14:07:04.736 Debug EmbyDeviceLocations: EnrichGeoIPAsync - Successfully enriched 0 locations
2025-05-09 14:07:04.736 Info EmbyDeviceLocations.ScheduledTasks: Finished enrich GeoIP


I try an old version but it's the same.

 

EDIT: It's the TypeId that doesn't seem right, on my side I have 19 and so the SQL query works by adding it :

ActivityLog.TypeId in (19,2,24)

 

Edited by Thuzad
Posted

@mwongjaycan you take a look? If not, could you make the source code available so that I can edit the plugin and test it?

mwongjay
Posted
40 minutes ago, Thuzad said:

@mwongjaycan you take a look? If not, could you make the source code available so that I can edit the plugin and test it?

Can you upload the debug logs and pm your activity log db? In the newer versions 19 correlates to a failed scheduled task which doesn't have an ip address so can you elaborate on the behavior you say is working by adding 19 to the sql query?

Posted

I'm sorry, but for privacy reasons I don't want to share my entire database, as it contains too much personal information.

I'm posting my sql query anyway:

sqlite> SELECT Id, TypeId, Name, COALESCE(ShortOverview, Overview) as COverview, DateCreatedMs, InternalUserId from ActivityLog WHERE DateCreatedMs > 0  AND ActivityLog.TypeId in (19,2,24) AND InternalUserId IS NOT NULL ORDER BY DateCreatedMs ;

1348587|19|User1 s'est authentifié sur Emby|Organizr 192.168.1.195




Time

lundi 12 mai 2025 17:57|1747065446264|1
1348611|19|User2 s'est authentifié sur Emby|Safari macOS 90.X.X.X




Time

lundi 12 mai 2025 19:19|1747070378584|329
1348642|19|User3 s'est authentifié sur Emby|Gonve 86.X.X.X




Time

lundi 12 mai 2025 20:23|1747074223212|270

I'll send you the logs privately.

Posted

@Lukeor any Emby team member, do you have an idea why I not have the same schema of table "ActivityLogTypes" ?

sqlite> SELECT * from ActivityLogTypes;
1|PluginUpdateInstalled
2|UserPolicyUpdated
3|AuthenticationSucceeded
4|UserPasswordChanged
5|UserCreated
6|AuthenticationFailed
7|UserDeleted
8|VideoPlayback
9|VideoPlaybackStopped
10|SubtitleDownloadFailure
11|PluginInstalled
12|UserDownloadingContent
13|TaskFailed
14|PluginUninstalled
15|InstallationFailed
16|CameraImageUploaded
17|playback.start
18|playback.stop
19|user.authenticated
20|user.policyupdated
21|user.authenticationfailed
22|user.created
23|user.passwordchanged
24|plugins.pluginupdated
25|plugins.plugininstalled
26|plugins.pluginuninstalled
27|scheduledtasks.failed

table "ActivityLogTypes" of @mwongjay:

1	UserPolicyUpdated
2	AuthenticationSucceeded
3	PluginInstalled
4	PluginUninstalled
5	PluginUpdateInstalled
6	UserCreated
7	UserDeleted
8	VideoPlayback
9	VideoPlaybackStopped
10	TaskFailed
11	AuthenticationFailed
12	UserDownloadingContent
13	UserPasswordChanged
14	SubtitleDownloadFailure
15	AudioPlayback
16	AudioPlaybackStopped
17	InstallationFailed
18	Security
19	scheduledtasks.failed
20	playback.start
21	playback.stop
22	system.backupcompleted
23	plugins.pluginupdated
24	user.authenticated
25	plugins.plugininstalled
26	user.authenticationfailed
27	user.created
28	user.policyupdated
29	user.passwordchanged
30	plugins.pluginuninstalled
31	user.deleted
Posted

Those numbers will be different for every server.

  • Thanks 1
Posted (edited)

Thank you for your prompt feedback.
So do you recommend using the column with the text or the ID? I assume from your answer that it's the text, but is it likely to change in the future? Or is can be different for every server ?

Edited by Thuzad
Posted

use the column with the text to get the id.

please note, i don't recommend touching the database directly at all.

  • Like 1
  • 7 months later...
Skorpi
Posted

Funktioniert das Plugin nicht mehr? Die neueste Plugin Version hab ich installiert.

Emby Version 4.9.1.90 und 4.9.4.1 beta ausprobiert.


2026-01-09 16:05:28.813 Info EmbyDeviceLocations: Opening read connection
2026-01-09 16:05:28.813 Info EmbyDeviceLocations: Default journal_mode for /config/data/users.db is delete

2026-01-09 16:05:34.274 Info TaskManager: Executing Sync activity data
2026-01-09 16:05:34.275 Info EmbyDeviceLocations.ScheduledTasks: Starting User Device Activity Sync
2026-01-09 16:05:34.276 Info EmbyDeviceLocations: Opening read connection
2026-01-09 16:05:34.276 Info EmbyDeviceLocations: Default journal_mode for /config/data/authentication.db is delete
2026-01-09 16:05:34.276 Debug EmbyDeviceLocations: AuthenticationRepository - Devices2 table has IpAddress col: True
2026-01-09 16:05:34.276 Debug EmbyDeviceLocations: AuthenticationRepository - SQL query to run: SELECT Devices2.Id, Devices2.ReportedName, Tokens_2.UserId, Devices2.IpAddress from Devices2 INNER JOIN Tokens_2 on Devices2.Id = Tokens_2.DeviceId WHERE Tokens_2.UserId is not null
2026-01-09 16:05:34.276 Debug EmbyDeviceLocations: AuthenticationRepository - Emby user device count: 38
2026-01-09 16:05:34.277 Info EmbyDeviceLocations: Opening read connection
2026-01-09 16:05:34.277 Info EmbyDeviceLocations: Default journal_mode for /config/data/activitylog.db is delete
2026-01-09 16:05:34.278 Debug EmbyDeviceLocations: GetActivityLogs - ActivityLog schema columns: Id, Name, Overview, ShortOverview, TypeId, InternalItemId, InternalUserId, DateCreatedMs, LogSeverity
2026-01-09 16:05:34.278 Debug EmbyDeviceLocations: GetActivityLogs - CommandText: SELECT Id, TypeId, Name, CONCAT(ShortOverview, Overview) as COverview, DateCreatedMs, InternalUserId from ActivityLog WHERE DateCreatedMs > 0  AND ActivityLog.TypeId in (2,24) AND InternalUserId IS NOT NULL AND LENGTH(COverview) > 0 ORDER BY DateCreatedMs
2026-01-09 16:05:34.279 Debug EmbyDeviceLocations: SyncUserDeviceActivity - Activity log rows count: 28


2026-01-09 16:05:34.280 Debug EmbyDeviceLocations: SyncUserDeviceActivity - User devices lookup dict: {"1":[{"DeviceId":28,"DeviceName":"Phone","UserId":1,"IpAddress":"111.111.111.111"},{"DeviceId":37,"DeviceName":"Google Chrome Android","UserId":1,"IpAddress":"11.11.111.111"}]}

2026-01-09 16:05:34.285 Debug EmbyDeviceLocations: SyncUserDeviceActivity - No ip address found, skipping: {"Id":3010,"Name":"Die Benutzerrichtlinie wurde für xxxx aktualisiert","Overview":"\n\n\nTime\n\nSamstag, 20. Dezember 2025 12:13","Type":"2","DateCreatedMs":1766232793401,"UserId":2}
2026-01-09 16:05:34.285 Info EmbyDeviceLocations: SyncUserDeviceActivity - Successfully created 0 locations
2026-01-09 16:05:34.285 Info EmbyDeviceLocations.ScheduledTasks: Finished User Device Activity Sync
2026-01-09 16:05:34.285 Info TaskManager: Sync activity data Completed after 0 minute(s) and 0 seconds

Canaletto
Posted

Hello,
I am interested. What is the latest version, and does this plugin work with version 4.9.3.0? Is there anything else similar?
Thank you.

seanbuff
Posted
2 hours ago, Canaletto said:

Is there anything else similar?

If you run docker, you could check out https://www.tracearr.com/

  • Like 3
zcracker
Posted

v4.3.9.0 also has no data

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...