AVATTO ME81H Thermostat

Perhaps you need to give some more details here about your config. I just got couple of these working. Here is my setup, some examples use older syntax:

I would suggest you use mosquitto_sub to listen all events from your bus to see if what it is actually sending to you, and does it map to your config.

1 Like

Thanks a lot! Much better now.

The configuration posted here earlier wasn´t working for me but yours did the trick. I´ve used HA about three weeks now and I´m still quite depended on these online examples. YAML structure and syntax is still little bit confusing and not so straight forward to me.

1 Like

Happy to give back, I’m HA newbie myself, so glad I could help someone. It’s unfortunate the WThermostatBeca does not support setting of minimum temp below 10 on ME81H, that’s my only problem now. I believe the device would support it, but the code has not been added for ME81H.

Any help with that appreciated.

Hi, for what type and firmware version of thermostate you have this working?

My example code works for Firmware Version 1.20n and thermostate Avatto ME81H.

I tried your code but have the same issue as above that the Temperature Values do not show up correctly.

I do not know why it worked perfectly for me with my code :smiley:
Thanks!

My device is some bulk from ebay. There are tons of such sold if you look for ME81H. This is the 16A for floor heating. I comoiled the beca firmware from git latest couple of weeks ago. It says 1.25b.

There are some minor issues with it. Like the values need to be hammered in few times often, as there is no flow control between MCU and ESP.

Can you get any error messages over mqtt perhaps?

Hi,
I made some investigations and changes, and I think I got it working a even little bit better now…

If the checkbox “Send changes in separate MQTT messages” is checked, the “<yourd_id>/thermostate/properties” is not the “full” json where you are extracting the data from, but all the values are being send only in the separate mqtt topics. Thats on what I built my previous code, and also the automations which doing the “hammering in the values few times”. Aditionally, your code does not have the “action_topic” which determines the current action of the thermostate.

Currently this mqtt config is working for my thermostate with the Firmware Version 1.25b

mqtt:
  climate:
    - name: Thermostat
      unique_id: termostat
      device:
        configuration_url: http://<ip of your thermostate>/config
        manufacturer: Tuya
        model: ME81AH
        connections: [["mac", "XX:XX:XX:XX:FF:FF"]]
      temperature_command_topic: <your-id>/thermostat/set
      temperature_command_template: >
        {{ {'targetTemperature':value} | to_json }}
      temperature_state_topic: <your-id>/thermostat/properties
      temperature_state_template: >
        {% if value_json is defined and value_json['targetTemperature'] is defined %}
          {{ value_json['targetTemperature'] }}
        {% endif %}  
      current_temperature_topic: <your-id>/thermostat/properties
      current_temperature_template: >
        {% if value_json is defined and value_json['temperature'] is defined %}
          {{ value_json['temperature'] }}
        {% endif %}  
      mode_state_topic: <your-id>/thermostat/properties
      mode_state_template: >
        {% if value_json is defined and value_json['deviceOn'] is defined %}
          {% set deviceOn = value_json['deviceOn'] %}
        {% else %}
          {% set deviceOn = false %}
        {% endif %}
  
        {% if value_json is defined and value_json['schedulesMode'] is defined %}
          {% set schedulesMode = value_json['schedulesMode'] %}
        {% else %}
          {% set schedulesMode = 'off' %}
        {% endif %}
  
        {% if deviceOn == true %}
          {% if schedulesMode == 'auto' %}
            auto
          {% else %}
            heat
          {% endif %}
        {% else %}
          off
        {% endif %}
      action_topic: <your-id>/thermostat/properties
      action_template: >
        {% if value_json is defined and value_json['systemMode'] is defined %}
          {% set deviceOn = value_json['deviceOn'] %}
        {% else %}
          {% set deviceOn = false %}
        {% endif %}
        
        {% if value_json is defined and value_json['systemMode'] is defined %}
          {% set systemMode = value_json['systemMode'] %}
        {% else %}
          {% set systemMode = 'off' %}
        {% endif %}
        
        {% if deviceOn == true %}
          {% if systemMode == 'cool' %}
            idle
          {% elif systemMode == 'heat' %}
            heating
          {% endif %}
        {% else %}
          off
        {% endif %}
      mode_command_topic: <your-id>/thermostat/set
      mode_command_template: >
        {% if value == 'auto' %}
          {{ {'deviceOn':true,'schedulesMode':'auto'} | to_json }}
        {% endif %}
  
        {% if value == 'heat' %}
          {{ {'deviceOn':true,'schedulesMode':'off'} | to_json }}
        {% endif %}
  
        {% if value == 'off' %}
          {{ {'deviceOn':false,'schedulesMode':'off'} | to_json }}
        {% endif %}
      modes:
        - "auto"
        - "heat"
        - "off"
      temperature_unit: C
      temp_step: 0.5
      min_temp: 5
      max_temp: 35
      initial: 20
      retain: true
      qos: 0

