synchardchangesApi - n1lby73/industrial-IOT GitHub Wiki

Overview

The Synchronize Hardware Changes API exclusively manages microcontroller operations, enabling swift hardware state synchronization. Tailored for microcontroller use, it empowers instant status updates via SocketIO. Triggered by physical changes from a push button, this synchronization promptly reflects alterations within the microcontroller's system.

Utilizing the PUT method, it requires two key parameters: status for the new state and pin for hardware pin synchronization. Ensuring accurate web interface updates, it efficiently communicates changes via emitted SocketIO messages.

Endpoint URL

  • URL: https://industrialiot.onrender.com/api/synchardchanges
  • Method:PUT

Request Parameters

  • Headers:

    • Content-Type: application/json
  • Body Parameters:
Parameter Type Description
status String New state (required)
pin String Hardware pin (required)

Responses

  • Success Response:
    • Status Code: 200 OK
    • Response Body:
      {
          "success": "<NEW_STATE>"
      }
      • Description: Indicates successful synchronization of the hardware state with the provided status.

Real-time Updates

When the pin state is successfully updated through a physical push button connected to the microcontroller, the server emits a socket message to connected clients with the following information:

  • Socket Message: localUpdate

  • Payload:

    {
      "update": "<STATUS>"
    }

Usage

  1. Request Method: PUT

  2. Endpoint URL: https://industrialiot.onrender.com/api/synchardchanges

  3. Header:

     Content-Type: application/json
  4. Request Body:

    {
        "status": "<NEW_STATE>",
        "pin": "<HARDWARE_PIN>"
    }

    Note: The status field in the request body should only contain either 0 or 1 to represent the new state.

Additional Information

For details on consumed pins and functions, check here.

⚠️ **GitHub.com Fallback** ⚠️