AVATTO ME81H Thermostat

Hello, I would like to ask a question about this thermostat if anybody got it working with a different firmware than the official tuya one…

I have tried to flash tasmota on it using this template afterwards but I was not able to read any temperature or other settings via mqtt, and the “relay” was turning only the display on/off

I have also tried to install
GitHub - klausahrenberg/WThermostatBeca: Replaces original Tuya firmware on Beca thermostat with ESP8266 wifi module (which delivers me some data over mqtt like temperature or targettemperature but does not update when changing manually)
and
GitHub - fashberg/WThermostatBeca: Open Source firmware replacement for Tuya Wifi Thermostate from Beca and Moes with Home Assistant Autodiscovery (which I know is not officialy supported, just wanted to test it, where home-assistant discovery worked flawlessly but data was not correct (received “null” values) )

I´m just asking this if somebody else got it somehow working with a non-tuya firmware before I flash the “original” firmware back to test it with local-tuya or the official tuya integration.

And also when somebody tells me that through local-tuya or official tuya is working without issues, I will flash it right away, I just don´t want to solder wires again to flash it back to tasmota…

Thanks very much!

1 Like

I just ordered one and was planning to use tasmota or WThermostatBeca. It seems that local-tuya does not have climate control support yet ( * Climates (soon)). In the meantime, while waiting to be implemented, I hope cloud tuya will work.

hy guys, any news on this … ?

Hi @BogdanV
yes, I managed to get it working, I flashed this Firmware:

This is my climate config for the above firmware.

climate:
  - platform: mqtt
    name: Living Thermostat
    power_command_topic: "<your-device-topic>/thermostat/set/deviceOn"
    temperature_command_topic: "<your-device-topic>/thermostat/set/targetTemperature"
    temperature_state_topic: "<your-device-topic>/thermostat/properties/targetTemperature"
    temperature_state_template: "{{ value_json['targetTemperature'] | round(1) }}"
    current_temperature_topic: "<your-device-topic>/thermostat/properties/temperature"
    action_topic: "<your-device-topic>/thermostat/properties/systemMode"
    action_template: >
      {% if value_json == 'heat' %}
      heating
      {% elif value_json == 'cool' %}
      cooling
      {% endif %}
    mode_command_topic: "<your-device-topic>/thermostat/set/schedulesMode"
    mode_command_template: >
      {% set values = { 'auto':'auto', 'heat':'off'} %}
      {{ values[value] }}
    mode_state_topic: "<your-device-topic>/thermostat/properties/schedulesMode"
    mode_state_template: >
      {% if states('sensor.thermostat_deviceon') != "True" %}
      off
      {% elif value_json == 'auto' %}
      auto
      {% else %}
      heat
      {% endif %}
    modes:
      - "auto"
      - "heat"
      - "off"
    payload_on: "true"
    payload_off: "false"
    min_temp: 5
    max_temp: 35
    temp_step: 1
    precision: 0.5
    retain: true

Just FYI: sensor.thermostat_deviceon is an mqtt sensor which gets the value of “/thermostat/properties/deviceOn

However this version has a bug that “manually” setting the temperature through HA does not work all the time, but it can be solved with some scripts and automations.

Script to use in Automations to set the Target Temperature:
(it checks if in auto mode, if yes, first runs “set manual mode” script and afterwards the temp)

alias: "Thermostate - Set 19 °C" 
sequence:
  - choose:
      - conditions:
          - condition: state
            entity_id: sensor.thermostat_schedulesmode
            state: auto
        sequence:
          - service: script.thermostate_set_manual_mode
          - repeat:
              until:
                - condition: state
                  entity_id: sensor.thermostat_target_temp
                  state: '19.0'
              sequence:
                - service: mqtt.publish
                  data:
                    topic: thermostat_15633253/thermostat/set/targetTemperature
                    payload: '19.0'
                - delay:
                    seconds: '{{ range(8, 11)|random|int }}'
      - conditions:
          - condition: state
            entity_id: sensor.thermostat_schedulesmode
            state: 'off'
        sequence:
          - repeat:
              until:
                - condition: state
                  entity_id: sensor.thermostat_target_temp
                  state: '19.0'
              sequence:
                - service: mqtt.publish
                  data:
                    topic: thermostat_15633253/thermostat/set/targetTemperature
                    payload: '19.0'
                - delay:
                    seconds: '{{ range(8, 11)|random|int }}'
    default: []
mode: single

This is a Script for setting Manual Mode (you can create the same for “auto/schedules” mode)

alias: Thermostate - Set Manual Mode
sequence:
  - repeat:
      until:
        - condition: state
          entity_id: sensor.thermostat_schedulesmode
          state: 'off'
      sequence:
        - service: mqtt.publish
          data:
            topic: thermostat_15633253/thermostat/set/schedulesMode
            payload: 'off'
        - delay:
            seconds: '{{ range(8, 11)|random|int }}'
mode: single

There is also a discussion about the set-command not working all the time here: ME81H set command sometimes doesn't work · Issue #239 · klausahrenberg/WThermostatBeca · GitHub

I also tested to flash the firmware mentioned in the above discussion, but did not manage to get it working until now, as the climate configuration for HA needs to be adjusted first. (but manually setting the targetTemp over mqtt works in the “new beta” version fine while testing)

Hope this helps.

3 Likes

Hi

I’ve been fighting with this now for few days and I’m getting out of ideas what to try next.

I have flashed ThermostatBecaWifi1.25beta GitHub - klausahrenberg/WThermostatBeca: Replaces original Tuya firmware on Beca thermostat with ESP8266 wifi module for my thermostat and I can see mqtt broadcast coming from thermostat into home assistant showing correct values.

So far so good. But then I copied your example configuration to my configuration.yaml and used my own device topic and after that added thermostat card in my HA, linked this configuration into it but it’s not showing any temperature values or any state info.

It seems that the thermistor card doesn’t receive any ”properties” values.

”Set” is working quite good. I can turn thermostat off and on and change the target temperature.

Any ideas anyone?

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.