Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
783c825
Add Tuya device MH-1820, publish select data on MQTT
aoe1 Feb 24, 2021
9a24a7c
Update README.md
aoe1 Feb 24, 2021
f0f679a
Update README.md
aoe1 Feb 24, 2021
3ed1036
Switch back Readme
aoe1 Feb 24, 2021
9b9e7f8
Create MH-1820.md
aoe1 Feb 24, 2021
62bc301
Update README.md
aoe1 Feb 24, 2021
0bb8ec6
Delete WThermostat_1.19.bin
aoe1 Feb 24, 2021
353c12c
Delete WThermostat_1.20m_beta.bin
aoe1 Feb 24, 2021
a0baf10
Add files via upload
aoe1 Feb 24, 2021
b956f31
Pics of MH-1820
aoe1 Feb 24, 2021
4439ecc
Merge branch 'master' of https://github.com/aoe1/WThermostatBeca
aoe1 Feb 24, 2021
5403ddd
Moved MH-1820 pics
aoe1 Feb 24, 2021
7db2e06
Rename MH-1820 to MH-1823 (my mistake)
aoe1 Feb 24, 2021
7df6008
Update MH-1820.md
aoe1 Feb 24, 2021
d464251
Update and rename MH-1820.md to MH-1823.md
aoe1 Feb 24, 2021
9b1b68c
Delete MH_1820_back.jpeg
aoe1 Feb 24, 2021
2917d9f
Delete MH_1820_pcb.jpeg
aoe1 Feb 24, 2021
ce541d7
Delete MH_1820_pcb_ed.jpeg
aoe1 Feb 24, 2021
bf4408b
Added temperatureFactorTarget to MQTT reaction, removed unused byteSc…
aoe1 Feb 25, 2021
4132940
Removed Fan mode (unused in MH-1823)
aoe1 Feb 25, 2021
fa53cca
Update README.md
aoe1 Feb 25, 2021
c092f2f
Update README.md
aoe1 Feb 25, 2021
6bfd8e0
Update MH-1823.md
aoe1 Feb 25, 2021
07baf1e
Update MH-1823.md
aoe1 Feb 25, 2021
42bdfe8
Update MH-1823.md
aoe1 Feb 25, 2021
4bb1ee4
Update MH-1823.md
aoe1 Feb 25, 2021
e867e18
Rename MQTT temperatures to canonical names without "actual"
aoe1 Feb 25, 2021
0e17bfd
Add files via upload
aoe1 Feb 25, 2021
98ad561
Update MH-1823.md
aoe1 Feb 25, 2021
db728d7
Some links and headings
aoe1 Feb 25, 2021
71d9161
corrections/updates for DPs
aoe1 Feb 25, 2021
8ba5c44
lf
aoe1 Feb 25, 2021
c0dfd07
Merge branch 'master' of https://github.com/aoe1/WThermostatBeca
aoe1 Feb 26, 2021
98bce45
Not for publication
aoe1 Feb 26, 2021
7e65476
Not for publication
aoe1 Feb 26, 2021
71d60cc
ignore build files
aoe1 Feb 26, 2021
8314b15
Ignore DPs
aoe1 Mar 3, 2021
a8ae9ec
Usage/Changes
aoe1 Mar 29, 2021
125136e
Update MH-1823.md
aoe1 Mar 29, 2021
a0bb9d5
Merge branch 'master' of https://github.com/klausahrenberg/WThermosta…
aoe1 Oct 18, 2021
178b891
Merge branch 'klausahrenberg-master'
aoe1 Oct 18, 2021
5969a1c
Version 1.20n aoe1
aoe1 Oct 18, 2021
32316ce
Current version
aoe1 Jun 21, 2022
7c62068
Short usage
aoe1 Jun 21, 2022
4094b60
add wifi password
aoe1 Jun 21, 2022
47217c8
delete old binary
aoe1 Jun 21, 2022
6968854
Delete firmware-mh1823-esp8266.bin
aoe1 Jun 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions MH-1823.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# ThermostatBecaWifi MH-1823

This is a fork off Klaus Ahrenberg's open source thermostat firmware project https://github.com/klausahrenberg/WThermostatBeca/ to support my Tuya compatible MH-1823 wifi thermostats. CAVE: those originally use a WBR3 Module (RTL8720) which is incompatible with the ESP8266 firmware, so I replaced it with an ESP-07 (pin compatible). Unsoldering worked reasonably well with a hot air gun (pics on request).

