This projects provides a firmware for an ESP8266 to control radiator valves.
Early beta
Pins can be configured via the webinterface. The current defaults are:
Function | Ground | VIN |
---|---|---|
Motor | D6 (12) | D5 (14) |
Window | D8 (15) | D7 (13) |
To extend the battery lifetime this project is using the following batteries
Battery holder:
Battery:
To monitor their voltage the ADC of the ESP is used. This requires to solder a voltage divider, with 100k and 33k Ohm resistance. For details, see the schematics. Please note that at this point it's not possible to configure the resistance values via the web interface. Please note that a nodemcu already comes with a voltage divider for the ADC. To use the battery management you have to de-solder these resistors
Run init.sh
to properly initialize the project.
To build run
platformio -c clion run --target release -e nodemcuv2
Connect to the WiFi OpenHeatESP... with password "OpenHeat". Open 192.168.4.1 in your browser and start configuration. Save config and the ESP will reboot and connect to your Wifi.
esptool.py --before no_reset --after hard_reset --chip esp8266 --port "/dev/ttyUSB0" --baud 921600 write_flash 0x0 ".pio/build/nodemcuv2/firmware.bin"
Download the latest firmware from releases and upload it on the web-ui. Make sure to download the correct version, otherwise your MCU has to be flashed via USB again.
The initial configuration allows the configuration of a user name and password for update purposes. This is to improve security a bit and not anyone in your network can flash a new firmware. For security purposes this data only can be changed in the configuration mode and not via the webinterface. To enable the configuration mode again restart your device twice in 10s.
The heater can be controlled via mqtt and integrated into home assistant.
It offers the following topics, all of them are prefixed with the configured topic ($TOPIC
):
$TOPIC/temperature/target/set
$TOPIC/temperature/target/get
$TOPIC/temperature/measured/get
$TOPIC/humidity/measured/get
$TOPIC/battery/percentage
$TOPIC/battery/voltage
$TOPIC/mode/get
$TOPIC/mode/set
$TOPIC/modemsleep/get
(time is milliseconds)$TOPIC/modemsleep/set
(time is milliseconds)
The battery percentage assumes a voltage between 3.1 and 4.2 volts
Example configuration for home assistant:
climate:
- platform: mqtt
modes:
- "off"
- "heat"
name: Living room
temperature_command_topic: "$TOPIC/temperature/target/set"
temperature_state_topic: "$TOPIC/temperature/target/get"
current_temperature_topic: "$TOPIC/temperature/measured/get"
mode_command_topic: "$TOPIC/mode/set"
mode_state_topic: "$TOPIC/mode/get"
retain: true
optional if you also want to monitor the battery state:
- platform: mqtt
state_topic: "$TOPIC/battery/voltage"
name: "Bed Heater Voltage"
- platform: mqtt
state_topic: "$TOPIC/battery/percent"
name: "Bed Heater Percent"
All commands must be sent with retain flag to allow the device to read the value as soon as it comes out of sleep
Enable debugging and web interface, WARNING this consumes a lot more power is not intended to be used for battery operation:
mosquitto_pub -h hassbian -t "$TOPIC/debug/enable" -m "true" -r
Set log level
mosquitto_pub -h hassbian -t "$TOPIC/debug/loglevel" -m "$LEVEL" -r
Level can be a value between 0 (highest log level = all logs) and 5 (lowest log level = only fatal errors)
Receive logs
mosquitto_sub -h hassbian -t "$TOPIC/log"
platformio -c clion device monitor -e nodemcuv2 -f esp8266_exception_decoder
Subscribe to topic $TOPIC/log
Logs are displayed in the web ui at the bottom of the page.
cmake -DCMAKE_BUILD_TYPE=nodemcuv2 --CMAKE_EXPORT_COMPILE_COMMANDS=YES ..
scan-build-11 make
The case is designed to hold to valve, a dual 18650 battery holder and an 60x40mm circuit board. At this moment the case has not been printed nor tested yet.
As this project is still in a very early stage no contributions will be accepted at the moment.