Communication / REST API

A Comprehensive Guide to Using the Device's REST API

The following guide describes how to work with the MiniHPC device's REST API, which utilizes 4 JSON files:

  • - contains the device configuration
  • - contains the data from the device
  • - allows you to change the MiniHPC configuration
  • - allows you to send values of external sensors

Changes in the configuration and sending values for external sensors will only be allowed if the permissions are enabled in the menu 9.4 Permissions

Overview of Available Files and Endpoints

1. config.json

  • This file contains all configuration parameters of the device.
  • Example:
    {
        "mode":1,
        "heating_onoff_input":3,
        "heating_reg_input":2,
        "heating_t1_hysteresis":2,
        "heating_reg_temp":2,
        "temperature_T1":235,
        "temperature_T3":35,
        "temperature_T3_cool":18,
        ...
    }
            

2. data.json

  • This file contains the data provided or collected by the device.
  • Example:
    {
        "t1":25.08,
        "t2":27.36,
        "t3":27.35,
        "t4":-40,
        "t5":42.4,
        "t6":25.61,
        ...
    }
            

3. Endpoint for Changing the Configuration:

  • URL: setconfig.json?set=JSON_PARAMETERS
  • Description: Used for setting or changing the configuration parameters defined in config.json.
  • Format: JSON_PARAMETERS: The parameter set must contain valid JSON data (a JSON object) with corresponding keys matching the items in config.json. You can set one or several parameters at once.
  • Example call: the allowed method is GET
    http://LOCAL_IP/setconfig.json?set={"mode":1,"temperature_T1":230}
    This call switches the mode to heating and sets the room temperature T1 to 23°C.
  • No save URL: setconfig.json?setns=JSON_PARAMETERS
    When using the variable setns instead of set, the parameters will be changed in MiniHPC but will not be saved to the device's memory. MiniHPC's memory has a limited number of write cycles, and under normal use, it does not get damaged. However, if an automated script is used to modify parameters multiple times per minute, it is recommended to use the variable setns.

4. Endpoint for Setting External Sensor Values:

  • URL: setsensor.json?set=JSON_PARAMETERS
  • Description: Used for manually setting the values of external sensors.
  • Format: JSON_PARAMETERS
    • T1 - internal temperature (decimal number)
    • Tout - external temperature (decimal number)
    • RH - relative humidity (decimal number)
    • You can set one or several parameters at once.
  • Example call: the allowed method is GET
    http://LOCAL_IP/setsensor.json?set={"T1":24.5,"Tout":-12, "RH": 45.58}
    This call sets T1 to 24.5°C, external temperature to -12.0°C, and relative humidity to 45.58%.