klausahrenberg / WThermostatBeca

Replaces original Tuya firmware on Beca thermostat with ESP8266 wifi module
398 stars 98 forks source link
esp esp8266 iot iot-application iot-device mqtt thermostat tuya tuya-smart

ThermostatBecaWifi

GitHub version

Replaces original Tuya firmware on Beca thermostat with ESP8266 wifi module. The firmware is tested with following devices:

BAC-002 ME102H

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

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

    {
    "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

    {
    "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.

    {
    "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