Doom Time Tracker: Displaying Steam Playtime on Ulanzi Pixel Clock

thumbnail

I recently bought a Ulanzi TC001 Smart Pixel clock and thought it was only logical to build a DOOM playtime counter in preparation for DOOM: The Dark Ages.

  • Pulls my playtime data from the Steam API.
  • Filters only the Doom-related games (Doom, Doom Eternal, Doom I+II and the upcoming ‘Dark Ages’).
  • Totals the hours and sends them to my Ulanzi Pixel Clock with the custom firmware AWTRIX 3 using its REST API.

This way, I have a live counter displaying my Doom playtime.

The PowerShell Script

# Define parameters
$ulanziIP = "<ULANZI_AWTRIX3_IP>"
$apiKey = "<YOUR_STEAM_API_KEY>"
$steamId = "<YOUR_STEAM_ID>"

# Construct the API URL
$apiUrl = "https://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=$apiKey&format=json&input_json="

# JSON payload is your Steam Id and the App IDs of the DOOM games
$jsonPayload = @{
    steamid       = $steamId
    appids_filter = @(379720, 782330, 2280, 3017860)
} | ConvertTo-Json -Compress

$fullUrl = "$apiUrl$([uri]::EscapeDataString($jsonPayload))"

$jsonSteam = Invoke-RestMethod -Uri $fullUrl `
    -Method GET `
    -Headers @{ "Content-Type" = "application/json" }

$minutes = 0

foreach ($g in $jsonSteam.response.games) {
    $minutes += $g.playtime_forever
}

$hours = $minutes / 60
$hours = [math]::Round($hours, 1)

Invoke-RestMethod -Uri "http://$ulanziIP/api/custom?name=doom" `
    -Method POST `
    -Headers @{ "Content-Type" = "application/json" } `
    -Body (@{ text = "$hours h" ; icon = "65799"; textCase = "0" } | ConvertTo-Json -Depth 10)

Getting Your Steam API Key and SteamID

  • To obtain a Steam API key, visit Steam API Key Registration.
  • Finding your SteamID is easy:
    • Log into Steam via your web browser or the Steam application.
    • Click your username in the top-right corner and select ‘Account details.’
    • Your 17-digit SteamID will appear near the top, right below your Steam username.
    • These numbers are your Steam 64-bit ID, which uniquely identify your Steam account.
    • More details at SteamID Finder.

How It Works

  1. Replace <YOUR_STEAM_API_KEY> and <YOUR_STEAM_ID> with your actual API key and Steam ID and <ULANZI_AWTRIX3_IP> with the IP address of your clock.
  2. The script fetches your game data from Steam.
  3. It filters only Doom-related games and sums up the total playtime (converted from minutes to hours).
  4. The total hours are then sent to your Ulanzi Pixel Clock using a simple REST API request.

Notes

  • Automation: The script can be scheduled to run periodically, keeping the playtime counter updated.
  • Customizable: You can easily adapt the script to track other games or display different stats.
  • Icon: I built the Cacodemon icon with the LaMetric designer based on this reddit post
  • Dark Ages ready: Once the new DOOM is out you’re good to go with the App ID 3017860 already integrated
  • Multi-platform-ready: Since PowerShell works on Windows / macOS / Linux this should run on all platforms
  • Security warning: Do NOT store your API key in source code and do not share it
[hardware] [coding] [doom]

Copyright 1998 - 2025 F. Hötzinger Klingerfeldstr. 2a 94550 Künzing
Mail: flo@3dshooter.com | Mastodon | Bluesky