---
title: Environment Variables for DFU
description: Certain reserved environment variables are available for scheduling and managing DFU actions.
source_url: https://dev.blues.io/notehub/host-firmware-updates/environment-variables-for-dfu/
canonical_url: https://dev.blues.io/notehub/host-firmware-updates/environment-variables-for-dfu/
markdown_url: https://dev.blues.io/notehub/host-firmware-updates/environment-variables-for-dfu.md
---

# Environment Variables for DFU

Certain [reserved environment variables](https://dev.blues.io/guides-and-tutorials/notecard-guides/understanding-environment-variables.md#reserved-environment-variables) are available for scheduling and managing DFU actions.

## Initiate DFU

After [uploading a new host firmware binary](https://dev.blues.io/notehub/host-firmware-updates/notecard-outboard-firmware-update.md#uploading-firmware-to-notehub) to Notehub, or using an available Notecard firmware binary, you can initiate a host or Notecard DFU action by using the `_fw` or `_fwc` environment variables, respectively.

For example, to update your devices to a specific Notecard firmware version, copy the appropriate file name from [Notecard Firmware Releases](https://dev.blues.io/notecard/notecard-firmware-releases.md). Note that you will need to apply the appropriate firmware binary type to the correct Notecard devices (e.g. Notecard Cell+WiFi has a different firmware binary than Notecard WiFi), so it can be useful to have specific fleets set up that segment by device type.

Set the `_fwc` environment variable on the device, fleet, or project level:

![setting the \_fwc environment variable](https://dev.blues.io/images/notehub/dfu-fwc-env-var.png?v=53cb986b)

Likewise, to initiate a host firmware binary update, set the `_fw` environment variable on the device, fleet, or project level:

![setting the \_fw environment variable](https://dev.blues.io/images/notehub/dfu-fw-env-var.png?v=a20c17a4)

## Schedule DFU

If you need to ensure that DFU actions (whether they are host or Notecard updates) only occur during specific time periods, you may use the `_dfu_period` environment variable.

The value provided to this environment variable must be in the form of `0000000,00,0`, which breaks down as follows:

1. `0000000` corresponds to days of the week, starting with Sunday. Each character is a `1` (DFU allowed that day) or `0` (not allowed).
   - For example, to enable DFU only on weekends, you would use `1000001` (Sunday and Saturday).
2. `00` corresponds to the hour the window opens, expressed in the device's local time using a 24-hour clock (a value from `0` to `23`).
   - For example, to enable DFU starting at 5:00 PM, you would use `17`.
3. `0` corresponds to how many hours the DFU window should remain open. This value must be between `1` and `24`.
   - For example, to open the window for two hours, you would use `2`.

Putting it all together, suppose you wish to limit DFU to overnight hours on weekdays, when devices are less likely to be in active use. To open a four-hour window starting at 1:00 AM, Monday through Friday, you would set `_dfu_period` to `0111110,01,4`.

## Voltage-Variable DFU

Just as both `hub.set` and `card.location.mode` configurations can be customized to sync data or gather location information on a [voltage-variable basis](https://dev.blues.io/notecard/notecard-walkthrough/low-power-firmware-design.md#customizing-voltage-variable-behaviors), DFU actions can be enabled/disabled in a similar way.

The `_dfu_enabled` environment variable allows you to enable DFU actions based on Notecard voltage thresholds already defined with the [card.voltage API](https://dev.blues.io/api-reference/notecard-api/card-requests/latest.md#card-voltage).

For example, to only enable DFU downloads when your device is powered by USB or the voltage is high or normal, you would use the following string:

```plaintext
usb:1;high:1;normal:1;low:0;dead:0
```

[Notecard API Requests for DFU](https://dev.blues.io/notehub/host-firmware-updates/notecard-api-requests-for-dfu.md "Notecard API Requests for DFU")
