Configuration

Advanced settings and fine-tuning options for optimal performance.

MotorWala Configuration

Motor Calibration

Accurate position tracking requires calibration.

When to calibrate:

  • First installation
  • After changing motor
  • If positions become inaccurate
  • After firmware update

Calibration process:

# Via API
curl -X POST http://192.168.1.100/api/motor/calibrate

# Or via web interface: Settings → Motor → Calibrate

What happens:

  1. Motor moves to fully open position
  2. Timer records travel time
  3. Motor moves to fully closed position
  4. System calculates position steps
  5. Current position set to 0 (closed)

Expected duration: 30-120 seconds depending on motor speed

Motor Direction

If motor moves opposite to expected:

Method 1: Software Reversal

# Settings → Motor → Direction
Direction: Reversed

Method 2: Hardware Reversal

  • Swap M+ and M- wires physically
  • Easier if multiple devices need same direction

Speed Configuration

Control motor speed (affects travel time and noise):

# Settings → Motor → Speed
Speed: 50  # Range: 10-100

10  = Very slow (quietest)
50  = Medium (default)
100 = Maximum (fastest)

Considerations:

  • Higher speed = more noise
  • Lower speed = smoother operation
  • Tubular motors may have minimum speed requirement

Test speeds:

# Set speed and test
curl -X POST http://192.168.1.100/api/motor/config \
  -H "Content-Type: application/json" \
  -d '{"speed": 30}'

# Then test movement
curl -X POST http://192.168.1.100/api/motor/open

Position Limits

Set soft limits to prevent motor from traveling too far:

# Settings → Motor → Limits
Upper Limit: 95   # Don't go above 95%
Lower Limit: 5    # Don't go below 5%

Use cases:

  • Prevent blinds from hitting window frame
  • Account for mechanical stops
  • Protect motor from stalling

Apply limits:

curl -X POST http://192.168.1.100/api/motor/config \
  -H "Content-Type: application/json" \
  -d '{
    "upper_limit": 95,
    "lower_limit": 5
  }'

Soft Start/Stop

Gradual acceleration/deceleration for smooth operation:

# Settings → Motor → Advanced
Soft Start: Enabled
Soft Stop: Enabled
Ramp Time: 500ms  # 100-2000ms

Benefits:

  • Reduces mechanical stress
  • Quieter operation
  • Smoother motion
  • Longer motor life

Stall Detection

Automatically stop motor if blocked:

# Settings → Motor → Safety
Stall Detection: Enabled
Stall Threshold: 2000ms
Stall Action: Stop and Alert

How it works:

  • Monitors motor current
  • Detects unusual load
  • Stops motor if threshold exceeded
  • Logs event for troubleshooting

Auto-Recalibration

Periodically recalibrate to maintain accuracy:

# Settings → Motor → Maintenance
Auto Recalibrate: Enabled
Interval: 30 days
Next Calibration: 2025-12-05

RelayWala Configuration

Relay Modes

Each relay supports different operating modes:

Normal Mode

Standard on/off control:

Relay 1:
  Mode: Normal
  Power-on State: Off

Behavior:

  • ON command → relay closes, stays closed
  • OFF command → relay opens, stays open
  • State persists until changed

Momentary Mode

Pulse relay for specified duration:

Relay 2:
  Mode: Momentary
  Pulse Duration: 1000ms  # 100-10000ms
  Power-on State: Off

Behavior:

  • ON command → relay closes for duration, then opens
  • Perfect for garage doors, doorbells, strikes

Example:

# Trigger garage door
curl -X POST http://192.168.1.101/api/relay/2/on
# Relay activates for 1 second, then turns off automatically

Toggle Mode

Each command toggles state:

Relay 3:
  Mode: Toggle
  Power-on State: Off

Behavior:

  • Any command toggles state
  • ON → OFF, OFF → ON

Timer Mode

Auto-off after specified time:

Relay 4:
  Mode: Timer
  Timer Duration: 1800000ms  # 30 minutes
  Power-on State: Off

Behavior:

  • ON command → relay closes
  • After duration → automatically turns off
  • Perfect for fans, exhaust, heating

Power-on State

Configure relay state after power loss/reboot:

Power-on States:
  Off: Always start OFF (safest)
  On: Always start ON
  Last State: Restore previous state
  Custom: Set specific state per relay

Examples:

Safety-critical (always OFF):

Relay 1 (Water Pump):
  Power-on State: Off

Convenience (restore last):

Relay 2 (Bedroom Light):
  Power-on State: Last State

Always-on device:

Relay 3 (WiFi Router):
  Power-on State: On

