Skip to content

Instantly share code, notes, and snippets.

@gosseti
Created August 14, 2025 13:01
Show Gist options
  • Save gosseti/3495515232d858c9a628d00abe03303f to your computer and use it in GitHub Desktop.
Save gosseti/3495515232d858c9a628d00abe03303f to your computer and use it in GitHub Desktop.
NervesHub device config
# Error
# 401 Unauthorized when connecting to NervesHub
{:error, {:upgrade_failure, %{
reason: %Mint.WebSocket.UpgradeFailureError{status_code: 401, ...},
status_code: 401
}}}
# Configuration Files
# config/nerves_hub.exs:
# Using SharedSecret authentication
config :nerves_hub_link,
host: System.get_env("NERVESHUB_HOST", "devices.nervescloud.com"),
connect: true,
remote_iex: true,
shared_secret: [
product_key: System.get_env("NERVESHUB_PRODUCT_KEY"),
product_secret: System.get_env("NERVESHUB_PRODUCT_SECRET")
],
configurator: NervesHubLink.Configurator.SharedSecret,
socket: [
json_library: Jason,
heartbeat_interval: 45_000
],
client: ScoutHub.NervesHubClient
# config/runtime.exs:
# Sets device identifier at runtime
config :nerves_hub_link,
device_identifier: Nerves.Runtime.serial_number()
"""
Environment Variables (from .env.nerveshub):
- NERVESHUB_PRODUCT_KEY
- NERVESHUB_PRODUCT_SECRET
- Host: defaults to devices.nervescloud.com
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment