How to integrate MDT Glas Room Temperature Controler operation_mode_state_address

There are a couple if discussions arounnd this topic but there is a specific issue that causes troupble sind MDT did not do a good job in directly forwarding a operation mode states object itself. Otherwise the visualization of the status will not be up to date. Luckily I had to self that already before switching to home assistant.
At least MDT forwards a non DPT compliant object:

The type is actually defined by some KNX extension.The first Nibble of the 1 Byte contains the information while the upper 2nd Nibble contains additional status information which we do not care. We can of course filter it but have to also send it back to knx so we can use it for our climate entity. So here is a simple procedure:

  1. Consider the propriataty “HVAC Status” as a 1 byte sensor in your knx.yaml
  - name: "hvac_status"
      state_address: "2/0/5"
      type: 1byte_unsigned
  1. Create a dummy group address in your ETS to maintain the required operation_mode_state_address object for homeassistant. ETS allows to add such dummy devices.

  2. Expose the address which you use for the entity attribute “operation_mode_state_address” of the respective climate entity in your knx.yaml expose

  - type: "1byte_unsigned"
    address: "2/0/6"
    entity_id: "sensor.hvac_mode_status"
  1. Translate the hvac_status sensor entity (of step 1) to the exposed attribute hvac_mode_status of step 3 in your configuration section with a template filtering values
  - platform: template
        value_template: >
          {{int(1) if is_state('sensor.hvac_status','33') else int(2) if is_state('sensor.hvac_status','34') else int(3) if is_state('sensor.hvac_status','36') else int(3)}}
  1. Assign the same group address of sensor.hvac_mode_status to the operation_mode_state_address attribute of your climate entity
- name: "Example Climate Entity"
  operation_mode_state_address: "2/0/6"

Of course let’s discuss if there are better ideas or improvements.

Hi :wave:!
This was a covered by a climate entities controller_status_address. However the heat/cool info is not implemented.

(See xknx/xknx/dpt/ at f027149af0483ad0d73e9e12157766e6b99da333 · XKNX/xknx · GitHub for implementation)

@farmio, That´s really great and exactly what I would need. So the exact integration of the problem. Thanks a lot for sharing, I will try to use that and refactor my integration.