Skip to main content

server.bless(testSuccess, callback)

Binds a production device to application firmware and registers a function to be called when the blessing attempt completes


Available for use in Factory Firmware only


Name Type Description
testSuccess Bool Whether the device has passed (true) or failed (false) your tests, and so whether it should be blessed
callback Function Function to be called on completion of the blessing process




This method can only be used only Electric Imp customers’ production lines as part of the factory testing process. It is the means by which an imp-based device under test (DUT) is blessed: the point at which Electric Imp impCloud™ servers know that the unit should be assigned to its appointed Production Device Group and sent the application firmware that has been deployed to that Group.

The first argument should be true or false, representing the success or failure of the manufacturer’s own tests of the hardware.

If the testSuccess value is true, the a blessing request is sent to the server (and the server.bless() function returns). When the server responds, the function passed into the callback parameter is executed and passed a single argument: true or false, according to whether the blessing request was successful or failed. The DUT’s LED is now turned solid green for success, or solid red for failure.

If the testSuccess value is false, the failure is logged at the server and the DUT’s LED is turned on solid red to indicate failure. The blessing completion callback is still made, but with false passed as the callback’s argument.

This callback can be used for additional indications of test pass or fail, for example using connected hardware or a beep alert.

imp-specific Notes


From January 15, 2018, imp001 card blessing — manually putting an imp001 ‘factory imp’ into each DUT to test and bless the DUT — is no longer supported by Electric Imp. When called on an imp001 factory imp, server.bless() will return immediately and pass the failure condition into the callback function. For more information, see ‘Changes to Production Processes Under impCentral’).

Note This does not apply to imp001-based DUTs which are configured using a factory BlinkUp™ fixture.

Example Code

Simple Factory Firmware

The following code provides minimal factory firmware for a Factory BlinkUp Fixture. Here, the fixture is an imp003 breakout board with an LED on pin Y. Every ten seconds the fixture will start the BlinkUp procedure automatically. The target device under test (DUT) will automatically and immediately be blessed as soon as it runs this code. The LED on the DUT (not the fixture) will turn solid green indicating pass/bless, or turn solid red indicating fail/no blessing.

Advanced Factory Firmware

This is a complete example of factory firmware that can be used as the basis for your own factory firmware. It was written to run on the impFactory appliance, but can be readily adapted to your own design of imp module-based factory BlinkUp fixture, which should have a button which can be used by the operator to trigger BlinkUp when the fixture and a production device are physically aligned, LED to photosensor, but in practice you may wish to automate this.

The code uses the Factory Tools library to determine which of these devices the firmware is instanced on and to select the correct code path. The Factory BlinkUp Fixture section contains code called on that device; the Production Device section contains the device-under-test code. A final section, Your Test Function, defines a shell in which you can add code of your own to test elements of your production device hardware. This code should return true to ensure the device’s blessing proceeds.