Skip to main content

Tool implementing real-time tracking of Steam players activities

Project description

steam_monitor

steam_monitor is a tool for real-time monitoring of Steam players' activities.

Features

  • Real-time tracking of Steam users' gaming activity (including detection when a user gets online/offline or plays games)
  • Basic statistics for user activity (such as how long in different states, how long a game is played, overall time and the number of played games in the session etc.)
  • Detailed user information display mode providing comprehensive Steam profile insights
  • Email notifications for different events (when a player gets online/away/snooze/offline, starts/finishes/changes a game or errors occur)
  • Saving all user activities with timestamps to a CSV file
  • Possibility to control the running copy of the script via signals
  • Functional, procedural Python (minimal OOP)

steam_monitor_screenshot

Table of Contents

  1. Requirements
  2. Installation
  3. Quick Start
  4. Configuration
  5. Usage
  6. Change Log
  7. License

Requirements

  • Python 3.6 or higher
  • Libraries: steam, requests, python-dateutil, python-dotenv

Tested on:

  • macOS: Ventura, Sonoma, Sequoia, Tahoe
  • Linux: Raspberry Pi OS (Bullseye, Bookworm, Trixie), Ubuntu 24/25, Rocky Linux 8.x/9.x, Kali Linux 2024/2025
  • Windows: 10, 11

It should work on other versions of macOS, Linux, Unix and Windows as well.

Installation

Install from PyPI

pip install steam_monitor

Manual Installation

Download the steam_monitor.py file to the desired location.

Install dependencies via pip:

pip install "steam[client]" requests python-dateutil python-dotenv

Alternatively, from the downloaded requirements.txt:

pip install -r requirements.txt

Upgrading

To upgrade to the latest version when installed from PyPI:

pip install steam_monitor -U

If you installed manually, download the newest steam_monitor.py file to replace your existing installation.

Quick Start

steam_monitor <steam_user_id> -u "your_steam_web_api_key"

Or if you installed manually:

python3 steam_monitor.py <steam_user_id> -u "your_steam_web_api_key"

To get the list of all supported command-line arguments / flags:

steam_monitor --help

Configuration

Configuration File

Most settings can be configured via command-line arguments.

If you want to have it stored persistently, generate a default config template and save it to a file named steam_monitor.conf:

steam_monitor --generate-config > steam_monitor.conf

Edit the steam_monitor.conf file and change any desired configuration options (detailed comments are provided for each).

Steam Web API key

You can get the Steam Web API key here: http://steamcommunity.com/dev/apikey

Provide the STEAM_API_KEY secret using one of the following methods:

  • Pass it at runtime with -u / --steam-api-key
  • Set it as an environment variable (e.g. export STEAM_API_KEY=...)
  • Add it to .env file (STEAM_API_KEY=...) for persistent use

Fallback:

  • Hard-code it in the code or config file

If you store the STEAM_API_KEY in a dotenv file you can update its value and send a SIGHUP signal to the process to reload the file with the new API key without restarting the tool. More info in Storing Secrets and Signal Controls (macOS/Linux/Unix).

User Privacy Settings

In order to monitor Steam user activity, proper privacy settings need to be enabled on the monitored user account.

The user should go to Steam Privacy Settings.

The value in My Profile → Game details should be set to Friends Only or Public.

SMTP Settings

If you want to use email notifications functionality, configure SMTP settings in the steam_monitor.conf file.

Verify your SMTP settings by using --send-test-email flag (the tool will try to send a test email notification):

steam_monitor --send-test-email

Storing Secrets

It is recommended to store secrets like STEAM_API_KEY or SMTP_PASSWORD as either an environment variable or in a dotenv file.

Set environment variables using export on Linux/Unix/macOS/WSL systems:

export STEAM_API_KEY="your_steam_web_api_key"
export SMTP_PASSWORD="your_smtp_password"

On Windows Command Prompt use set instead of export and on Windows PowerShell use $env.

Alternatively store them persistently in a dotenv file (recommended):

STEAM_API_KEY="your_steam_web_api_key"
SMTP_PASSWORD="your_smtp_password"

By default the tool will auto-search for dotenv file named .env in current directory and then upward from it.

You can specify a custom file with DOTENV_FILE or --env-file flag:

steam_monitor <steam_user_id> --env-file /path/.env-steam_monitor

You can also disable .env auto-search with DOTENV_FILE = "none" or --env-file none:

steam_monitor <steam_user_id> --env-file none

As a fallback, you can also store secrets in the configuration file or source code.

Usage

Detailed User Information Display Mode

To display comprehensive Steam profile information for a user without starting monitoring, type the player's Steam64 ID (steam_user_id in the example below) and use the -i / --info flag:

steam_monitor <steam_user_id> -i

Or with a Steam community URL:

steam_monitor -r "https://steamcommunity.com/id/steam_username/" -i

This mode displays detailed information including:

  • Steam64 ID, display name, real name
  • Country/region
  • Current status and profile visibility
  • Account creation date
  • Profile URL
  • Steam level, badges earned and XP statistics
  • Ban status (VAC, Community, Economy)
  • Friends count
  • Top games by lifetime hours
  • Recently played games with playtime statistics
  • Hours played in the last 2 weeks

The tool displays this information and then exits (does not start monitoring).

Monitoring Mode

To monitor specific user activity, just type the player's Steam64 ID (steam_user_id in the example below):