Interlock Configuration

Prevent multiple relays from being active simultaneously:

# Example: Reversible motor control
Relay 1 (Motor Forward):
  Interlock Group: A
  Interlock Delay: 500ms

Relay 2 (Motor Reverse):
  Interlock Group: A
  Interlock Delay: 500ms

Behavior:

  • Turning on Relay 1 → automatically turns off Relay 2
  • Delay ensures mechanical settling
  • Prevents dangerous simultaneous activation

Multiple interlock groups:

# Two independent reversible motors
Relay 1 (Motor 1 Forward): Group A
Relay 2 (Motor 1 Reverse): Group A
Relay 3 (Motor 2 Forward): Group B
Relay 4 (Motor 2 Reverse): Group B

Current Monitoring

Track relay current usage:

# Settings → Relays → Monitoring
Current Monitoring: Enabled
Sample Rate: 1000ms
Over-current Threshold: 10A
Under-current Threshold: 0.1A

Alerts:

  • Over-current → potential overload
  • Under-current on expected load → possible failure
  • Logs sent to MQTT topic: relaywala/[device]/alert

Scheduling

Built-in scheduler for each relay:

Via web interface:

Schedule 1:
  Relay: 1
  Action: ON
  Time: 18:00
  Days: Mon, Tue, Wed, Thu, Fri
  Enabled: Yes

Schedule 2:
  Relay: 1
  Action: OFF
  Time: 22:00
  Days: Mon, Tue, Wed, Thu, Fri
  Enabled: Yes

Via API:

curl -X POST http://192.168.1.101/api/schedule \
  -H "Content-Type: application/json" \
  -d '{
    "channel": 1,
    "action": "on",
    "time": "18:00",
    "days": ["mon", "tue", "wed", "thu", "fri"]
  }'

Countdown Timer

Set relay to auto-off after duration:

Via web interface:

Relay 1:
  Countdown: 30 minutes
  Action: Turn OFF after countdown

Via API:

# Turn on with 30-minute countdown
curl -X POST http://192.168.1.101/api/relay/1/on \
  -H "Content-Type: application/json" \
  -d '{"countdown": 1800}'  # seconds

Network Configuration

WiFi Settings

Static IP

# Settings → Network → WiFi
Network Mode: Static IP
IP Address: 192.168.1.100
Subnet Mask: 255.255.255.0
Gateway: 192.168.1.1
DNS Primary: 8.8.8.8
DNS Secondary: 8.8.4.4

WiFi Power Saving

WiFi Power Save: Disabled  # Recommended for always-on devices

Options:

  • Disabled: Always active, lowest latency
  • Minimum: Slight power saving, minimal latency impact
  • Maximum: Most power saving, higher latency

Multiple Networks

Store multiple WiFi credentials:

# Settings → Network → Additional Networks
Priority 1: HomeNetwork (current)
Priority 2: OfficeNetwork
Priority 3: GuestNetwork

Device will auto-connect to strongest available network.

MQTT Settings

Quality of Service (QoS)

MQTT QoS:
  Commands: QoS 1 (At least once)
  State: QoS 0 (At most once)
  Position: QoS 0 (At most once)

QoS Levels:

  • QoS 0: Fire and forget (fastest, lowest overhead)
  • QoS 1: At least once delivery (reliable)
  • QoS 2: Exactly once delivery (slowest, most reliable)

Last Will and Testament (LWT)

Auto-publish offline message if device disconnects:

MQTT LWT:
  Enabled: Yes
  Topic: motorwala/living-room/availability
  Payload: offline
  QoS: 1
  Retain: Yes

Availability tracking in Home Assistant:

cover:
  - platform: mqtt
    name: "Living Room Blinds"
    availability_topic: "motorwala/living-room/availability"
    payload_available: "online"
    payload_not_available: "offline"

Retained Messages

Retain State: Yes  # Last state available for new subscribers
Retain Position: Yes
Retain Availability: Yes

HTTP API Settings

Port Configuration

HTTP Port: 80  # Default
# Or custom: 8080, 8888, etc.

Using custom port:

curl http://192.168.1.100:8080/api/status

CORS (Cross-Origin)

Enable for web app access:

CORS:
  Enabled: Yes
  Allowed Origins: *  # Or specific: http://dashboard.local

Rate Limiting

Rate Limiting:
  Enabled: Yes
  Max Requests: 100 per minute
  Burst: 20

mDNS (Hostname)

Access device by name instead of IP:

mDNS:
  Enabled: Yes
  Hostname: living-room-blinds

Access via:

