Docs/Integrations/Shelly

Shelly Integration

Connect your Shelly IoT relays to Hygate for time-based paid device access.


Overview

Shelly is a line of WiFi-connected IoT relays and sensors. Hygate integrates with Shelly Cloud to sync your devices, control relay power, and manage timed device sessions for guests.


What You Need

Before setting up Shelly in Hygate, you need:

  • A Shelly Cloud account (at shelly.cloud)
  • Shelly devices that are online and connected to your account
  • An Auth Key generated from Shelly Cloud

Getting a Shelly Auth Key

Step 1: Create a Shelly Cloud Account

  1. Go to shelly.cloud and create an account
  2. Add your Shelly devices to your account
  3. Ensure all devices are online

Step 2: Generate an Auth Key

  1. Log in to Shelly Cloud
  2. Go to Account → Auth Key (or your profile settings)
  3. Click Generate new key
  4. Give the key a name (e.g., "Hygate Integration")
  5. Copy the Auth Key

Step 3: Enter in Hygate

  1. Go to Settings → Shelly
  2. Paste the Auth Key
  3. The Server URL is usually pre-filled — leave it as default unless you have a custom deployment
  4. Click Test Connection
  5. If successful, click Save

How the Integration Works

Device Synchronization

When you click Sync from Shelly, Hygate calls the Shelly Cloud API to retrieve your device list:

Hygate → Shelly Cloud API: listDevices(auth_key)
        │
        ▼
  Returns: deviceId, deviceName, deviceType, channelCount, onlineStatus
        │
        ▼
  Devices matched against Hygate database
  Already-added devices shown as disabled

Relay Control

Hygate sends relay commands via the Shelly Cloud API:

Turn ON:  Hygate → Shelly Cloud API: relayOn(deviceId, channel)
Turn OFF: Hygate → Shelly Cloud API: relayOff(deviceId, channel)

Reliability

Hygate implements hardened relay control with:

FeatureDetail
Timeout5 seconds per command
RetriesUp to 3 attempts per command
Backoff500ms delay between retries
Error handling4xx errors treated as non-fatal for OFF commands
LoggingAll commands logged for audit and debugging

Session Activation

[1] Guest payment confirmed
        │
        ▼
[2] Hygate creates DeviceSession (ACTIVE)
        │
        ▼
[3] Grace period starts (delayMinutes from usage plan)
  ┌──────────────────────────────────────────┐
  │ Guest loads laundry / connects cable     │
  │ Relay is NOT yet activated              │
  └──────────────────────────────────────────┘
        │
        ▼
[4] Timer starts
  Hygate → Shelly API: relayOn(deviceId, channel)
        │
        ▼
[5] Relay confirmed ON
  Session visible in dashboard
  Guest countdown begins
        │
        ▼
[6] Timer ends
  Hygate → Shelly API: relayOff(deviceId, channel)
        │
        ▼
[7] Relay confirmed OFF
  Session marked COMPLETED

Device Types Supported

Hygate supports all Shelly devices with relay functionality:

Device TypeSupportedNotes
Shelly 1 / 1PMYesSingle channel relay
Shelly 2 / 2.5YesDual channel relay
Shelly 4Pro / 4PMYesQuad channel relay
Shelly Plug / Plug SYesSingle channel with power monitoring
Shelly Pro seriesYesIndustrial-grade relays
Shelly Plus seriesYesEnhanced processing
Shelly BulbPartialLight control (not relay-based)
Shelly SensorPartialTemperature/humidity (monitoring only)

Multi-Channel Devices

For devices with multiple relay channels (like Shelly 4PM), each channel can be configured as a separate Hygate device. This allows:

  • Independent usage plans per channel
  • Individual relay control per channel
  • Separate QR codes per channel

Example: A Shelly Pro 4PM with 4 channels:

  • Channel 1 → "Washer 1" (€2.50 / 60 min)
  • Channel 2 → "Washer 2" (€2.50 / 60 min)
  • Channel 3 → "Dryer 1" (€2.00 / 45 min)
  • Channel 4 → "Dryer 2" (€2.00 / 45 min)

What Happens When Shelly Is Disabled

If you disable Shelly in Settings → General:

EffectDescription
Devices page hiddenOperators cannot access the Devices module
Device payment flow disabledGuests cannot purchase device access
Existing sessions continueActive sessions are not affected
Device configurations preservedDevice data remains in the database

Troubleshooting

"Connection test failed"

CheckAction
Auth keyVerify the Auth Key is correct and not expired
Shelly Cloud statusCheck shelly.cloud for service status
Devices onlineEnsure devices are connected to WiFi and online in Shelly app
NetworkEnsure Hygate can reach Shelly Cloud API

Device Shows Offline

CheckAction
Device WiFiCheck the Shelly device is connected to your network
Shelly Cloud pairingVerify the device is paired with your Shelly Cloud account
PowerEnsure the device has power
PingTry pinging the device directly

Relay Won't Turn On

CheckAction
Device statusEnsure the device is not in Maintenance Mode
Session conflictCheck for an existing ACTIVE session on the same device
NetworkVerify Shelly Cloud API is reachable
RetryRelay commands have built-in retries — wait and try again

Session Started But Relay Not On

CheckAction
Audit logsCheck for shelly_on_success or shelly_on_failed
Retry activationNavigate to Sessions → find the session → retry
Force-endIf relay is truly stuck, use Force End

Auth Key Revoked

If you revoke your Shelly Auth Key:

  1. Generate a new key from Shelly Cloud
  2. Update the key in Settings → Shelly
  3. Click Test Connection

Security Notes

  • Shelly credentials are encrypted at rest in the Hygate database
  • Auth keys provide full API access — treat them like passwords
  • Rotate auth keys regularly (every 90 days recommended)
  • Do not share auth keys with operators — only admins should have access
  • Monitor device activity in audit logs for unauthorized access