steam_monitor <steam_user_id>

If you have not set STEAM_API_KEY secret, you can use -u flag:

steam_monitor <steam_user_id> -u "your_steam_web_api_key"

If you do not know the user's Steam64 ID, but you know the Steam profile/community URL (which can be customized by the user), you can also run the tool with -r flag which will automatically resolve it to Steam64 ID:

steam_monitor -r "https://steamcommunity.com/id/steam_username/"

When monitoring starts, the tool displays user information including Steam64 ID, display name, real name (if available), country/region, current status, profile visibility, account creation date and profile URL.

By default, the tool looks for a configuration file named steam_monitor.conf in:

  • current directory
  • home directory (~)
  • script directory

If you generated a configuration file as described in Configuration, but saved it under a different name or in a different directory, you can specify its location using the --config-file flag:

steam_monitor <steam_user_id> --config-file /path/steam_monitor_new.conf

The tool runs until interrupted (Ctrl+C). Use tmux or screen for persistence.

You can monitor multiple Steam players by running multiple instances of the script.

The tool automatically saves its output to steam_monitor_<user_steam_id/file_suffix>.log file. The log file name can be changed via ST_LOGFILE configuration option and its suffix via FILE_SUFFIX / -y flag. Logging can be disabled completely via DISABLE_LOGGING / -d flag.

The tool also saves the timestamp and last status (after every change) to the steam_<user_display_name>_last_status.json file, so the last status is available after the restart of the tool.

Email Notifications

To enable email notifications when a user gets online or offline:

  • set ACTIVE_INACTIVE_NOTIFICATION to True
  • or use the -a flag
steam_monitor <steam_user_id> -a

To be informed when a user starts, stops or changes the played game:

  • set GAME_CHANGE_NOTIFICATION to True
  • or use the -g flag
steam_monitor <steam_user_id> -g

To get email notifications about any changes in user status (online/away/snooze/offline):

  • set STATUS_NOTIFICATION to True
  • or use the -s flag
steam_monitor <steam_user_id> -s

To disable sending an email on errors (enabled by default):

  • set ERROR_NOTIFICATION to False
  • or use the -e flag
steam_monitor <steam_user_id> -e

Make sure you defined your SMTP settings earlier (see SMTP settings).

Example email:

steam_monitor_email_notifications

CSV Export

If you want to save all reported activities of the Steam user to a CSV file, set CSV_FILE or use -b flag:

steam_monitor <steam_user_id> -b steam_user_id.csv

The file will be automatically created if it does not exist.

Check Intervals

If you want to customize polling intervals, use -k and -c flags (or corresponding configuration options):

steam_monitor <steam_user_id> -k 30 -c 120
  • STEAM_ACTIVE_CHECK_INTERVAL, -k: check interval when the user is online, away or snooze (seconds)
  • STEAM_CHECK_INTERVAL, -c: check interval when the user is offline (seconds)

Signal Controls (macOS/Linux/Unix)

The tool has several signal handlers implemented which allow to change behavior of the tool without a need to restart it with new configuration options / flags.

List of supported signals:

Signal Description
USR1 Toggle email notifications when user gets online or offline (-a)
USR2 Toggle email notifications when user starts/stops/changes the game (-g)
CONT Toggle email notifications for all user status changes (online/away/snooze/offline) (-s)
TRAP Increase the check timer for player activity when user is online/away/snooze (by 30 seconds)
ABRT Decrease check timer for player activity when user is online/away/snooze (by 30 seconds)
HUP Reload secrets from .env file

Send signals with kill or pkill, e.g.:

pkill -USR1 -f "steam_monitor <steam_user_id>"

As Windows supports limited number of signals, this functionality is available only on Linux/Unix/macOS.

Coloring Log Output with GRC

You can use GRC to color logs.

Add to your GRC config (~/.grc/grc.conf):

# monitoring log file
.*_monitor_.*\.log
conf.monitor_logs

Now copy the conf.monitor_logs to your ~/.grc/ and log files should be nicely colored when using grc tool.

Example:

grc tail -F -n 100 steam_monitor_<user_steam_id/file_suffix>.log

Change Log

See RELEASE_NOTES.md for details.

License

Licensed under GPLv3. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

steam_monitor-1.4.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

steam_monitor-1.4-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

Details for the file steam_monitor-1.4.tar.gz.

File metadata

  • Download URL: steam_monitor-1.4.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.9

File hashes

Hashes for steam_monitor-1.4.tar.gz
Algorithm Hash digest
SHA256 438754821afcf75070bc1f2cb1e728e45278d71d896f6da5492b5e0b2778a0e2
MD5 eff60edbacac9d96ffbb96bae0c103a3
BLAKE2b-256 7a8aa110fb152ddcc33a731883894ad03ab9bd978213931f58b4da2e5835cfb5

See more details on using hashes here.

File details

Details for the file steam_monitor-1.4-py3-none-any.whl.

File metadata

  • Download URL: steam_monitor-1.4-py3-none-any.whl
  • Upload date:
  • Size: 32.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.9

File hashes

Hashes for steam_monitor-1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8777a75f0e50c28fd20d9189bdd62faa44ec941841cd390c89909e622228b0f1
MD5 a99aea30eb67c4f6d8435a6590513e57
BLAKE2b-256 b164c3be80a956f1fa3a3dd37bf8a6b9c9310a26f66d5660c877f7e2a97e8b66

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page