curl http://living-room-blinds.local/api/status
ping living-room-blinds.local

Security Configuration

API Authentication

Enable Authentication

# Settings → Security → API
API Authentication: Enabled
Token Type: Bearer

Generate Tokens

# Via web interface: Settings → Security → Generate Token
# Token: ww_a1b2c3d4e5f6g7h8i9j0

# Or via API (requires current auth):
curl -X POST http://192.168.1.100/api/auth/token \
  -H "Authorization: Bearer ADMIN_TOKEN" \
  -d '{"name": "home-assistant", "expires": "never"}'

Token Management

Active Tokens:
  - Name: home-assistant
    Token: ww_***************j0
    Created: 2025-01-15
    Last Used: 2 minutes ago
    Expires: Never

  - Name: node-red
    Token: ww_***************k1
    Created: 2025-02-01
    Last Used: 1 day ago
    Expires: 2026-02-01

Revoke Tokens

curl -X DELETE http://192.168.1.100/api/auth/token/TOKEN_ID \
  -H "Authorization: Bearer ADMIN_TOKEN"

HTTPS (Optional)

For encrypted communication:

# Settings → Security → HTTPS
HTTPS: Enabled
Certificate: Upload or Generate Self-Signed
Private Key: [Upload]
Port: 443

Generate self-signed certificate:

openssl req -x509 -newkey rsa:2048 -nodes \
  -keyout key.pem -out cert.pem -days 365 \
  -subj "/CN=192.168.1.100"

Access via HTTPS:

curl -k https://192.168.1.100/api/status

MQTT Authentication

Secure MQTT with username/password:

# Broker side (Mosquitto)
allow_anonymous false
password_file /etc/mosquitto/passwd

# Device side
MQTT:
  Username: wala-devices
  Password: secure-password-here
  TLS: Enabled (optional)

System Configuration

Timezone

Set correct timezone for schedules:

# Settings → System → Time
Timezone: Asia/Kolkata (UTC+5:30)
NTP Server: pool.ntp.org
Time Sync: Auto
Current Time: 2025-11-05 14:30:00

Logging

Configure logging verbosity:

Log Level: Info

Levels:
  - Debug: Everything (verbose, for troubleshooting)
  - Info: Normal operations (default)
  - Warning: Potential issues
  - Error: Errors only

View logs:

# Via web: Settings → System → Logs

# Via API:
curl http://192.168.1.100/api/system/logs?lines=100

# Via serial:
screen /dev/ttyUSB0 115200

Telemetry

Send anonymous usage data (optional):

Telemetry:
  Enabled: No  # Default: disabled
  Include: Device type, firmware version, uptime
  Exclude: Location, personal data, command content

Watchdog

Auto-reboot if system becomes unresponsive:

Watchdog:
  Enabled: Yes
  Timeout: 60 seconds
  Action: Restart

Backup & Restore

Export Configuration

# Download all settings
curl http://192.168.1.100/api/config/export > config-backup.json

Exported data includes:

  • Network settings (WiFi credentials)
  • MQTT configuration
  • Motor/relay settings
  • Calibration data
  • Schedules
  • Security tokens

Import Configuration

# Restore settings
curl -X POST http://192.168.1.100/api/config/import \
  -H "Content-Type: application/json" \
  -d @config-backup.json

Scheduled Backups

Auto-backup to network location:

# Settings → System → Backup
Auto Backup: Enabled
Destination: SFTP/SCP
Host: 192.168.1.200
Path: /backups/wala-devices/
Interval: Daily
Time: 02:00

Performance Tuning

WiFi Optimization

WiFi:
  TX Power: High (20 dBm)
  Channel: Auto
  DTIM: 1 (faster response)

MQTT Optimization

MQTT:
  Keep Alive: 15 seconds
  Clean Session: No (persistent)
  Max Packet Size: 1024 bytes
  Queue Size: 10 messages

HTTP Server

HTTP:
  Max Connections: 4
  Timeout: 5 seconds
  Buffer Size: 2048 bytes

Factory Reset

Soft Reset

Preserves network settings:

# Settings → System → Reset
Reset Type: Soft
Preserves: WiFi credentials, device name
Resets: Motor calibration, schedules, MQTT settings

Hard Reset

Complete wipe:

Reset Type: Hard (Factory Default)
Resets: Everything

Methods:

Via Web:

  • Settings → System → Factory Reset

Via API:

curl -X POST http://192.168.1.100/api/system/reset \
  -d '{"type": "hard"}'

Via Button:

  • Hold reset button for 30 seconds

Next Steps


Fine-tuning help? Join our community forum

Previous

Next