Skip to content
Developer

Node-RED

Smart home and automation4 EndpointsDataWarehouse / Node-RED

Node-RED offers its locks. Creates or updates a smart lock connection (provider "nodered"); the locks become smart locks when an administrator syncs the devices of that connection.

POST/api/nodered/smart_lock/register

Expects JSON body: { "instance_id": "", "secret": "<shared secret, 32-256 characters>", "name": "Node-RED Vereinsheim", "delivery": "mqtt", // mqtt (default, ERP publishes on its broker) or push "webhook_url": "https://…", // push only: receives the signed commands "locks": [{"id": "front_door", "name": "Haupteingang", "state": "locked", "unlock_method": "remote"}] }

Responses

200Registration resultobject

Show fields (5)
  • statusstring

    created, updated or restored

  • connection_idinteger
  • locksinteger
  • smart_locksinteger

    smart locks the administrator already synced

  • mqttobject

    delivery mqtt: broker access of the bridge

    Show fields (6)
    • urlstring
    • usernamestring
    • passwordstring

      MQTT JWT, valid 30 days

    • client_idstring
    • topicstring
    • valid_untilstring
Request
curl --request POST \
  --url https://your-instance.iw-erp.de/api/nodered/smart_lock/register \
  --header 'x-iw-jwt-token: <TOKEN>'
Response 200 application/json
{
  "status": "string",
  "connection_id": 42,
  "locks": 1,
  "smart_locks": 1,
  "mqtt": {
    "url": "https://vynst.de",
    "username": "lena.hartmann@example.org",
    "password": "••••••••",
    "client_id": "42",
    "topic": "string",
    "valid_until": "string"
  }
}
Request
curl --request DELETE \
  --url https://your-instance.iw-erp.de/api/nodered/smart_lock/register \
  --header 'x-iw-jwt-token: <TOKEN>'

Result of a command Node-RED got over MQTT. Expects JSON body {"instance_id": "...", "secret": "...", "success": true, "state": "unlocked", "message": "..."}.

POST/api/nodered/smart_lock/commands/{identifier}/result

Path parameters

identifierrequiredstring

Responses

default

Request
curl --request POST \
  --url https://your-instance.iw-erp.de/api/nodered/smart_lock/commands/42/result \
  --header 'x-iw-jwt-token: <TOKEN>'

May a credential a reader at Node-RED read (app QR code of the lock, member card QR, RFID card number) open the lock? Writes the smart lock log.

POST/api/nodered/smart_lock/check_access

Expects JSON body: { "instance_id": "...", "lock_id": "front_door", // a lock of this Node-RED instance "smart_lock_id": 12, // or any ERP smart lock "credential": "04A1B2C3D4", "credential_type": "auto", // auto, access_code, member_card or card "open": false // ERP opens a lock of another provider itself }

Responses

200Access decisionobject

Show fields (6)
  • grantedboolean
  • reasonstring

    granted, unknown_credential, no_access, invalid_code or code_expired

  • credential_typestring
  • smart_lockobject
    Show fields (2)
    • idinteger
    • namestring
  • personobject
    Show fields (2)
    • idinteger
    • namestring
  • openedboolean
Request
curl --request POST \
  --url https://your-instance.iw-erp.de/api/nodered/smart_lock/check_access \
  --header 'x-iw-jwt-token: <TOKEN>'
Response 200 application/json
{
  "granted": true,
  "reason": "string",
  "credential_type": "string",
  "smart_lock": {
    "id": 42,
    "name": "Beispiel"
  },
  "person": {
    "id": 42,
    "name": "Beispiel"
  },
  "opened": true
}