Commit d3f04ca991a748f9a9cb98b71251d42268ee74e1

Authored by Jeroen88
1 parent 09538f88

Update README.md files and remove passwords from the examples

README.md
... ... @@ -4,8 +4,20 @@ Create your own thermostat with this library and save money on your energy bills
4 4  
5 5 The library complies with the OpenTherm specification. Control any (condensing) boiler or air conditioner (HVAC) that also meets the OpenTherm specification.
6 6  
7   -The library can be easily installed in the Arduino IDE. It has been tested on an ESP32 microcontroller and will also work on an ESP8266.
8   -To connect the boiler, you will need an [OpenTherm controller](https://www.tindie.com/products/jeroen88/opentherm-controller/).
  7 +The library can be easily installed in the Arduino IDE. It has been tested on an ESP32 microcontroller and may also work on an ESP8266.
  8 +To connect the boiler, you will need an [OpenTherm controller](https://www.tindie.com/products/jeroen88/opentherm-controller/) or an [OpenTherm controller Shield](https://www.tindie.com/products/jeroen88/opentherm-controller-shield/).
  9 +
  10 +## Fully functioning Home Assistant Boiler Thermostat in examples
  11 +![Home Assistant logo](https://raw.githubusercontent.com/home-assistant/assets/master/logo/logo-small.png)
  12 +![MQTT logo](https://brands.home-assistant.io/_/mqtt/logo.png)\
  13 +
  14 +The Advanced_Thermostat example is specially designed for Home Assistant
  15 +- Setup the MQTT integration in Home Assistant, if not already done
  16 +- Set your WiFi network name and password in Advanced_Thermostat.ino
  17 +- Set your MQTT broker hostname or IP address, MQTT user name and MQTT password in Advanced_Thermostat.ino
  18 +- Compile and flash to an ESP32-S2 with an [OpenTherm controller Shield](https://www.tindie.com/products/jeroen88/opentherm-controller-shield/)
  19 +- Forward the temperature of a room thermometer to the Thermostat using a Home Assistant Automation
  20 +The thermostat (Climate) integration is automatically added to Home Assistant, together with several sensors. More information in ==TO DO LINK TO README.md in EXAMPLE==
9 21  
10 22 ## Installation
11 23 - Install the EasyOpenTherm library directly using the Arduino IDE library manager
... ...
examples/Advanced_Thermostat/Advanced_Thermostat.ino
... ... @@ -140,14 +140,14 @@ static const char * TAG = __FILE__;
140 140  
141 141  
142 142 // Update these with values suitable for your network.
143   -const char * ssid = "H369A394602";
144   -const char * password = "445396F996E9";
  143 +const char * ssid = "YOUR WIFI NETWORK NAME";
  144 +const char * password = "YOUR WIFI PASSWORD";
145 145  
146 146  
147 147 // Update these with values suitable for your MQTT broker, in this example TLS or certificates are not used
148   -const char * mqtt_server = "homeassistant.local";
149   -const char * mqtt_user = "mosquitto";
150   -const char * mqtt_password = "M0squ1tt0";
  148 +const char * mqtt_server = "YOUR MQTT SERVER NAME OR IP ADDRESS";
  149 +const char * mqtt_user = "YOUR MQTT USER NAME";
  150 +const char * mqtt_password = "YOUR MQTT PASSWORD";
151 151  
152 152  
153 153 // Your time zone, used to display times correctly (and needed for WiFiClientSecure TLS certificate validation, if used)
... ...
examples/README.md
1   -# Examples for OpenTherm Arduino ESP32/ESP8266 Library
  1 +# Examples for OpenTherm Arduino ESP32 Library
2 2  
3   -Several examples are given, all fully functional, from very basic to advanced. The first thing you should always do is to run Test_Boiler_Communication.ino or Test_HVAC_Communication.ino, to make sure your [OpenTherm controller](https://www.tindie.com/products/jeroen88/opentherm-controller/) is correctly wired, the right GPIO pins are configured and the secondary boiler or HVAC is responding to the requests of the primary thermostat.
  3 +Several examples are given, all fully functional, from very basic to advanced. The first thing you should always do is to run Test_Boiler_Communication.ino or Test_HVAC_Communication.ino, to make sure your [OpenTherm controller](https://www.tindie.com/products/jeroen88/opentherm-controller/) or [OpenTherm controller Shield](https://www.tindie.com/products/jeroen88/opentherm-controller-shield/) is correctly wired, the right GPIO pins are configured and the secondary boiler or HVAC is responding to the requests of the primary thermostat.
4 4  
5 5 ## Test_Boiler_Communication.ino and Test_HVAC_Communication.ino
6   -Basic test of your setup. The Test_HVAC_Communication.ino program is **not tested** because I do not own such a device.
  6 +Basic test of your setup. If everything is OK, you will see:
  7 +```
  8 +Your setup is working! A frame was send to the boiler and the boiler responded with a valid frame.
  9 +```
  10 +together with some more information.\
  11 +The Test_HVAC_Communication.ino program is **not tested** because I do not own such a device.
  12 +
  13 +## MQTT_Advanced_Thermostat.ino
  14 +![Home Assistant logo](https://raw.githubusercontent.com/home-assistant/assets/master/logo/logo-small.png)
  15 +![MQTT logo](https://brands.home-assistant.io/_/mqtt/logo.png)\
  16 +
  17 +The Advanced_Thermostat example is specially designed for Home Assistant with a MQTT integration. This example can also be used with other home automation software that supports MQTT. although auto discovery of the thermostat and the sensors will not work in this case.
  18 +### Prerequisites
  19 +- An OpenTherm controller connected to the thermostat wires
  20 +- Home Assistant installed
  21 +- A MQTT broker, preferably [Mosquitto](https://github.com/home-assistant/addons/blob/master/mosquitto/DOCS.md)
  22 +- The [MQTT integration](https://www.home-assistant.io/integrations/mqtt/) added to Home Assistant
  23 +- An ESP32, e.g. an ESP32-S2 mini, flashed with Advanced_Thermostat.ino. Before flashing, first set your WiFi network name and password, and your MQTT broker hostname or IP address, MQTT user name and MQTT password
  24 +- A thermometer in Home Assistant and an automation to forward the room temperature to the Thermostat using a Home Assistant Automation (Settings -> Automations & Scenes -> + Create Automation. Start with an empty automation, click the three dots in the upper right corner and select: Edit in YAML). Add:
  25 +```
  26 +alias: Publish room temperature
  27 +description: Publish room temperature to MQTT Climate state
  28 +trigger:
  29 + - platform: state
  30 + entity_id: sensor.temperature_humidity_sensor_2258_temperature
  31 +action:
  32 + - service: mqtt.publish
  33 + data:
  34 + topic: Metriot/EasyOpenTherm/22b5ea03f784/climate/state
  35 + payload: "{\"temperature\":{{ trigger.to_state.state }}}"
  36 +mode: single
  37 +```
  38 +Replace the entity_id with the id of your thermometer and replace '22b5ea03f784' number in the topic with your number (can be found in the logging)\
  39 +
  40 +The thermostat (Climate) integration is automatically added to Home Assistant, together with several sensors.
  41 +### Thermostat behaviour
  42 +- The thermostat is enabled in Home Assistant if it communicates with an OpenTherm boiler
  43 +- The thermostat shows the room temperature if it receives temperature updates over MQTT
  44 +- The desired room temerature, the room temperature setpoint, can be set by turning the dial
  45 +- As long as the thermostat is switched off it will never start heating
  46 +- Press the flame below the dial to turn the thermostat on
  47 +- If the room temperature is below setpoint (minus a 0.1 ºC deadzone) the boiler will start heating
  48 +- If the boiler switches off after running for a while, it will stay off for at least 10 minutes (Anti Hunting interval)
  49 +
  50 +### Sensors
  51 +The following sensors are always added:
  52 +- EasyOpenTherm xxxx Boiler Setpoint: showing the setpoint of the central heating boiler water temperature
  53 +- EasyOpenTherm xxxx Thermostat RSSI: showing the WiFi signal strength of the connection with the router
  54 +- EasyOpenTherm xxxx Boiler Flame: showing 'on' if the boiler is running for Central Heating or Domestic Hot Water, 'off' otherwise\
  55 +
  56 +The following sensors are optionally added:
  57 +- EasyOpenTherm xxxx Boiler Domestic Hot Water: is only added if the boiler supports DHW, showing 'on' if the boiler is running for DHW
  58 +- EasyOpenTherm xxxx Boiler Return Temperature: is only added if a return temperature sensor value can be read using the OpenTherm interface. It shows the temperature of the water returning to the boiler
  59 +- EasyOpenTherm xxxx Boiler Flow Temperature: is only added if a flow temperature sensor value can be read using the OpenTherm interface. It shows the temperature of the water leaving the boiler
  60 +- EasyOpenTherm xxxx Boiler Relative modulation: is only added if the relative modulation can be read using the OpenTherm interface. It shows the percentage of the maximum power actually used
  61 +- EasyOpenTherm xxxx Boiler Water Pressure sensor: is only added if the water pressure can be read using the OpenTherm interface. It shows the pressure of the water in the central heating circuit
  62 +
  63 +### Troubleshooting
  64 +- The Thermostat does not appear in Home Assistant - Make sure that the MQTT integration is correctly installed in Home Assistant. Check if the WiFi credentials and the MQTT credentials in Advanced_Thermostat.ino are correct
  65 +- The Thermostat does appear but it is not enabled - Check the wiring of the OpenTherm Controller to the boiler. Run Test_Boiler_Communication.ino first to check if the OpenTherm Controller can communicate with the boiler. Make sure the boiler is OpenTherm compatible.
  66 +- The Thermostat does appear and is enabled but no room temperature (ending in ºC) is shown in the middle - The thermostat is not receiving a room temperature; check the automation: did you select the right entity_id? Did you select the right topic? Go to Settings -> Devices & Services -> core-mosquitto CONFIGURE. Fill in '#' at 'Topic to subscibe to'. Wait a while, to see a message like:
  67 +
  68 +```
  69 +Message 42 received on Metriot/EasyOpenTherm/cc031c4e76a0/climate/state at 6:22 PM:
  70 +
  71 +{
  72 + "temperature": 17.1
  73 +}
  74 +```
  75 +You could blow into the thermometer to force a temperature update from the thermometer, that should inmediately appear in the MQTT messages.
  76 +
  77 +### Saving energy and money
  78 +The intention of the thermostat is to save energy and to save money. I can not guarantee though that this will also be the case in your setup. The thermostat can be tweaked to serve your needs by setting the options, most of these ```#defines``` are found in the main program and in ThermoStateMachine.cpp. Wrting your own thermostat software from scratch is also an option ofcourse.\
  79 +Home Assistant can be used for geo fencing and smart schemes to switch the boiler on and off.
  80 +
  81 +### Using Advanced_Thermostat.ino in other MQTT enabled home automation systems
  82 +The Advanced_Thermostat.ino can also be used in other MQTT enabled home automation systems. In this case the auto discovery of the Thermostat and the sensors will not work. But the thermostat can be controlled by publishing and subscribing to the right topics. In all below topics the hex number 22b5ea03f784 needs to be changed into the right number for your ESP32 (all small caps)
  83 +
  84 +Topics to publish to:
  85 +- Metriot/EasyOpenTherm/22b5ea03f784/climate/state: publish the room temperature in JSON format ```{"temperature": 19.8}```
  86 +- Metriot/EasyOpenTherm/22b5ea03f784/mode/set: publish ```off``` to switch the thermostat off, ```heat``` to switch it on
  87 +- Metriot/EasyOpenTherm/22b5ea03f784/setpoint/set: publish the desired room temperature (room temperature setpoint) in plain text format, e.g. ```20.8```
  88 +
  89 +Topics to subscribe to:
  90 +- Metriot/EasyOpenTherm/22b5ea03f784/flame/state: to receive 'flame' updates of the format ```{"flame":"OFF"}```
  91 +- Metriot/EasyOpenTherm/22b5ea03f784/RSSI/state: to receive 'RSSI' updates of the format ```{"RSSI":-57}```
  92 +- Metriot/EasyOpenTherm/22b5ea03f784/ch_setpoint/state: to receive 'central heating setpoint' updates of the format ```{"ch_setpoint":10.0}```
  93 +- Metriot/EasyOpenTherm/22b5ea03f784/flow_temperature/state: to receive 'flow temperature' updates of the format ```{"flow_temperature":25.7}```
  94 +- Metriot/EasyOpenTherm/22b5ea03f784/return_temperature/state: to receive 'return temperature' updates of the format ```{"return_temperature":25.5}```
  95 +- Metriot/EasyOpenTherm/22b5ea03f784/relative_modulation/state: to receive 'relative modulation' updates of the format ```{"relative_modulation":0.0}```
  96 +- Metriot/EasyOpenTherm/22b5ea03f784/water_pressure/state: to receive 'water pressure' updates of the format ```{"water_pressure":2.2}```
7 97  
8 98 ## OpenTherm_Show_DATA-IDs.ino
9 99 Sends all known DATA-IDs to the secondary and shows it's response. Can be used for both boilers and HVACs, although the boiler information is more extensive. Also the data types for the HVAC calls may not be correct.
... ... @@ -63,5 +153,3 @@ Number of times flame signal was too low: 13
63 153 ## Basic_Thermostat_Commands.ino
64 154 Shows the most basic commands that can be sent from a thermostat (primary) to a boiler (secondary) and may also be used as inspiration for a HVAC thermostat. It sets the room temperature setpoint to a fixed value, which is not reasonable for a real thermostat. But it will start your boiler and heat up your house! You need a temperature sensor connected to the microcontroller. The program used a BME280 sensor, but any sensor can be used, as long as you adapt the program accordingly.
65 155  
66   -## MQTT_Advanced_Thermostat.ino
67   -A fully functional thermostat sending measured room temerature to a MQTT broker and receiving the room temperature setpoint by subscribing to a MQTT topic. This program may also be used as inspiration for a HVAC thermostat. Again this program needs a temperature sensor connected.
... ...