klausahrenberg / WThermostatBeca

Replaces original Tuya firmware on Beca thermostat with ESP8266 wifi module
397 stars 97 forks source link

BHT-6000 Discovery Homeassistant #275

Open beppexx80 opened 2 years ago

beppexx80 commented 2 years ago

Hi all, I put firmware 1.25 and configured mqtt on a BHT-6000, but Homeassistant does not auto-configure the thermostat for me. Where am I wrong? I see the MQTT messages from the thermostat go by. Thank you

Rainerlan commented 1 year ago

Hi, although I use the fork from AlbertWeterings, the same should be correct: HA auto config is not foreseen in this FW. You need to

  1. have to have an MQTT broker (I use mosquitto) installed - and
  2. have to define the decive in configuration.yaml like this (of course the device topic, name, etc. has to be updated):
  climate:
    - name: KuecheThermostat
      modes:
        - "auto"
        - "heat"
        - "off"
      mode_command_topic: "thermostat_5321625/thermostat/set/schedulesMode"
      mode_command_template: '{{ value |  replace("heat","off") }}'
      mode_state_topic: "thermostat_5321625/thermostat/properties"
      mode_state_template: >-
        {% if (value_json.schedulesMode == "off") and (value_json.deviceOn == true) %}
          heat
        {% elif (value_json.schedulesMode == "auto") and (value_json.deviceOn == true) %}
          auto
        {% elif (value_json.deviceOn == false) %}
          off
        {% endif %}
      temperature_command_topic: "thermostat_5321625/thermostat/set/TargetTemperature"
      temperature_state_topic: "thermostat_5321625/thermostat/properties"
      temperature_state_template: "{{ value_json.TargetTemperature }}"
      current_temperature_topic: "thermostat_5321625/thermostat/properties"
      current_temperature_template: "{{ value_json.Temperature }}"
      availability_topic: "thermostat_5321625/thermostat/properties"
      availability_template: "{{ value_json.alive }}"
      payload_available: true
      payload_not_available: false
      power_command_topic: "thermostat_5321625/thermostat/set/deviceOn"
      payload_on: true
      payload_off: false
      unique_id: thermo5321625
      min_temp: 12
      max_temp: 35
      temp_step: 1

Also I have defined a switch for a "lock switch" (so that in HA you can add a switch to toggle between locked/unlocked):

  switch:
    - command_topic: "thermostat_5321625/thermostat/set/locked"
      name: KuecheThermostat_freezeMode
      state_topic: "thermostat_5321625/thermostat/properties"
      value_template: "{{ value_json.locked }}"
      payload_off: false
      payload_on: true
      availability:
        topic: "thermostat_5321625/thermostat/properties"
        payload_available: "true"
        payload_not_available: "false"
        value_template: >-
          {% if ((value_json.alive == true) and (value_json.deviceOn == true)) %}
            true
          {% else %}
            false
          {% endif %}
Rainerlan commented 1 year ago

One additional comment: If you want auto discovery in HA, you may want to flash the FW from fashberg, i.e. WThermostatBeca. Not sure though if OTA from klausahrenberg or AlbertWeterings to fashberg will work...