synchardchangesApi - n1lby73/industrial-IOT GitHub Wiki
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.
-
URL:
https://industrialiot.onrender.com/api/synchardchanges
-
Method:
PUT
-
Headers:
-
Content-Type:
application/json
-
Content-Type:
- Body Parameters:
Parameter | Type | Description |
---|---|---|
status | String | New state (required) |
pin | String | Hardware pin (required) |
-
Success Response:
- Status Code: 200 OK
-
Response Body:
{ "success": "<NEW_STATE>" }
- Description: Indicates successful synchronization of the hardware state with the provided status.
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>" }
-
Request Method:
PUT
-
Endpoint URL:
https://industrialiot.onrender.com/api/synchardchanges
-
Header:
Content-Type: application/json
-
Request Body:
{ "status": "<NEW_STATE>", "pin": "<HARDWARE_PIN>" }
Note: The
status
field in the request body should only contain either0
or1
to represent the new state.
For details on consumed pins and functions, check here.