This guide provides step-by-step instructions for beta testing the MMM-STStatus module on a Raspberry Pi.
- Prerequisites
- System Preparation
- MagicMirror Installation
- PM2 Process Manager Setup
- Module Installation
- SmartThings OAuth Setup
- Setup Wizard
- CLI Verification Script
- Test Mode Testing
- Live Testing
- Functional Test Checklist
- Performance Testing
- Troubleshooting
- Reporting Issues
- Raspberry Pi 4 or 5 (4GB RAM recommended)
- MicroSD card (32GB+ recommended)
- Power supply (official Pi power supply recommended)
- Monitor connected via HDMI
- Keyboard and mouse (for initial setup)
- Network connection (Ethernet or WiFi)
- Raspberry Pi OS Bookworm (64-bit)
- Fresh installation or existing system with updates applied
- SmartThings account with connected devices
- GitHub account (for repository access)
sudo apt update && sudo apt upgrade -y# Install Node.js 20.x (LTS)
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
# Verify installation
node --version # Should show v20.x.x
npm --version # Should show 10.x.x
# Install git
sudo apt install -y git# Check available memory
free -h
# Check disk space
df -hExpected:
- Memory: ~4GB total
- Disk: At least 5GB free
cd ~
git clone https://github.com/MagicMirrorOrg/MagicMirror
cd MagicMirrornpm run install-mmThis takes several minutes on a Pi.
cp config/config.js.sample config/config.jsnpm run startExpected: MagicMirror launches with default modules (clock, calendar, etc.)
Press Ctrl+Q to exit.
PM2 keeps MagicMirror running and auto-starts on boot.
sudo npm install -g pm2cat > ~/MagicMirror/mm.sh << 'EOF'
#!/bin/bash
cd ~/MagicMirror
DISPLAY=:0 npm start
EOF
chmod +x ~/MagicMirror/mm.shpm2 start ~/MagicMirror/mm.sh --name "MagicMirror"pm2 startup
# Run the command that PM2 outputs
pm2 save| Command | Description |
|---|---|
pm2 status |
Show process status |
pm2 logs MagicMirror |
View live logs |
pm2 logs MagicMirror --lines 100 |
View last 100 lines |
pm2 restart MagicMirror |
Restart MagicMirror |
pm2 stop MagicMirror |
Stop MagicMirror |
pm2 stop MagicMirrorcd ~/MagicMirror/modules
git clone https://github.com/sonnyb9/MMM-STStatus.git
cd MMM-STStatus
npm installls -laExpected files:
MMM-STStatus.js
node_helper.js
setup.js
oauth-utils.js
package.json
README.md
CHANGELOG.md
TESTING_GUIDE.md
LICENSE
css/
translations/
node_modules/
screenshots/
OAuth is required for authentication. Personal Access Tokens expire after 24 hours and are not supported.
Download from: https://github.com/SmartThingsCommunity/smartthings-cli/releases
On Raspberry Pi (Linux ARM64):
# Download the appropriate release for ARM64
wget https://github.com/SmartThingsCommunity/smartthings-cli/releases/download/v1.X.X/smartthings-linux-arm64.tar.gz
# Extract and install
tar -xzf smartthings-linux-arm64.tar.gz
sudo mv smartthings /usr/local/bin/
# Verify
smartthings --versionNote: Replace v1.X.X with the latest version from the releases page.
smartthings devicesA URL will be displayed - open it in a browser on another device to authenticate.
smartthings apps:createEnter:
- App type: OAuth-In App
- Display name:
MMM-STStatus - Description:
MagicMirror SmartThings Status Display - Icon image URL: (leave blank)
- Target URL: (leave blank)
- Scopes: Select:
r:devices:*x:devices:*r:locations:*
- Redirect URIs:
https://httpbin.org/get
IMPORTANT: Save the OAuth Client ID and Client Secret! You won't see them again.
The setup wizard handles OAuth authentication and generates your configuration.
cd ~/MagicMirror/modules/MMM-STStatus
node setup.jsStep 1: OAuth Authentication
- Enter your Client ID
- Enter your Client Secret
- Open the authorization URL in a browser
- After authorizing, copy the FULL redirect URL from your browser
- Paste it into the terminal
Step 2: Position Selection
- Choose where the module appears (e.g.,
top_right)
Step 3: Location Selection
- Select your SmartThings location
Step 4: Room Selection
- Enter room numbers (comma-separated) or
all
Step 5: Device Selection
- Enter device numbers (comma-separated),
all, ornone - Selecting
noneuses room-based selection
Step 6: Display Options
- Poll interval (default: 60 seconds)
- Show last updated time (Y/n)
- Temperature unit (F/C)
- Sort order (name/room/capability)
- Debug logging (y/N)
Step 7: Config Output
- Copy the generated config block
nano ~/MagicMirror/config/config.jsPaste the generated config into the modules array.
pm2 start MagicMirrorUse the standalone SmartThings test script before launching MagicMirror when you want to validate OAuth, device selection, and normalized status output from the terminal.
cd ~/MagicMirror/modules/MMM-STStatus
npm run test:smartthingsWhat it verifies:
- OAuth data can be loaded from
oauth-data.enc - The access token can be refreshed automatically when near expiry
MMM-STStatusdevices can be read from~/MagicMirror/config/config.js- Current device status can be fetched from the SmartThings API
.cache.jsonis updated with the latest successful responses
# Ignore configured devices and fetch every SmartThings device
npm run test:smartthings -- --all
# Output normalized JSON for debugging
npm run test:smartthings -- --raw
# Show request/discovery details
npm run test:smartthings -- --debug
# Read a different MagicMirror config file
npm run test:smartthings -- --config /path/to/config.jsSuccessful text output includes:
SmartThings check completed at ...Devices checked: NSuccessful updates: N- One line per device with name, ID, room, primary capability/state, and any temperature, humidity, battery, or thermostat details
If a device request fails, the script prints an ERROR | ... line for that device while continuing to check the rest.
No OAuth data found. Run node setup.js first.OAuth data is incomplete. Run node setup.js again.Token refresh failed (HTTP 401)if the stored refresh token is no longer validSmartThings API error ...if the API request fails for discovery or device status
Re-run node setup.js if OAuth files are missing or invalid.
Test mode uses mock data - useful for verifying the module works without SmartThings.
Edit config.js and set:
config: {
testMode: true,
debug: true
}Note: OAuth credentials are stored in encrypted files, not in config.js.
- Module appears in configured position
- Mock devices are displayed
- Icons appear correctly
- Colors are correct:
- Green: ON, CLOSED, LOCKED, HOME
- Red: OPEN, UNLOCKED
- Blue: MOTION
- Grey: OFF, AWAY
- "Last Update: HH:MM:SS" clock time shows
pm2 logs MagicMirror --lines 50Look for:
[MMM-STStatus] Test mode enabled, using mock data
- Your actual devices appear
- Device names match SmartThings app
- States are correct (compare with SmartThings app)
- Updates occur at poll interval
- Open SmartThings app on your phone
- Toggle a switch or open/close a door
- Wait for poll interval
- Verify change appears on mirror
The module auto-refreshes tokens every 12 hours. To test:
- Note the current time
- Check logs after 20+ hours for:
[MMM-STStatus] Scheduling token refresh [MMM-STStatus] Tokens refreshed successfully
ls -la ~/MagicMirror/modules/MMM-STStatus/.cache.json
cat ~/MagicMirror/modules/MMM-STStatus/.cache.json | head -20- Module loads without errors
- Module appears in correct position
- Header displays correctly
- Device table renders properly
- Icons display (Font Awesome)
- Colors match state
- Last update clock time shows/hides correctly
- Explicit device list works
- Room-based selection works
- Device names display correctly
- Primary state shows correctly
- Secondary attributes (battery, temp) show
- Temperature converts F ↔ C correctly
- Sorting works
- Switches: ON/OFF with lightbulb icon
- Contact sensors: OPEN/CLOSED with door icons
- Motion sensors: MOTION/— with person icons
- Locks: LOCKED/UNLOCKED with lock icons
- Presence: HOME/AWAY with house icons
- Temperature sensors: Correct reading with thermometer icon
- Thermostats: Temperature, setpoints, operating state colors
- Blinds/shades: Percentage with window icon
- Dimmers: Percentage with slider icon
- Battery: Percentage with appropriate battery icon
- Module continues after network errors
- Cache is used when API unavailable
- Error messages are user-friendly
- Footer alerts appear after 10 consecutive failures
- Alert auto-dismisses when API recovers
- Alert styling is yellow/amber and visible
-
testMode: trueuses mock data -
debug: trueshows verbose logs -
pollIntervalis respected -
showLastUpdated: falsehides last update time -
temperatureUnit: "C"shows Celsius
# While MagicMirror is running
ps aux | grep -E "(electron|node)" | grep -v grep
# Monitor over time
watch -n 5 'free -h'Expected: Memory stable, not continuously increasing.
top -o %CPU -n 1 -b | head -20Expected: Low CPU except brief spikes during updates.
Leave running for 24+ hours and verify:
- No memory leaks
- No crashes
- Token refresh works
- Updates continue
# Check logs
pm2 logs MagicMirror --lines 100
# Verify module directory
ls ~/MagicMirror/modules/MMM-STStatus/
# Check config.js syntax
node -c ~/MagicMirror/config/config.js# Re-run setup
cd ~/MagicMirror/modules/MMM-STStatus
node setup.js
# Check if OAuth files exist
ls -la oauth-key.bin oauth-data.enc# Reinstall dependencies
cd ~/MagicMirror/modules/MMM-STStatus
rm -rf node_modules
npm install- Increase
pollIntervalto 120000 (2 minutes) - Reduce number of devices
- Set
debug: false
When reporting bugs, please include:
uname -a
node --version
npm --version
cat ~/MagicMirror/package.json | grep version
cat ~/MagicMirror/modules/MMM-STStatus/package.json | grep version# Module logs (with debug: true in config)
pm2 logs MagicMirror --lines 200 2>&1 | grep -i ststatus# Show config (no secrets are stored in config.js)
cat ~/MagicMirror/config/config.js | grep -A 20 "MMM-STStatus"- Steps to reproduce
- Expected behavior
- Actual behavior
- Screenshots if applicable
| Test | Date | Result | Notes |
|---|---|---|---|
| System prep | ☐ Pass ☐ Fail | ||
| MM install | ☐ Pass ☐ Fail | ||
| Module install | ☐ Pass ☐ Fail | ||
| OAuth setup | ☐ Pass ☐ Fail | ||
| Setup wizard | ☐ Pass ☐ Fail | ||
| Test mode | ☐ Pass ☐ Fail | ||
| Live testing | ☐ Pass ☐ Fail | ||
| Device types | ☐ Pass ☐ Fail | ||
| Error handling | ☐ Pass ☐ Fail | ||
| Performance (24h) | ☐ Pass ☐ Fail |
Guide Version: 2.4 | Last Updated: 2026-04-10