Usage see below, and don't forget to set your thermostat to MH-1823 from the default BHT-002!

The MCU product is a "Holtek bs67f360 BAC" with product version 4dl9hkne.

How to check if this will work with your thermostat's MCU (you don't need the secret for the version check):

> $ python3 -m tuyapower
>
> TuyaPower (Tuya compatible smart plug scanner) [0.0.25] tinytuya [1.2.1]
>
> Scanning on UDP ports 6666 and 6667 for devices (15 retries)...
>
> FOUND Device [Valid payload]: 192.168.2.230
> ID = bfb9c8eb2f4f79bf82eesm, product = 4dl9hkne, Version = 3.3
> Device Key required to poll for stats

![MH-1823 inside](docs/MH-1823/MH_1823_pcb_ed.jpeg) ![MH-1823 back](docs/MH-1823/MH_1823_back.jpeg)



DPS List for MH-1823
--------------------
```
1 on/off
2 manual/program/holiday (holiday -> 32: days remaining)
3 start/stop (heater relay)

5 lock

9 antifreeze

18 sensor in/out/in_out
19 c/f

22 desired temp

32 undefined/number of holidays left
33 sensor in in o C * 10


35 t comp in sensor
36 wifi signal strength request/info
37 sensor in in F * 10

39 working day mode 6_1/5_2/7

42 programming string in base64 e. g. AAYCxgAIAk4eCwJOHgwCTgARAsYAFgJOAAgCxgAXAk4=
45 wifi request/info

101: floor temp in C * 10
102: floor temp in F * 10
103 t comp out sensor
104 t slewing (hysteresis?)
105 power on/off on lock (power/no_power)
106: 35 ???
107: 96 ???
```
There are a few that the MCU throws out initializing but I haven't found out what they do yet: 0xc, 0x17, 0x20, 0x6a, 0x6b
```
thermostat_kueche {"error":"Unknown MCU command: 55 aa 03 07 00 05 0c 01 00 01 00"}
thermostat_kueche {"error":"Unknown MCU command: 55 aa 03 07 00 08 17 02 00 04 00 00 00 45"}
thermostat_kueche {"error":"Unknown MCU command: 55 aa 03 07 00 08 20 02 00 04 00 00 00 01"}
thermostat_kueche {"error":"Unknown MCU command: 55 aa 03 07 00 08 6a 02 00 04 00 00 00 23"}
thermostat_kueche {"error":"Unknown MCU command: 55 aa 03 07 00 08 6b 02 00 04 00 00 00 5f"}
```

I got most of the DPs via tuya-mqtt after obtaining their "secrets" from the cloud by installing the Smart Life App, creating a Tuya IoT dev account, linking this to the Smart Life App, and pulling the secrets via tinytuya wizard from the cloud. The MCU speaks Tuya serial protocol version 3. The easiest way to access the original WBR3 firmware (provided you have the local key from the cloud) is probably with tuya-cli, e. g. target temperature:

> tuya-cli get --ip 192.168.x.y --id bfb9c8eb2f4f79bf82eesm --key 10d6a51aa4b88bbd --protocol-version 3.3 --dps 22
>
> tuya-cli set --ip 192.168.x.y --id bfb9c8eb2f4f79bf82eesm --key 10d6a51aa4b88bbd --protocol-version 3.3 --dps 22 --set 16

In the current version, it publishes some of the data via MQTT: deviceOn, relay, actualTemperature, actualFloorTemperature, targetTemperature

With fashbergs firmware I also managed to try out some of the commands.


Shielding for hot air gun desoldering
-------------------------------------

![MH-1820 solder shield](docs/MH-1823/hot_air_gun_shield.jpeg)

Serial Protocol
---------------
More info on the Tuya serial protocol version 3 can be found here:

https://developer.tuya.com/en/docs/iot/smart-product-solution/product-solutiongateway/gateway-mcu-access-solution/tuya-gateway-mcu-access-communication-protocol

https://developer.tuya.com/en/docs/iot/device-development/embedded-software-development/mcu-development-access/wifi-mcu-sdk-solution/tuya-cloud-universal-serial-port-access-protocol

