OC
OceanRemote
Low-code IoT platform
โ† Back to Tutorials
โ† Previous Next โ†’

Tutorial 23: Customizing Relay Names and Logic

๐Ÿ“– What You'll Learn in This Tutorial:
  • โœ“ How to customize relay names in OceanRemote
  • โœ“ Changing relay logic (Positive/Negative) after device creation
  • โœ“ Best practices for naming relays
  • โœ“ Understanding when to change logic settings
  • โœ“ Managing multiple relays effectively

Why Customize Relay Names?

Default relay names (Relay 1, Relay 2, etc.) work fine, but custom names make your dashboard much easier to use:

  • Instant recognition - "Living Room Light" instead of "Relay 1"
  • Fewer mistakes - Less chance of turning off the wrong device
  • Professional appearance - Clean, organized dashboard
  • Multi-language support - Use any language or characters
  • Family-friendly - Anyone can understand what each button does
Example of Customized Dashboard:
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ My Devices                                                โ”‚
โ”‚                                                           โ”‚
โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚ โ”‚ Kitchen Controller                           โ— ONLINE โ”‚ โ”‚
โ”‚ โ”‚                                                       โ”‚ โ”‚
โ”‚ โ”‚ RELAYS                                                โ”‚ โ”‚
โ”‚ โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚ โ”‚
โ”‚ โ”‚ โ”‚    ๐Ÿ”ป          ๐Ÿ”บ           ๐Ÿ”ป          ๐Ÿ”บ        โ”‚ โ”‚
โ”‚ โ”‚ โ”‚  Lights  โ”‚ โ”‚   Fan    โ”‚ โ”‚   Pump   โ”‚ โ”‚  Heater  โ”‚   โ”‚ โ”‚
โ”‚ โ”‚ โ”‚   OFF    โ”‚ โ”‚   OFF    โ”‚ โ”‚   OFF    โ”‚ โ”‚   OFF    โ”‚   โ”‚ โ”‚
โ”‚ โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚ โ”‚
โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

How to Customize Relay Names

Method 1: During Device Creation (Recommended)

  1. Go to "Add New Device" page (/your-device/)
  2. Fill in your board type, WiFi credentials, and sensor settings
  3. In the "Relay Configuration" section, you'll see 5 fields:
็ƒง
๐Ÿ’ก Pro Tip:

Keep names short but descriptive. "Lights" is better than "Living Room Ceiling Lights". The button has limited space, especially on mobile devices.

Method 2: After Device Creation (Edit Existing Device)

  1. Go to your OceanRemote dashboard
  2. Find your device card
  3. Click the "DETAILS" button
  4. In the device detail page, you'll see all relay names and logic settings
  5. Click the edit icon (โœ๏ธ) next to any relay name
  6. Enter the new name and save
  7. Changes take effect immediately (no re-flashing needed!)
๐Ÿ”ง No Re-flash Required!

Relay names are stored on the server, not in the firmware. When you change a name, the dashboard updates instantly. Your device doesn't need to know the names - it only cares about relay numbers (1-5).

Customizing Relay Logic

As explained in Tutorial 22, relay logic determines whether the relay turns ON with a HIGH or LOW signal. You can change this setting anytime.

How to Change Relay Logic:

  1. Go to your device's "DETAILS" page
  2. Find the relay you want to modify
  3. Click the logic selector (๐Ÿ”บ or ๐Ÿ”ป)
  4. Choose the correct logic:
    • ๐Ÿ”บ Positive Logic - HIGH = ON, LOW = OFF
    • ๐Ÿ”ป Negative Logic - LOW = ON, HIGH = OFF
  5. Save changes (immediate effect)
โš ๏ธ Important:

If you change the logic setting, your relay will immediately change state if the current button state doesn't match the new logic. Test your device after changing logic to ensure everything works correctly.

Best Practices for Naming Relays

Do's โœ…

  • Use short, descriptive names (max 15 characters)
  • Use consistent naming conventions (e.g., all lights: "Kitchen Light", "Living Light")
  • Include the device type if you have multiple similar devices
  • Use uppercase for first letter (looks more professional)
  • Test on mobile view to ensure names fit

Don'ts โŒ

  • Don't use extremely long names (they get cut off on mobile)
  • Don't use special characters that may not display correctly
  • Don't name all relays the same (causes confusion)
  • Don't use technical terms that family members won't understand
