Start device connection

Start device connection

This section shows how to start the device for connection to the Neuko Cloud IoT platform.

Neuko SDK will determine on where is the device to be connected, either to Provisioning endpoint or Perpetual endpoint, based on the lifecycles as described in this guide.

Make sure the following store has been programmed:

import { 
} from "@neukolabs/device-sdk-js";
import { readFileSync, writeFileSync, unlinkSync, existsSync } from 'fs';
import path from 'path';

// refer to the docs
class deviceIdentifier extends DeviceIdentifierStore {
    // ... some content inside

// refer to the docs
class deviceCertificate extends CertificateStore {
    // ... some content inside

// refer to the docs
class deviceConnection extends ConnectionStore {
    // ... some content inside

async function main() {
    const device: Device = new Device();
    device.identifierStore = new deviceIdentifier();
    device.connectionStore = new deviceConnection();
    device.certificateStore = new deviceCertificate();

    // start the device
    await device.start();

async function exit() {
    // stop the device 
    await device.stop();


import sys
import asyncio
import concurrent.futures
from neuko.device.identifierStore import DeviceIdentifierStore
from neuko.connection.certificateStore import CertificateStore
from neuko.connection.connectionStore import ConnectionStore
from neuko.device.model import DeviceIdentifier
from neuko.device.device import Device, DeviceState

# refer to the docs
class deviceIdentifier(DeviceIdentifierStore):
    # ... some content here

# refer to the docs
class deviceCertificate(CertificateStore):
    # ... some content here

# refer to the docs
class deviceConnection(ConnectionStore):
    # ... some content here

class MyDevice:
    def __init__(self) -> None:
        self.device = None
        self.RUNNING = False
        self._ready = False

    def init(self):
        self.device = Device(deviceIdentifier(), deviceConnection(), deviceCertificate())

    async def start(self):
        self.RUNNING = True
        while self.RUNNING:
            if (self._ready == False):
                if (self.gateway.state == DeviceState.READY):
                    self._ready = True
            await asyncio.sleep(1)

    async def stop(self):
        self.RUNNING = False
        await self.gateway.stop()

async def forever():
    mydevice = MyDevice()
    await mydevice.start()

def main():
    loop = asyncio.new_event_loop()

if __name__ == "__main__":


Scroll to Top