With many IoT devices configuration can be time-consuming and involve jumping through a lot of hoops. So much time can be spent looking for that small, but by now very important bit of information to make it all click, when all you really want to do is get on with your original task.

For us here at Onion, we’re always looking at ways to take the frustration away and improve your overall experience. That’s why each Omega2 comes with the onion general-purpose configuration script pre-installed from the get-go, providing you with a quick and easy way to get your important tasks completed without the needless time-wasting of combing through documentation. Using the onion script allows you to simply and quickly make changes to your configuration and run commands without needing to work through the configuration issues manually.

Getting access and using onion script is simple, all you need is your Omega2 and a Dock, power-up your Omega2 and access Omega’s command line. Before we dive in and start using the script, lets first check your device is up-to-date.

Getting your Omega ready

Before using the onion script, make sure your Omega is on the latest firmware. To upgrade to the latest firmware, connect to the command line and run the following command:


Warning: When an upgrade is performed, only the /root and /etc folders will be preserved. It is important to backup your files on the Omega prior to upgrading if you don’t want to lose any of your work. See our guide on updating the Omega for more details.

Using the Onion Script

Running onion script and changing configurations is simple, quick and easy. There are script functions available to easily configure or interact with the following:

The following sections will describe each of the script functions.

Configure System Timezone

Easily configure the system timezone so that running the date command actually outputs the time and date for your timezone!

List timezones

To list all available timezones and associated timezone string:

onion [OPTIONS] time list

Note that this will output a huge list, get ready to scroll to find your timezone!

Change timezone

To change the system timezone:


Update system time

To update the system time based on your timezone and NTP internet servers:

onion [OPTIONS] time sync

Note that internet access is required to access the NTP servers.

How this would be used:

First you’ll need to list all currently available timezones by running:

onion time list

Once you’ve found your timezone in the list, you’ll need to copy that entire line.
In our case, we’re looking for Toronto, here’s an excerpt of how this list will look:

America/Thunder Bay     EST5EDT,M3.2.0,M11.1.0
America/Tijuana PST8PDT,M3.2.0,M11.1.0
America/Toronto EST5EDT,M3.2.0,M11.1.0
America/Tortola AST4
America/Vancouver       PST8PDT,M3.2.0,M11.1.0

Now set your system timezone by running:

onion time set <timezone> <timezone string>

So, to set for Toronto:

onion time set America/Toronto EST5EDT,M3.2.0,M11.1.0

Now, to make sure your changes have taken effect and that your system time is actually correct, run:

onion time sync

Using the Hardware PWM Pins

Make use of the Omega’s hardware PWM pins! You can set the duty cycle and frequency of a PWM signal on one of the channels, or disable the channel. Learn more about Hardware PWM on the Omega here.

Change channel

In order to set the PWM channel to PWM signal, with a specified duty cycle and frequency:


In this case the following applies:

  • CHANNEL – this is the PWM channel to use – can be set to either 0 (GPIO18) or 1 (GPIO19)
  • DUTY CYCLE – this is the PWM signal duty cycle, set as a percentage expressed between 0 – 100
  • FREQUENCY – this is the PWM signal frequency, which is expressed in Hz

How this would be used:

So, if you wanted to set the duty cycle to 50% and the frequency to 80Hz on PWM Channel 1 (GPIO19), the command would be:

onion pwm 1 50 80

Disable channel

To disable the specified PWM Channel:

onion [OPTIONS] pwm <CHANNEL> disable

Change Ethernet Settings

With the Ethernet Expansion, the Omega gains an Ethernet port. Use this utility to quickly switch the Omega’s role on the wired ethernet network between a client and a host.

As a client, the Omega joins an existing wired network and, by default, expects to have an IP assigned by the network’s router.

As the network host, the Omega acts as the network’s router that will assign IP addresses to the other devices. See our documentation on using the Omega as a Router for more details.

Set Ethernet Port to Act as a Client

To change your ethernet port to be a client on the network:

onion [OPTIONS] ethernet client

Set Ethernet Port to Act as Network Host

To change your ethernet port to be the network host:

onion [OPTIONS] ethernet host

How this would be used:

Instead of messing with the settings in /etc/config/network, use this command to quickly adjust how the Omega handles wired networking.

Configure MJPG Streamer

The mjpg-streamer utility copies JPEG frames from one or more input plugins to multiple output plugins. In our case, we generally use it to capture video frames from a USB camera and stream them over IP. For example, the OnionOS Timelapse Camera app uses this utility to stream video from a USB camera connected to the Omega, to the browser.

Use the onion script to quickly configure mjpg-streamer without having to directly deal with the /etc/config/mjpg-streamer configuration file.

Reset Configuration to Default

To configure the MJPG streamer with acceptable default options:

onion [OPTIONS] mjpg-streamer setup

 How this would be used:

To quickly reset back to all default options just run the function

Change Setting

To configure a settings for the stream:

onion [OPTIONS] mjpg-streamer <SETTING> <VALUE>

The supported settings are as follows:

  • resolution <WIDTHxHEIGHT>
  • fps <number>

How this would be used:

See the next two points!

Change Resolution

To change the resolution of the stream:

onion mjpg-streamer resolution <WIDTHxHEIGHT>

How this would be used:

To set to the stream resolution to 800×600:

onion mjpg-streamer resolution 800x600

Change FPS

To change the FPS (Frames Per Second) setting of the stream:

onion mjpg-streamer fps <number>

How this would be used:

To set to the stream FPS to 40:

onion mjpg-streamer fps 40


This function allows you to quickly review or update your OnionOS installation.

Display current OnionOS Version

To display the Omega and OnionOS version information:

onion [OPTIONS] os version

How this would be used:

This lets you check the current OS version to see if you need to run the update function by running:

onion os version

It will output something like the following:

=== Version Info ===
Omega firmware: v0.2.2 b200
onion-os - 1.0.5-1
 = OnionOS Apps =
oos-app-power-dock-2 - 1.0.1-1
oos-app-sensor-monitor - 1.0.1-1

Update OnionOS

To update OnionOS to the latest available version:

onion [OPTIONS] os update

How this would be used:

If you find you are not on the latest OnionOS version, simply run the update command:

onion os update

Last updated: November 30, 2018