├── images
├── sauna.jpg
├── wifi.png
├── TH16_board.png
├── schematic.png
├── Sauna_APP_0m.png
├── Sauna_APP_1m.png
├── Sauna_App_59m.png
├── Sauna_App_60m.png
├── CaptivePortal1.png
├── CaptivePortal2.png
├── CaptivePortal3.png
├── CaptivePortal5.png
├── CaptivePortall4.png
├── Sauna_App_Heating.png
├── schematic_original.png
└── schematic_original_alt.png
├── resources
├── MQTT_DASH_no_newlines.json
├── MQTT_DASH_with_newlines.json
└── MQTT_DASH_Config_command_Line.txt
├── README.md
├── LICENSE
└── src
├── SAUNA.h
└── SAUNA.ino
/images/sauna.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/sauna.jpg
--------------------------------------------------------------------------------
/images/wifi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/wifi.png
--------------------------------------------------------------------------------
/images/TH16_board.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/TH16_board.png
--------------------------------------------------------------------------------
/images/schematic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/schematic.png
--------------------------------------------------------------------------------
/images/Sauna_APP_0m.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/Sauna_APP_0m.png
--------------------------------------------------------------------------------
/images/Sauna_APP_1m.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/Sauna_APP_1m.png
--------------------------------------------------------------------------------
/images/Sauna_App_59m.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/Sauna_App_59m.png
--------------------------------------------------------------------------------
/images/Sauna_App_60m.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/Sauna_App_60m.png
--------------------------------------------------------------------------------
/images/CaptivePortal1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/CaptivePortal1.png
--------------------------------------------------------------------------------
/images/CaptivePortal2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/CaptivePortal2.png
--------------------------------------------------------------------------------
/images/CaptivePortal3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/CaptivePortal3.png
--------------------------------------------------------------------------------
/images/CaptivePortal5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/CaptivePortal5.png
--------------------------------------------------------------------------------
/images/CaptivePortall4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/CaptivePortall4.png
--------------------------------------------------------------------------------
/images/Sauna_App_Heating.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/Sauna_App_Heating.png
--------------------------------------------------------------------------------
/images/schematic_original.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/schematic_original.png
--------------------------------------------------------------------------------
/images/schematic_original_alt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/images/schematic_original_alt.png
--------------------------------------------------------------------------------
/resources/MQTT_DASH_no_newlines.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/resources/MQTT_DASH_no_newlines.json
--------------------------------------------------------------------------------
/resources/MQTT_DASH_with_newlines.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SwiCago/HarviaWiFi/HEAD/resources/MQTT_DASH_with_newlines.json
--------------------------------------------------------------------------------
/resources/MQTT_DASH_Config_command_Line.txt:
--------------------------------------------------------------------------------
1 | mosquitto_pub -h localhost -p 1883 -t 'metrics/exchange' -m '[ { "iconOff": "ic_power_settings_new", "iconOn": "ic_power_settings_new", "offColor": -1,
2 | "onColor": -1, "payloadOff": "{\"state\":false}", "payloadOn": "{\"state\":true}", "enableIntermediateState": true, "enablePub": true,
3 | "enteredIntermediateStateAt": 1548626272, "intermediateStateTimeout": 0, "jsOnReceive": "", "jsonPath": "", "qos": 0, "retained": false,
4 | "topic": "", "topicPub": "sonoff/sauna/set", "updateLastPayloadOnPub": true, "id": "5cc2df87-56d1-4852-a785-3fa969d558c5",
5 | "jsBlinkExpression": "", "jsOnDisplay": "", "jsOnTap": "", "longId": 1, "name": "On/Off", "type": 2 }, { "iconOff": "ic_flash_off",
6 | "iconOn": "ic_flash_on", "offColor": -1, "onColor": -1, "payloadOff": "0", "payloadOn": "1", "enableIntermediateState": true,
7 | "enablePub": false, "enteredIntermediateStateAt": 0, "intermediateStateTimeout": 0, "jsOnReceive": "", "jsonPath": "$.state",
8 | "qos": 0, "retained": false, "topic": "sonoff/sauna", "topicPub": "", "updateLastPayloadOnPub": true, "id":
9 | "d9eacfa0-385b-4717-a09c-ea9d2f56acd5", "jsBlinkExpression": "", "jsOnDisplay": "", "jsOnTap": "", "longId": 4, "name": "Power",
10 | "type": 2 }, { "iconOff": "ic_fire_01", "iconOn": "ic_fire_01", "offColor": -10461088, "onColor": -49088, "payloadOff": "0", "payloadOn": "1",
11 | "enableIntermediateState": true, "enablePub": false, "enteredIntermediateStateAt": 0, "intermediateStateTimeout": 0,
12 | "jsOnReceive": "", "jsonPath": "$.active", "qos": 0, "retained": false, "topic": "sonoff/sauna", "topicPub": "", "updateLastPayloadOnPub": true,
13 | "id": "2e63a4ac-6c06-4d2f-b748-019f8da2bfee", "jsBlinkExpression": "", "jsOnDisplay": "", "jsOnTap": "", "longId": 5, "name": "Active", "type": 2 },
14 | { "mainTextSize": "LARGE", "postfix": "", "prefix": "", "textColor": -1, "enableIntermediateState": true, "enablePub": true,
15 | "enteredIntermediateStateAt": 0, "intermediateStateTimeout": 0, "jsOnReceive": "", "jsonPath": "", "qos": 0, "retained": false,
16 | "topic": "", "topicPub": "", "updateLastPayloadOnPub": true, "id": "4e2bd1b1-2495-4263-923b-8629f20ccede", "jsBlinkExpression": "",
17 | "jsOnDisplay": "", "jsOnTap": "", "longId": 10, "name": "", "type": 1 }, { "mainTextSize": "LARGE", "postfix": "°C", "prefix": "",
18 | "textColor": -1, "enableIntermediateState": true, "enablePub": false, "enteredIntermediateStateAt": 0,
19 | "intermediateStateTimeout": 0, "jsOnReceive": "", "jsonPath": "$.celcius", "lastJsonPathValue": "1.5", "qos": 0, "retained": false,
20 | "topic": "sonoff/sauna", "topicPub": "", "updateLastPayloadOnPub": true, "id": "c6681108-1cb9-4da1-8697-9a0f65359540",
21 | "jsBlinkExpression": "", "jsOnDisplay": "", "jsOnTap": "", "longId": 3, "name": "Temp", "type": 1 }, { "mainTextSize": "LARGE", "postfix": "°F",
22 | "prefix": "", "textColor": -1, "enableIntermediateState": true, "enablePub": false, "enteredIntermediateStateAt": 0,
23 | "intermediateStateTimeout": 0, "jsOnReceive": "", "jsonPath": "$.fahrenheit", "qos": 0, "retained": false, "topic": "sonoff/sauna", "topicPub": "",
24 | "updateLastPayloadOnPub": true, "id": "03f4e423-3fe5-46b2-a680-bb1d787fa258", "jsBlinkExpression": "", "jsOnDisplay": "",
25 | "jsOnTap": "", "longId": 8, "name": "Temp", "type": 1 }, { "items": [ { "label": "70", "payload": "{\"setpoint\":70}" }, { "label": "75",
26 | "payload": "{\"setpoint\":75}" }, { "label": "80", "payload": "{\"setpoint\":80}" }, { "label": "85", "payload": "{\"setpoint\":85}" },
27 | { "label": "90", "payload": "{\"setpoint\":90}" }, { "label": "95", "payload": "{\"setpoint\":95}" }, { "label": "100", "payload": "{\"setpoint\":100}" },
28 | { "label": "105", "payload": "{\"setpoint\":105}" }, { "label": "110", "payload": "{\"setpoint\":110}" } ], "mainTextSize": "LARGE",
29 | "textColor": -1, "enableIntermediateState": true, "enablePub": true, "enteredIntermediateStateAt": 0, "intermediateStateTimeout": 0,
30 | "jsOnReceive": "", "jsonPath": "$.setpoint", "qos": 0, "retained": false, "topic": "sonoff/sauna", "topicPub": "sonoff/sauna/set",
31 | "updateLastPayloadOnPub": true, "id": "4b9f092c-fe6b-4760-af79-7ed29f888549", "jsBlinkExpression": "", "jsOnDisplay": "", "jsOnTap": "",
32 | "longId": 6, "name": "SetPoint", "type": 4 }, { "mainTextSize": "LARGE", "postfix": "m", "prefix": "", "textColor": -1, "enableIntermediateState": true,
33 | "enablePub": false, "enteredIntermediateStateAt": 0, "intermediateStateTimeout": 0, "jsOnReceive": "", "jsonPath": "$.autooff", "qos": 0,
34 | "retained": false, "topic": "sonoff/sauna", "topicPub": "", "updateLastPayloadOnPub": true, "id": "cb4ba265-b6cb-4a6a-b6ff-9deabdd3357e",
35 | "jsBlinkExpression": "", "jsOnDisplay": "", "jsOnTap": "", "longId": 9, "name": "AutoOff", "type": 1 } ]'
36 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # HarviaWiFi
2 |
3 | Arduino code to control Harvia sauna heaters, with esp8266 enabled sonoff TH device
4 |
5 |
6 |
7 | WARNING: Modifing your Sauna heater with WiFi can cause death if you are not careful. You are dealing with 240V, so take precautions not to kill yourself. I am not responsible if you kill yourself or burn your sauna/house down. You have been warned.
8 |
9 | ## Contents
10 | - sources
11 | - schematics
12 | - instructions
13 |
14 | ## Controlling the sauna
15 | ### Captive Portal
16 |
17 |
18 | - First start is via Captive portal
19 | - Access Point Configuration
20 | - MQTT Configuration
21 | - Sauna Configuration
22 | - See more captive portal sample images in images folder
23 |
24 | ### MQTT DASH APP
25 |
26 |
27 | - MQTT DASH app
28 | - https://play.google.com/store/apps/details?id=net.routix.mqttdash&hl=en
29 | - Turn on/off sauna
30 | - Set point temperature in C
31 | - View Temperature in C/F, operating state and AutoOff status
32 | - See Resource files for faster config of APP
33 | - See more APP sample images in images folder
34 | - In order to use this APP or any other MQTT app, you will need to install an MQTT broker.
35 | - Mosquitto is such a broker and easy to install. Do google search for instructions
36 | - Integrations
37 | - With MQTT you can easily integrate with openhab and homeassistant, which in turn can be linked with alexa or google assistant.
38 |
39 | ## Flashing firmware
40 | ### Firmware requirements
41 | - You will need latest Arduino IDE
42 | - Install ESP8266 board in the IDE
43 | - Install JSON library 5, not 6. I need to recode to support 6+
44 | - Download pubsub client library for arduino
45 | - Download this code
46 | - Connect SONOFF TH16 to serial <--> usb adapter
47 | - Flash Settings
48 | - Generic ESP8266 Module
49 | - CPU Frequency 80Mhz
50 | - Flash Size 1M 64k SPIFFS
51 | - Flash Mode DIO
52 | - Debug None
53 | - Port COM (select from serial list)
54 | - All other settings default (unless over air after first flash)
55 | - Flash OTA Settings
56 | - Debug Level OTA
57 | - Port sauna at xxx.xxx.xxx.xxx
58 |
59 | ### First time flashing
60 | - !!! DO NOT have mains connected to device when flashing with a serial <-> usb adapter. It will destroy the device and quite possibly your computer and you might even kill yourself !!!
61 | - Connect SONOFF TH16 via serial <-> usb adapterto computer (make sure yours has 3v3 option), do not plug into your computer yet
62 | - Hold white button down and then connect usb side of adapter to your computer.
63 | - Select the COM device under Port setting of the IDE and then Upload
64 | - After flashing is complete, it should reboot and be in captive portal mode.
65 | - Connect your table or phone to open wifi "sauna" and it should ask you to sign in. If not open your browser and go to 192.168.1.1
66 | - Enter config details necessary to connect to your network and MQTT broker. The device will reboot and connect to your network. You should see data on MQTT broker.
67 | - If you mess up configuration at anytime, just hold button down for at least 30 seconds and this will reset back to captive portal mode.
68 | - Now that you have flashed first time, the device should be listed in the OTA section of port selection. If you want to make changes, you can now OTA flash. You can OTA flash even when installed in Sauna. Your Sonoff TH16 may now be install into your sauna. Remember turn off your breaker before doing so!!!
69 |
70 | ### Notes
71 |
72 | - I repeat! Never ever have mains(240V or 120V) connected to device when flashing with a serial <-> usb adapter
73 | - In order to Flash for the first time, you will need to solder wires or headers to the board. When ready to flash, hold push button down and apply power.
74 | - How to backup SONOFF firmware, in case you want to put original firmware back on it.
75 | - esptool.py --port COMPORT read_flash 0x00000 0x100000 sonoff_TH16.bin
76 | - Note: the sonoff TH16 has pads for UFL connector(bottom left of pic below). This allows you to use an external antenna if needed.
77 |
78 |
79 | ## Hardware Installation
80 |
81 | ## Installation
82 | - Turn OFF breaker, 240V will kill you.
83 | - Review Circuit diagrams, so you know which spade connectors to move
84 | - Put 6 20A fuses into fuse block and close
85 | - Open bottom panel of Harvia heater
86 | - Install Fuse block in a convinient spot, I chose to install where thermostat and timer switch were.
87 | - Find the Thermostat
88 | - It has 6 terminals
89 | - Move the 3 from same side and connect to fuse block, same side
90 | - Move the other 3 from other side and connect to fuse block, on opposite side.
91 | - Be sure to keep order of wires, label T1 T2 T3
92 | - Find timer
93 | - There are 3 wires, one goes to limit switch and the other 2 go to contactor
94 | - Two will be close together and one on the side kind of alone. Move the lone one to one side of fuse block. Label as R
95 | - Now two are left. Take the one that goes to limit switch and connect to fuse block. Label L2
96 | - Now there is one left and it goes to contactor, move it to fuse block and label L1
97 | - You should now have all 3 wires on one side of fuse block
98 | - Remove or move the Timer and Thermostat(including its sensor). I moved mine to the side and not in my garage where they will get lost.
99 | - Connecting Wifi SONOFF TH16
100 | - Make 3 long jumper wires with spade connectors on them
101 | - From fuse block opposite L1 connect to sonoff N
102 | - From fuse block opposite L2 connect to sonoff L(in)
103 | - From fuse block opposite R connect to sonoff L(out)
104 | - Hardware installation should be complete and easily reversible, thanks to fuse block
105 | - Turn on breaker and see if Sauna is listed in your Wifi. Connect to it configure and enjoy
106 |
107 |
108 | ### New Circuit Diagram
109 |
110 |
111 |
112 | ### Original Circuit Diagram
113 |
114 |
115 |
116 | ### Parts Required
117 |
118 | - SONOFF TH16 (buy two as a spare)
119 | - https://www.amazon.com/dp/B06XTNSJ46/
120 | - DS18B20 Waterproof Temperature Sensor
121 | - https://www.amazon.com/gp/product/B078NRBNM8/
122 | - 2.5mm extension cable
123 | - https://www.amazon.com/gp/product/B00FJEH1PY/
124 | - Fuse Block
125 | - https://www.amazon.com/gp/product/B0752QMXGC/
126 | - 20 Amp ATM fuses
127 | - https://www.amazon.com/dp/B000CF7CRW/
128 |
129 |
130 | ## License
131 |
132 | Licensed under the GNU Lesser General Public License.
133 | https://www.gnu.org/licenses/lgpl.html
134 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.