Command Sets
Command Sets are collections of named commands that can be sent to devices. They are primarily used for infrared (IR) control and custom communication protocols.
Overview
The Command Sets page manages libraries of commands for controlling devices. GEM provides three powerful ways to populate command sets: importing from GEM's cloud repository, importing from the global IRDB database, or importing from Global Cache IR files.
Viewing Command Sets
The main grid displays all configured command sets with the following columns:
- ID - Unique identifier
- Name - Internal command set name
- Description - Purpose or device model description
Grid Actions
- Add - Create a new empty command set
- Edit - View and manage commands in the set (opens Commands page)
- Delete - Remove a command set
- Reload - Refresh the grid data
Creating a Command Set
You can create command sets in three ways:
1. Manual Creation
For custom or proprietary protocols:
- Click Add in the grid
- Enter a name (will be auto-formatted to lowercase_with_underscores)
- The empty command set is created
- Click Edit to add individual commands
2. Browse GEM Repository
Import professionally-maintained command sets from GEM's cloud repository:
- Click Browse GEM button
- Search for your device manufacturer or model
- Review the available command sets:
- Device name and description
- File size and modification date
- Click Import on the desired command set
Merge Behavior:
- If a command set with the same name exists, you'll be prompted to merge
- Matching commands are updated with new templates
- New commands are added
- Your custom commands are preserved
3. Browse IRDB
Import from the global Infrared Remote Database (IRDB) containing thousands of IR codes:
- Click Browse IRDB button
- Search by manufacturer name or device type (e.g., "Sony", "TV", "Cable")
- The grid displays all matching devices:
- Manufacturer name
- Device type
- Filename
- Click Import on the desired device
Conversion Process:
- IRDB codes are stored in various formats (NEC, RC5, Sony, etc.)
- GEM automatically converts all codes to Pronto Hex format
- A progress message shows conversion status
- Successfully converted commands are added to a new command set
Command Set Naming:
- Auto-generated:
manufacturer_devicetype_filename - Example:
sony_dvd_player_dvp_ns575p
4. Import Global Cache IR
Import command sets from Global Cache's IR database emails:
- Obtain an IR database file from Global Cache (usually emailed as .txt or .csv)
- Click Import GC IR button
- Select your downloaded file
- Enter a name for the new command set
- GEM parses and imports all commands
Supported Format:
"command_name","sendir,1:1,<pronto_hex_code>"
Commands are automatically cleaned:
digit_prefix is removed (e.g.,digit_1becomes1)cursor_prefix is removed (e.g.,cursor_upbecomesup)
Managing Commands
After creating a command set, click Edit to open the Commands page where you can:
- Add individual commands
- Edit command templates
- Test command execution
- Configure command parameters
- Delete unwanted commands
- Export commands to JSON
See the Commands documentation for detailed information on command management.
Command Set Naming
Command sets follow the same naming convention as other GEM entities:
- Internal Name: Lowercase with underscores (e.g.,
sony_dvd_ns575p) - Description: Human-readable text (e.g., "Sony DVD Player NS575P")
The name field is automatically formatted when you click away from it.
Common Use Cases
IR Control
Command sets are most commonly used for infrared control of:
- TVs and displays
- Cable/satellite boxes
- DVD/Blu-ray players
- Audio receivers
- Projectors
- Fans and lighting (IR-controlled)
Serial/TCP Protocols
Command sets can also store:
- RS-232 command strings
- TCP/IP protocol commands
- HTTP API requests
- Custom hexadecimal sequences
Command Templates
Commands support template variables for dynamic values:
POWER:{state}
VOLUME:{level}
INPUT:{input_number}
These templates are processed by device drivers when sending commands.
Merging and Updating Command Sets
When importing a command set that already exists:
- Confirmation Dialog appears explaining the merge process
- If you proceed:
- Existing commands with matching names are updated
- New commands are added
- Your custom commands are preserved
- A summary shows counts of updated and added commands
This allows you to:
- Update command sets when new versions are available
- Add missing commands to an existing set
- Sync with the latest GEM or IRDB data
IRDB (Infrared Remote Database)
The IRDB integration provides access to a massive collection of IR codes:
Coverage
- Thousands of manufacturers
- Multiple device types per manufacturer
- Community-maintained and updated regularly
- Open-source database
Device Types
Common IRDB categories include:
- TV
- Cable Box, Satellite Box
- DVD, Blu-ray
- Receiver, Amplifier
- Air Conditioner
- Fan
- Projector
- Soundbar
IR Code Formats
IRDB stores codes in various formats:
- NEC, NECx, NEC48
- RC5, RC6
- Sony (SIRC)
- Samsung
- Panasonic
- And many more proprietary protocols
GEM's IR converter translates all these formats to Pronto Hex for universal compatibility with IR emitters.
Pronto Hex Format
All IR commands in GEM are stored as Pronto Hex:
0000 006D 0022 0002 0155 00AA ...
Advantages:
- Universal format understood by all IR emitters
- Manufacturer-agnostic
- Includes carrier frequency and timing information
- Easy to test and validate
Compatibility:
- Global Cache IR devices
- iTach IR
- IP2IR
- RedRat
- Most professional IR equipment
Tips and Best Practices
-
Search Strategy: When browsing IRDB or GEM repository, try multiple search terms:
- Full model number: "DVP-NS575P"
- Partial model: "NS575"
- Manufacturer only: "Sony"
- Device type: "DVD"
-
Testing: After importing, test critical commands (Power, Volume, Input) before deploying
-
Cleanup: Remove unused commands to keep command sets manageable
-
Naming: Use descriptive names that include manufacturer and model
-
Backup: Export command sets periodically (use DataGrid export feature)
-
Documentation: Add descriptions to command sets noting:
- Which physical devices they control
- Any special configuration requirements
- Date imported and source
-
Updates: Check for updated command sets periodically in the GEM repository
Troubleshooting
Import Fails
GEM Repository Issues:
- Check network connectivity
- Verify firewall allows access to GEM servers
- Try again later if servers are temporarily unavailable
IRDB Issues:
- IRDB index may take 10-20 seconds to load (thousands of devices)
- Some obscure devices may not have codes available
- Try alternate search terms or manufacturer names
Global Cache Import:
- Verify file format matches expected CSV structure
- Check that file contains valid Pronto Hex codes
- Ensure file is plain text (not a binary format)
IR Commands Don't Work
- Wrong Device: Verify you imported codes for the correct model
- IR Emitter Position: Ensure IR emitter has line-of-sight to device sensor
- Code Format: Some devices may require specific code variants
- Device Mode: Some devices require codes for specific modes (TV mode, DVD mode, etc.)
Duplicate Commands
When importing multiple sources, you may get duplicate command names. GEM handles this by:
- Updating existing commands during merge
- Preserving your customizations
- Showing a detailed merge report
Advanced Topics
Command Arguments
Commands can accept dynamic arguments:
{
"args": ["power"],
"arg_options": {
"power": ["on", "off", "toggle"]
}
}
This allows a single command template to handle multiple variations.
Command Macros
Complex operations can combine multiple commands with delays:
{
"name": "watch_tv",
"macro": [
{"command": "tv_power_on"},
{"delay": 2000},
{"command": "receiver_power_on"},
{"delay": 1000},
{"command": "receiver_input_tv"}
]
}
Export and Import
Use the grid Export button to:
- Back up command sets to JSON
- Share command sets between GEM installations
- Version control command library changes
- Submit new command sets to the GEM repository
To export only specific rows, multi-select them first (click-and-drag or Ctrl+Click) and use Export Selected.
Related Documentation
- Commands Page - Managing individual commands
- Devices - Assigning command sets to devices
- Response Sets - Parsing device feedback
- Macros - Automating command sequences