Aditionally, I made changes to my previous automations which are doing the “hammering” of the values, until the desired value is set, with a random delay:

You just need to create two input_text helpers which save the desired temperature and value.

alias: House - Climate Set
description: Save Target Temperature with Helper
trigger:
  - platform: event
    event_type: call_service
    event_data:
      domain: climate
      service: set_temperature
      service_data:
        entity_id: climate.living_thermostat
    id: set_temp
  - platform: event
    event_type: call_service
    event_data:
      domain: climate
      service: set_hvac_mode
      service_data:
        entity_id: climate.living_thermostat
    id: set_mode
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: set_temp
        sequence:
          - service: input_number.set_value
            target:
              entity_id: input_number.climate_target_temp
            data:
              value: "{{ trigger.event.data.service_data.temperature }}"
          - repeat:
              until:
                - condition: template
                  value_template: >-
                    {{ (states.input_number.climate_target_temp.state | int) ==
                    state_attr('climate.living_thermostat', 'temperature') }}
              sequence:
                - service: climate.set_temperature
                  data:
                    temperature: |
                      {{ trigger.event.data.service_data.temperature }}
                  target:
                    entity_id: climate.living_thermostat
                - delay:
                    seconds: "{{ range(8, 11)|random|int }}"
      - conditions:
          - condition: trigger
            id: set_mode
        sequence:
          - service: input_text.set_value
            target:
              entity_id: input_text.climate_mode
            data:
              value: "{{ trigger.event.data.service_data.hvac_mode }}"
          - repeat:
              until:
                - condition: template
                  value_template: |-
                    condition: template
                    value_template: >-
                      {{ states.input_text.climate_mode.state == states.climate.living_thermostat.state }}
              sequence:
                - delay:
                    seconds: "{{ range(8, 11)|random|int }}"
                - service: climate.set_hvac_mode
                  data:
                    hvac_mode: |
                      {{ trigger.event.data.service_data.hvac_mode }}
                  target:
                    entity_id: climate.living_thermostat
            enabled: true
    default: []
mode: restart

Just for clarification, I found the above automation somewhere on the forums, I just adapted it for my needs.

Let me know if you think if I should post a link of this discussion onto github.

1 Like

thanks for the tip for action_topic stuff. I’ll see how it helps. I’ll still hammer it manually for a while.

Have you found a way to set it under 10 degrees C?

I created myself these automations to “hammer” it for me, so I can use the thermostate also in automations, and not worry about not setting the setting I want to set.

And for the minimum temperature, unfortunately no, from the Aliexpress-Description it should be from 5-45, but maybe the firmware has also some limitations.

I believe going under 10° is just missing feature from some of the code. In the code it’s implemented to some, but unfortunately not to all variants. The tuya mcu seems to implement it.

Here is the explanation. Too bad it’s not implemented to all. ME81AH - choose internal/floor sensor · Issue #179 · klausahrenberg/WThermostatBeca · GitHub

Here is one device with implementation

Well, after reading the code a bit more, it only implements reading the minimum, not setting it. Anyhow, the devices would go lower from 10 to 5.

Hello.
I have some Avatto ME81H zigbee thermostat- devices.
But I dont know how to put them in pairing mode, so I can get them into the Smart Life app. Does anyone know?
If I get that for a start, then I can start to play with local tuya.

Hello There,
Do you know if this thermostat the cooling function when used with a air water source heat pump/floor heating? Not sure how the cooling feature works in a thermostat and if it will come by default. I dont find it explicitly written at the characteristics.

Hello, I’m wondering how in earth you succeeded to flash this device. I followed without success these instructions. Any hint would be much appreciated. Thanks

