Configure device using RM Interface

This page guides user to configure reader using Reader Management Interface.

Important

This guide uses Postman Tool for sending API calls to reader.

Import Certificates and Generate Endpoint Configuration

  1. Import AWS device certificates downloaded into reader.

  • Method-1: Using SCP.

    • Copy generated certificates and CA certificate into reader. (copy to desired folder inside /apps/).

  • Method-2: Using reader certificate webpage.

    • Create PFX file from certificate.

    • Import Certificates into reader using certificate page.

  • Method-3: pass certificates contents along with Endpoint Config.

  1. Create MQTT Endpoint JSON object (when used Method-1 or Method-2 for importing certificates).

Edit Example MQTT endpoint JOSN object shown below.

{
    "type": "MQTT",
    "name": "emqx_ssl",
    "description": "emqx",
    "configuration": {
        "endpoint": {
            "hostname": "broker.emqx.io",
            "port": 8883,
            "protocol": "ssl"
        },
        "additional": {
            "cleanSession": true,
            "clientId": "FX7500FCCD18",
            "debug": false,
            "keepAlive": 60
        },
        "enableSecurity": true,
        "security": {
            "certificates": {
                "CACertificatePath": "/apps/broker.emqx.io-ca.crt",
                "certAlgorithm": "RS256",
                "certFormat": "PEM",
                "certificatePath": "/readerconfig/ssl/server.crt",
                "privateKeyPath": "/readerconfig/ssl/server.key"
            },
            "useLocalCerts": true,
            "verifyServerCertificate": true
        },
        "topics": {
            "control": {
                "command": {
                    "qos": 0,
                    "retain": false,
                    "topic": "/FX7500FCCD18_ssl/cmds"
                },
                "response": {
                    "qos": 0,
                    "retain": false,
                    "topic": "/FX7500FCCD18_ssl/rsp"
                }
            },
            "management": {
                "command": {
                    "qos": 0,
                    "retain": false,
                    "topic": "/FX7500FCCD18_ssl/cmds"
                },
                "response": {
                    "qos": 0,
                    "retain": false,
                    "topic": "/FX7500FCCD18_ssl/rsp"
                }
            },
            "managementEvents": {
                "qos": 0,
                "retain": false,
                "topic": "/FX7500FCCD18_ssl/mevents"
            },
            "tagEvents": {
                "qos": 0,
                "retain": false,
                "topic": "/FX7500FCCD18_ssl/tevents"
            }
        }
    }
}
  1. Edit endpoint details with MQTT Broker settings.

  2. Edit protocol based on the desired connection required.

    • tcp: for unsecure TCP connection.

    • ssl: for secure TCP connection.

    • ws: for unsecure Websocket connection.

    • wss: for secure Websocket connection.

  3. For protocols ssl and wss it is required to provide security settings.

    • Edit CACertificatePath, certificatePath and privateKeyPath with certificate path details

  1. Create MQTT Endpoint JSON object without local certificates (when used Method-3 for importing certificates).

Edit Example MQTT endpoint JOSN object shown below.

{
    "type": "MQTT",
    "name": "emqx_ssl",
    "description": "emqx",
    "configuration": {
        "endpoint": {
            "hostname": "broker.emqx.io",
            "port": 8883,
            "protocol": "ssl"
        },
        "additional": {
            "cleanSession": true,
            "clientId": "FX7500FCCD18",
            "debug": false,
            "keepAlive": 60
        },
        "enableSecurity": true,
        "security": {
            "useLocalCerts": false,
            "certificates": {
                "certificateContent": "{certificateContent}",
                "certAlgorithm": "RS256",
                "certFormat": "PEM",
                "privateKeyContent": "{privateKeyContent}",
                "CACertificateContent": "{CACertificateContent}"
            },
            "verifyServerCertificate": true
        },
        "topics": {
            "control": {
                "command": {
                    "qos": 0,
                    "retain": false,
                    "topic": "/FX7500FCCD18_ssl/cmds"
                },
                "response": {
                    "qos": 0,
                    "retain": false,
                    "topic": "/FX7500FCCD18_ssl/rsp"
                }
            },
            "management": {
                "command": {
                    "qos": 0,
                    "retain": false,
                    "topic": "/FX7500FCCD18_ssl/cmds"
                },
                "response": {
                    "qos": 0,
                    "retain": false,
                    "topic": "/FX7500FCCD18_ssl/rsp"
                }
            },
            "managementEvents": {
                "qos": 0,
                "retain": false,
                "topic": "/FX7500FCCD18_ssl/mevents"
            },
            "tagEvents": {
                "qos": 0,
                "retain": false,
                "topic": "/FX7500FCCD18_ssl/tevents"
            }
        }
    }
}
  1. Edit endpoint details with MQTT Broker settings.

  2. Edit protocol based on the desired connection required.

    • tcp: for unsecure TCP connection.

    • ssl: for secure TCP connection.

    • ws: for unsecure Websocket connection.

    • wss: for secure Websocket connection.

  3. For protocols ssl and wss it is required to provide security settings.

    • replace {certificateContent}, {privateKeyContent} and {CACertificateContent} with Public Certificate, Private Key and Root CA certificate content.

In certificate content replace newline \\n character with \\r\\n characters as shown below for proper JSON object.

Note

/FX7500FCCD18_ssl/tevents
  • Reader uses this topic to send tag read events.

/FX7500FCCD18_ssl/mevents
  • Reader uses this topic to send asynchronous events like heartbeats, GPI, userapp, errors and warnings.

/FX7500FCCD18_ssl/cmds
  • Reader will subscribe to this topic and listening for commands from cloud.

/FX7500FCCD18_ssl/rsp
  • Reader uses this topic to send responses to commands.

Import Configuration into Reader

  1. Download and import postman collections Cloud Connect Enhanced UI.postman_collection.json and Cloud Connect - RM-commands.postman_collection.json.

  2. Create an environment variables protocol (http/https) and reader-ip (10.17.231.7).

  3. Execute Login API.

    Important

    change username and password field in the body with readers username and password configured.

../../_images/MQTT_11.png
  1. Goto ADD endpoint (MQTT) API and replace the JSON object between <motorm:data> </motorm:data> with the MQTT Endpoint JSON object created in Import Certificates and Generate Endpoint Configuration.

    ../../_images/MQTT_2.png
    • The response 200 OK indicate the endpoint got added successfully.

    • Status other than 200 indicate error and response contain the failure reason and check reader syslog to get more info on error.

  2. Create Endpoint Mapping for MQTT.

    • Goto UPDATE endpoint mapping API and edit control, data, event, and management endpoints to the name used in MQTT endpoint JSON object.

    Important

    Reader is configured to MQTT endpoint for all the interfaces.

    ../../_images/MQTT_3.png
    • The response 200 OK indicate the endpoint got added successfully.

    • Status other than 200 indicate error and response contain the failure reason and check reader syslog to get more info on error.

Connect to Cloud

  1. Goto isEnrolledToCloud and check if reader is enrolled for IoT connect or not.

../../_images/MQTT_41.png
  1. If device is not enrolled currently, Send EnrollToCloud API.

../../_images/MQTT_51.png
  1. If device is already enrolled, Send disconnectFromCloud API and connectToCloud API.

disconnectFromCloud API:

../../_images/MQTT_61.png

connectToCloud API:

../../_images/MQTT_71.png

Verify Cloud Connection

  1. Check Cloud Connection Status using isConnectedToCloud API.

../../_images/MQTT_81.png