Theo Arends has also done some work on the Tuya devices, but I haven't tried Tasmota for the thermostats yet.

https://tasmota.github.io/docs/TuyaMCU/


Changes (mostly in the MH-1823 branch)
-------

* child lock on/off
* separate temperature factors for desired and actual temperatures
* wifi status including rssi
* floor temperature

Usage
-----

The fork works mostly like Klaus' original version. Examples:
```
mosquitto_pub -h localhost -t thermostat_xxx/thermostat/set/locked -m "true"
mosquitto_pub -h localhost -t thermostat_xxx/thermostat/set/targetTemperature -m "20.0"
mosquitto_pub -h localhost -t thermostat_xxx/thermostat/set/systemMode -m "manual"
state:
http://thermostat_xxx/things/thermostat/properties
schema:
http://thermostat_xxx/things/thermostat/debug
read a single property via http:
http://thermostat_xxx/things/thermostat/properties/relay
```


124 changes: 4 additions & 120 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,125 +1,9 @@
# ThermostatBecaWifi

[![GitHub version](https://img.shields.io/github/release/klausahrenberg/WThermostatBeca.svg)](https://github.com/klausahrenberg/WThermostatBeca/releases/latest)
[![GitHub release (latest by date including pre-releases)](https://img.shields.io/github/v/release/klausahrenberg/WThermostatBeca?include_prereleases&label=beta)](https://github.com/klausahrenberg/WThermostatBeca/releases)
This is a fork off https://github.com/klausahrenberg/WThermostatBeca/ to support my Tuya compatible MH-1823 wifi thermostats. CAVE: those originally use a WBR3 Module (RTL8720) which is incompatible with the ESP8266 firmware, so I replaced it with an ESP-07 (pin compatible). Unsoldering worked reasonably well with a hot air gun.

Replaces original Tuya firmware on Beca thermostat with ESP8266 wifi module. The firmware is tested with following devices:
* BHT-002, BHT-6000, BHT-3000 (floor heating)
* AVATTO ME102H (Thermostat with LCD touch screen)
* BAC-002 (heating, cooling, ventilation)
* ET-81W
* Floureon HY08WE
* AVATTO ME81AH (floor heating, thanks to @lozb36 for implementation)
* Minco Heat MK70GB-H (floor heating, thanks to @indimouse for implementation)
* VH Control Calypso-W
# Getting Started

![BAC-002](docs/BAC-002/front_bac-002.jpg) ![ME102H](docs/ME102H/front_me102h.png)
Resolder MCU board, connect to its access point thermostat_f00bad with password 12345678, set Wifi and MQTT

## Function support since 1.20 (beta status)
For productive use only stable version 1.19. Version 1.20x_beta is rewritten to make the support of different models more easily in future. For model BHT-002 and ME102H the new version is tested and should work reliable already.

| Function | BHT-002 BHT-6000 BHT-3000 | ME102H | BAC-002 | ET-81W | HY08WE | ME81AH | MK70GBH | Calypso-W* |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| actual temperature | yes | yes | yes | yes | yes | yes | yes | yes |
| target temperature | yes | yes | yes | yes | yes | yes | yes | yes |
| floor temperature | yes | yes | no | yes | yes | yes | no | yes |
| schedules mode | auto off | auto off | auto off | holiday auto hold | off auto holiday hold | auto off | off auto hold | holiday auto hold |
| locked | yes | yes | yes | yes | yes | yes | yes | yes
| schedules | 18 | 8 | 18 | no | no | 8 | 8 | no
| system mode | no | no | cool, heat, fan | no | no | heat, cool, fan | no | no
| fan mode | no | no | auto, high, med, low | no | no | no | no | no

'* needs testing

## Features
* No Tuya cloud connection anymore
* Enables thermostat to communicate via MQTT and/or Mozilla Webthings
* Configuration of connection and device parameters via web interface
* NTP and time zone synchronisation to set the clock of thermostat
* Reading and setting of all parameters via MQTT
* Reading and setting of main parameters via Webthing
* Only BHT-002-GBLW: actualFloorTemperature (external temperature sensor)
* Only BAC-002-ALW: fanSpeed:auto|low|medium|high; systemMode:cooling|heating|ventilation
* Reading and setting of time schedules via MQTT
## Installation
To install the firmware, follow instructions here:
https://github.com/klausahrenberg/WThermostatBeca/blob/master/Flashing.md
## Initial configuration
To setup the device model, network options and other parameters, follow instrcution here:
https://github.com/klausahrenberg/WThermostatBeca/blob/master/Configuration.md
After initial setup, the device configuration is still available via `http://<device_ip>/config`
## Integration in Webthings
This firmware supports Mozilla Webthings directly. With Webthings you can control the device via the Gateway - inside and also outside of your home network. No clunky VPN, dynDNS solutions needed to access your home devices. I recommend to run the gateway in parallel to an MQTT server and for example Node-Red. Via MQTT you can control the device completely and logic can be done by Node-Red. Webthings is used for outside control of main parameters.
Add the device to the gateway via '+' icon. After that you have the new nice and shiny icon in the dashboard:
![webthing_icon](https://github.com/klausahrenberg/WThermostatBeca/blob/master/docs/Webthing_Icon.png)
The icon shows the actual temperature and heating state.
There is also a detailed view available:
<img src="https://github.com/klausahrenberg/WThermostatBeca/blob/master/docs/Webthing_Complete.png" width="400">

## Json structure
Firmware provides 3 different json messages:
1. State report
2. Schedules
3. Device information (at start of device to let you know the topics and ip)
### 1. State report
**MQTT:** State report is provided every 5 minutes, at change of a parameter or at request via message with empty payload to `<your_mqtt_topic>/thermostat/<your_state_topic>`
**Webthing:** State report can be requested by: `http://<device_ip>/things/thermostat/properties`
```json
{
"idx":"thermostat_beca",
"ip":"192.168.x.x",
"firmware":"x.xx",
"temperature":21.5,
"targetTemperature":23,
"deviceOn":true,
"schedulesMode":"off|auto",
"ecoMode":false,
"locked":false,
"state":"off|heating", //only_available,_if_hardware_modified
"floorTemperature":20, //only_BHT-002-GBLW
"fanMode":"auto|low|medium|high", //only_BAC-002-ALW
"systemMode":"cool|heat|fan_only" //only_BAC-002-ALW
}
```
### 2. Schedules
**MQTT:** Request actual schedules via message with empty payload to `<your_mqtt_topic>/thermostat/<your_state_topic>/schedules`
**Webthing:** State report can be requested by: `http://<device_ip>/things/thermostat/schedules`
```json
{
"w1h":"06:00",
"w1t":20,
"w2h":"08:00",
"w2t":15,
...
"w6h":"22:00",
"w6t":15,
"a1h":"06:00",
...
"a6t":15,
"u1h":"06:00",
...
"u6t":15
}
```
Schedules can be modified via MQTT. Send a payload structure with all schedules or only the parts you want to modify to
`<your_mqtt_topic>/thermostat/<your_set_topic>/schedules`.
### 3. Device information
**MQTT:** At start of device to let you know the topics and ip to `devices/thermostat`
**Webthing:** n.a.
```json
{
"url":"http://192.168.x.x/things/thermostat",
"ip":"192.168.x.x",
"stateTopic":"<your_mqtt_topic>/thermostat/<your_state_topic>"
"setTopic":"<your_mqtt_topic>/thermostat/<your_set_topic>"
}
```
## Modifying parameters via MQTT
Send a complete json structure with changed parameters to `<your_mqtt_topic>/thermostat/<your_set_topic>`, e.g. `beca/thermostat/set`. Alternatively you can set single values, modify the topic to `<your_mqtt_topic>/thermostat/<your_set_topic>/<parameter>`, e.g. `beca/thermostat/set/deviceOn`. The payload contains the new value.
Send a json with changed schedules to `<your_mqtt_topic>/things/thermostat/schedules`.

### Build this firmware from source
For build from sources you can use the Atom IDE (recommended), Arduino IDE or other. All sources needed are inside the folder 'WThermostat' and my other library:
https://github.com/klausahrenberg/WAdapter.
Additionally you will need some other libraries, which you can find listed here:
https://github.com/klausahrenberg/WThermostatBeca/blob/master/WThermostat/platformio.ini
For more info on the device and the fork see https://github.com/aoe1/WThermostatBeca/blob/master/MH-1823.md
65 changes: 0 additions & 65 deletions WThermostat/.clang_complete

This file was deleted.

Loading