HTTP-web-interface-and-API.md 2.5 KB

WiFiThermostat - HTTP web interface and API

Web interface

The thermostat runs a small web interface for direct control and configuration. The web interface itself runs on HTTP port 80.

URL: http://IPADDRESS/

It can be user/password protected using the options in Base configuration. The Web interface includes the following functions:

  • WiFi settings
  • Base configuration
  • Extended configuration
  • Firmware update
  • Restart

HTTP API

Some values can be also directly be changed using this HTTP API. Most options use a TOKEN for "protection", which can be different to the HTTP password and must be configured on the Base configuration page on the web interface.

Currently the following HTTP API calls are implemented:

Set point

Sets the heating target temperature.

URL: http://IPADDRESS/setPoint?value=VALUE&token=TOKEN

Where VALUE is float in 0.5 steps >= configured setTempMin & <= setTempMax.

Lower values result in setTemp = setTempMin, higher in setTemp = setTempMax.

Decimals other than .0 and .5 are rounded to the nearest valid value.

Set mode

Sets the heating mode. Can be one of the following values:

  • 0 - heating off
  • 1 - normal heating mode
  • 2 - reduction mode

URL: http://IPADDRESS/setMode?value=VALUE&token=TOKEN

MQTT reconnect

Forces MQTT reconnect. Can be used without token or authentication.

URL: http://IPADDRESS/mqttReconnect

Restart

Restarts the MCU. Can be used without token or authentication.

URL: http://IPADDRESS/restart

Info

Returns some runtime information. Currently not much.

URL: http://IPADDRESS/info

API

Returns a JSON string with some current data. Can currently be used without token or authentication but this will be changed. Also used for the buttons on the web interface.

http://IPADDRESS/api

Example: {"devname":"Thermostat 1","ssid":"SSID","setTemp":22.5,"temp":22.40049,"hum":37,"mode":1,"heating":false}

Where:

  • setTemp = set point temperature
  • temp, hum = current readings from the temperature/humidity sensor
  • mode = heating mode
  • heating = false if heating is currently off, true if heating is currently on

Additionally /api can take the following arguments, which are only intended to be used by the web interface buttons:

  • plusBtn
  • minusBtn
  • modeBtn
  • onoffBtn

confdata, confdata2

This is the backend of the configuration pages in the web interface. Only intended to be used by that.