Good Names (โ‰ค15 chars):
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Good        โ”‚ Bad          โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ "Lights"    โ”‚ "Living Room"โ”‚
โ”‚ "CeilingFan"โ”‚ "Upstairs"   โ”‚
โ”‚ "WaterPump" โ”‚ "Pump"       โ”‚
โ”‚ "Garage"    โ”‚ "Door"       โ”‚
โ”‚ "Sprinkler" โ”‚ "Garden"     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Common Relay Naming Scenarios

Home Automation

Field Example Character Limit
Relay 1 Name "Living Room Light" 15 characters
Relay 2 Name "Ceiling Fan" 15 characters
Relay 3 Name "Water Pump" 15 characters
Relay 4 Name "Garage Door" 15 characters
Relay 5 Name "Sprinklers" 15 characters
Relay Recommended Name Notes
Relay 1 "Living Light" Main living room light
Relay 2 "Ceiling Fan" Ceiling fan control
Relay 3 "TV" TV power (via smart plug)
Relay 4 "Heater" Space heater control
Relay 5 "Night Light" Bedroom accent light

Garden/Aquaponics

Relay Recommended Name Notes
Relay 1 "Water Pump" Circulation pump
Relay 2 "Air Pump" Aeration pump
Relay 3 "LED Light" Grow lights
Relay 4 "Heater" Water heater
Relay 5 "Feeder" Auto fish feeder

Workshop/Garage

Relay Recommended Name Notes
Relay 1 "Shop Light" Main workshop lighting
Relay 2 "Dust Collector" Dust extraction system
Relay 3 "Air Compressor" Compressor control
Relay 4 "Fan" Ventilation fan
Relay 5 "Charger" Battery charger control
๐Ÿ’ก Multi-Language Support:

OceanRemote supports UTF-8 characters, so you can use any language for relay names: ๅฎขๅŽ…็ฏ (Chinese), Lumiรจre salon (French), Luz sala (Spanish), etc.

Managing Logic Changes

When to Change Logic:

  • You bought a new relay module with different logic
  • Your relay clicks when you expect OFF (logic is reversed)
  • You're replacing a faulty relay module with a different type
  • You switched from 5V to 3.3V relays (some have different logic)

How Logic Affects Existing Automations:

  • If you have automations (IFTTT, webhooks, scheduled tasks), changing logic will affect their behavior
  • Test your automations after changing logic
  • You may need to update your automation scripts
โš ๏ธ Caution:

If you have automations that rely on relay state, changing logic may cause unexpected behavior. For example, if an automation turns ON the relay at sunset, changing logic from Positive to Negative will make the relay turn OFF at sunset instead.

Advanced: Programmatic Name Changes via API

For advanced users, you can change relay names programmatically using the OceanRemote API:

// Example: Change relay name via API (requires authentication)
POST https://www.oceanremote.net/api/device/[DEVICE_ID]/update/
Content-Type: application/json

{
  "relay_name_1": "Living Light",
  "relay_name_2": "Ceiling Fan",
  "relay_logic_1": "negative",
  "relay_logic_2": "positive"
}
๐Ÿ”ง API Documentation:

Full API documentation is available at /api/docs/ (requires login). You can use the API to automate device configuration changes.

Troubleshooting

Problem: Relay name not updating in dashboard

  • Refresh the page (Ctrl+F5 or Cmd+Shift+R)
  • Clear browser cache
  • Check if you clicked "Save" after editing
  • Try logging out and back in

Problem: Name is truncated on mobile

  • Shorten the name (max 10-12 characters for mobile safety)
  • Use abbreviations: "Liv Light" instead of "Living Room Light"
  • Use icons in the name? (โš ๏ธ Icons may not display on all devices)

Problem: Relay logic change doesn't work

  • Wait 30 seconds for changes to propagate
  • Check if the device is online (green status)
  • Power cycle the device
  • Test with a multimeter to confirm GPIO pin state
๐Ÿ“Š Relay Name & Logic Summary: ็ƒง

Next Steps

Now that you can customize relay names and logic, continue with:

  • Tutorial 24: Using Multiple Relays: Best Practices
  • Tutorial 21: Connecting Relays to Your Board (wiring guide)
  • Tutorial 25: Common Connection Issues and Fixes
  • Return to Tutorial 02: Generate new firmware with custom names!
๐ŸŽฏ You're Ready!

Your dashboard can now be fully customized with meaningful relay names and correct logic settings. Take a few minutes to name your relays - your future self will thank you!

Feature Details
Max name length 15 characters
Supported characters UTF-8 (any language)
Logic options Positive (๐Ÿ”บ) or Negative (๐Ÿ”ป)
Change requires re-flash? No (instant)
Affects automations? Logic changes do; name changes don't
Can be changed via API? Yes