It was long ago, but I think I flashed the tasmota-minimal version first, as anything else was not working, and from there on, I was able to flash any other firmware via the web. Tasmota minimal is a lightweight firmware which is used only to be able to perform OTA updates afterwards.

Thank you. As a matter of fact, since ME81H features a WBR3 module, I understood that I had to replace it by an ESP12s module that has been flashed prior the soldering phase. Now I’m having a fully working Tasmota unit.

Hi GunThor,

Did you ever figure out how to pair them to ZIgbee? I’m still struggling…

Hi there,

i know this ist older Thread, but i want to share my experience with Avatto ME81H Thermostat to reflash ist to ESPHome for Homeassistant.
First: i had buy one Avatto ME81H Thermostat wirth Tuya Wifi Chip “WBR3”
grafik

This Chip cannot be reflashed to Tasmota or anything else…

Then i decided to resolder it to ESP12-F …before i did it…i flashed this to ESPHome with standard code in, because Tasmota was not reliable to me in some Resons and i needed more Conrol interface to this Thermostat. In Internet i searched how and which pins…it says in some Forums: 1:1 compatible…BUT!!! this ist was not compatible to my Board.
I Decided to solder only knowing pins: VCC,GND, TX,RX, EN and GPIO14.

GPIO14 is very important to tell tuyamcu-µC Wifi is ready and need to be NOT inverted!, Otherwise you cannot set the Target Temperature over Wifi, only Local.
Other Pins i isolated from PCB by lift the esp <1mm in air:
grafik
On board i soldered thin bridge between GND and GPIO15, i hope you can see it on the left corner.

Then my esp Working perfect with this Yaml in ESP-Home with HomeAssistant:

esphome:
  name: thermostat
  friendly_name: Thermostat

esp8266:
  board: d1_mini

logger:
  baud_rate: 0
# Enable Home Assistant API
api:
  encryption:
    key: ""

ota:
  password: ""

uart:
  rx_pin: GPIO3
  tx_pin: GPIO1
  baud_rate: 9600
  
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Thermostat Fallback Hotspot"
    password: ""
  manual_ip:
    static_ip: 192.168.171.125
    gateway: 192.168.171.1
    subnet: 255.255.255.0

time:
  - platform: sntp
    id: sntp_time
    timezone: Europe/Berlin
    servers:
     - 0.pool.ntp.org
     - 1.pool.ntp.org
     - 2.pool.ntp.org

tuya:
  id: tuyamcu
  time_id: sntp_time
  status_pin:
      number: 14
      inverted: false

captive_portal:

climate:
  - platform: tuya
    tuya_id: tuyamcu
    name: "Thermostat"
    #supports_heat: false
    switch_datapoint: 1
    active_state_datapoint: 36
    active_state_heating_value: 0
    target_temperature_datapoint: 16
    current_temperature_datapoint: 24
    current_temperature_multiplier: 0.1
    target_temperature_multiplier: 0.1
    visual:
      min_temperature: 10
      max_temperature: 40
      temperature_step:
        target_temperature: 0.5
        current_temperature: 0.5

switch:
  - platform: tuya
    name: "Sperre"
    switch_datapoint: 40
select:
  - platform: "tuya"
    name: "Auto/Manual"
    enum_datapoint: 2
    optimistic: true
    options:
      0: Auto
      1: Manual
  - platform: "tuya"
    name: "Display-Modus"
    enum_datapoint: 52
    optimistic: true
    options:
      0: 0%
      1: 25%
      2: 50%
      3: 100%
  - platform: "tuya"
    name: "Zeitmodus"
    enum_datapoint: 104
    optimistic: true
    options:
      0: Aus
      1: Mo-Fr
      2: Mo-Sa
      3: Mo-So
  - platform: "tuya"
    name: "Sensormodus"
    enum_datapoint: 43
    optimistic: true
    options:
      0: Intern
      1: Extern
      2: Int/Ext
#sensor:
  #- platform: "tuya"
    #name: "Externer Sensor"
    #sensor_datapoint: 101
    #unit_of_measurement: °C
    #icon: mdi:thermometer
    #filters:
      #- multiply: 0.1

And This i can see and Control in HA:

Only ESPHome version is: 2024.3.1 And DO NOT Update it NOW…Esphome have some problems with tuya climate instances in new versions. We need to wait some updates.
ps: sorry for my bad english…i hope you can now resolder this at your home like this and i hope i helped some of you.