Skip to main content

CLI Introduction

The myDevices CLI is a cross-platform command-line tool for managing your myDevices IoT platform. It provides quick access to companies, locations, devices, users, and bulk operations directly from your terminal.

Source: github.com/myDevicesIoT/mydevices-cli

Installation

curl -fsSL https://raw.githubusercontent.com/myDevicesIoT/mydevices-cli/main/install.sh | bash

You can customize the installation with environment variables:

VERSION=1.0.0 INSTALL_DIR=/usr/local/bin curl -fsSL https://raw.githubusercontent.com/myDevicesIoT/mydevices-cli/main/install.sh | bash

Download Pre-Built Binary

Download the latest release for your platform from GitHub Releases:

PlatformBinary
macOS (Apple Silicon)mydevices-darwin-arm64
macOS (Intel)mydevices-darwin-x64
Linux (x64)mydevices-linux-x64
Linux (ARM64)mydevices-linux-arm64
Windows (x64)mydevices-windows-x64.exe

Build from Source

Requires Bun installed.

git clone https://github.com/myDevicesIoT/mydevices-cli.git
cd mydevices-cli
bun install
bun run build

Configuration

Run the interactive setup to configure your CLI:

mydevices config init

This will prompt you for your realm, client ID, and client secret. You can find these credentials in the myDevices console under Settings > Admin API.

You can also manage configuration manually:

# List all configuration values
mydevices config list

# Get a specific value
mydevices config get realm

# Set a specific value
mydevices config set realm my-company

Authentication

After configuring, log in to authenticate:

Obtain credentials by going to myDevices Console -> Settings > Admin API.

mydevices auth login

Verify your session:

mydevices auth whoami

Other auth commands:

# Log out
mydevices auth logout

# Print current access token (useful for scripting)
mydevices auth token

Quick Start

Once installed and authenticated, you're ready to go:

# Configure the CLI
mydevices config init

# Log in
mydevices auth login

# List your companies
mydevices companies list

# List devices
mydevices devices list

Next Steps