FHEM FHT80b CUL integration via MQTT

Hi All,

I have spent countless hours making quite legacy, still perfectly working FHT80b thermostats managed by FHEM via CUL device to talk to Home Assistant correctly and finally achieved almost all functionality. Now would like to share my config so others can benefit.

The solution provides:

  • fully working climate device with current action (heating/idle) and state (auto/heat)
  • battery state
  • valve state

The states are converted:

  • current action: The system reads heating/idle depending on valve position. When valve is opened more than 10% (my FHT8W boiler controller is set to 10% threshold) - you can adjust it by changing value in action template: "{% if value[:-1] > '10' %} heating {% else %} idle {% endif %}"
  • mode: auto in HA means auto on FHT80b, heating in HA means manual in FHEM

First of all, create new MQTT HVAC and MQTT Sensor devices. I have moved the config to a file climate_mqtt.yaml and sensor_mqtt.yaml. For this, in the configuration.yaml I have added:

mqtt:
  climate: !include climate_mqtt.yaml
  sensor: !include sensor_mqtt.yaml

climate_mqtt.yaml:

- name: "Thermostat Playroom"
  device:
    hw_version: "3.1"
    manufacturer: "eQ-3"
    model: "FHT80b"
    identifiers: "4242"
    name: "FHT80b Playroom"
  unique_id: "thermostat_playroom"
  modes:
    - auto
    - heat
  mode_command_topic: "fhem/Termostat_Playroom/setmode"
  mode_command_template: >-
    {% set values = {'auto':'auto','heat':'manual'} %}
    {{ values[value] if value in values.keys() else 'auto' }}
  mode_state_topic: "fhem/Thermostat_Playroom/mode"
  mode_state_template: " {{ 'heat' if value == 'manual' else 'auto' }}"
  current_temperature_topic: "fhem/Thermostat_Playroom/measured-temp"
  temperature_command_topic: "fhem/Thermostat_Playroom/settemp"
  temperature_state_topic: "fhem/Thermostat_Playroom/desired-temp"
  action_topic: "fhem/Thermostat_Playroom/actuator"
  action_template: "{% if value[:-1] > '10' %} heating {% else %} idle {% endif %}"
  initial: 21.5
  min_temp: 10
  max_temp: 28
  precision: 0.5

sensor_mqtt.yaml:

- state_topic: "fhem/Thermostat_Playroom/actuator"
  name: "FHEM Playroom radiator"
  unit_of_measurement: "%"
  value_template: "{{ value[:-1] }}"
  unique_id: "a4242"
  device:
    hw_version: "3.1"
    manufacturer: "eQ-3"
    model: "FHT80b"
    identifiers: "4242"
    name: "FHT80b Playroom"
- state_topic: "fhem/Thermostat_Playroom/batteryState"
  name: "FHEM Playroom battery"
  unique_id: "b4242"
  device:
    hw_version: "3.1"
    manufacturer: "eQ-3"
    model: "FHT80b"
    identifiers: "4242"
    name: "FHT80b Playroom"

The above will create a device in Home Assistant listening to relevant mqtt messages with topic starting with fhem/Termostat_Playroom/ and also attach additional entities (valve opening angle as well as battery state).
Most of the parameters in the device: are optional (check documentation), I just think it looks nice having this in HA. As an identifier I used the house code of FHT80b. It is important, that parameters must be the same for all sensors and climate, otherwise they won’t be linked. Check the MQTT HVAC documentation for optional attributes.

To make this working with FHEM, you need to have MQTT2_CLIENT configured to connect to your broker (usually Mosquito in HA) and MQTT_GENERIC_BRIDGE with following attributes:

  • globalDefaults: sub:qos=2 pub:qos=0 retain=1 base={"fhem/$device"}
  • globalPublish: *:topic={"fhem/$device/$reading"}

You should also filter, which devices will publish/subscribe via this bridge. In my case, I have defined room=HASS which means all devices in the room HASS will use this bridge.

For each FHT80b thermostat, you need to define couple of attributes:

  • room: HASS (you can use additional rooms if you wish)
  • mqttSubscribe: desired-temp:set-topic={"$base/settemp"} mode:set-topic={"$base/setmode"}
  • userattr: mqttAlias:textField-long mqttDefaults:textField-long mqttDisable:both,incoming,outgoing mqttForward:all,none mqttPublish:textField-long mqttSubscribe:textField-long (I’m actually not sure if this was not set automatically - please experiment and provide feedback)

Please mind, that FHT are lazy devices and most changes are taking long to be processed (2+ minutes). When changing temperature or state on either FHT80b or HA, allow this time to update the other side. When changing in HA, you will normally see, that the state will instantly revert. It will change only once FHT80b acknowledge the new setting and mqtt message is received accordingly

Next goal is to add boost (mode holiday_short). I will keep this updated when I achieve this.

This is my first guide so please let me know if anything is unclear and I will try to help.

Cheers
Jacek