HomeAssistant.md 2.9 KB

Home Assistant Integration

This Thermostat can be integrated in Home Assistant so that it can be controlled from there. This is done using MQTT.

Currently it can only be integrated using manual YAML file based configuration.

MQTT-HVAC integration (former 'Climate')

Using the MQTT-HVAC integration all basic things can now be controlled:

  • set temperature
  • mode (off or heat = on and off)
  • presets

    mqtt:
    climate:
    - name: Test-Thermostat
      unique_id: TestThermo1
      # current room temperature from sensor
      current_temperature_topic: Test/WTherm/stat/temp
          
      # using topic /currSetTemp - reduction temperatures are shown in Home Assistant (but cannot be changed)
      # using topic /setTemp - reduction temperatures are NOT shown in Home Assistant
      temperature_state_topic: Test/WTherm/stat/currSetTemp
        
      # topic to control set temperature (only for "normal" preset, not reduction presets)
      temperature_command_topic: Test/WTherm/cmd/setTemp
    
      # control only possible if device is online
      availability_topic: Test/WTherm/availability
      payload_available: "online"
      payload_not_available: "offline"
          
      # MQTT related settings
      qos: 2
      retain: false
    
      # thermostat related settings
      precision: 0.5
      temp_step: 0.5
      initial: 20.0
      min_temp: 16.0
      max_temp: 24.0
        
      # Presets
      # Stat topic /presetHA sends "norm", "red1" or "red2".
      # Command Topic setPreset understands these short names as well as numbers or the long names, 
      # so it can be used here.
      # Translation between short names and long (localized) names shown in Home Assistant is
      # done using the templates below.
      preset_mode_command_topic: Test/WTherm/cmd/setPreset
      preset_mode_state_topic: Test/WTherm/stat/presetHA
      preset_modes:
        - Normal
        - Reduction 1
        - Reduction 2
      preset_mode_value_template: >
        {% if value == "norm" -%}Normal
        {% elif value == "red1" -%}Reduction 1
        {% elif value == "red2" -%}Reduction 2
        {%- endif %}
      preset_mode_command_template: >
        {% if value == "Normal" -%}norm
        {% elif value == "Reduction 1" -%}red1
        {% elif value == "Reduction 2" -%}red2
        {%- endif %}
    
      # Mode
      # This is in reality only "on" or "off", but as it is implemented like this in 
      # Home Assistant, we can switch the "mode" to either "off" or "heat" now. 
      # Stat topic /modeHA sends "off" or "heat", command topic /setMode understands these as well.
      # As both "off" and "heat" are predefined in Home Assistant integration 
      # (and shown with nice localized names in the UI) we don´t need templates here. 
      mode_command_topic: "Test/WTherm/cmd/setMode"
      mode_state_topic: "Test/WTherm/stat/modeHA"
      modes: ["off", "heat"]