KNX string sensor

Hi,

I’m trying to setup a MDT heating actuator (AKH-0800.03). All essentials work fine, but I would also like to integrate the diagnostics text the KNX device is capable of sending. It pretty much works, Home Assistant receives the value, but it does not seem to be considered a string. It’s displayed properly, but the history is shown as a graph (with no values), therefore I can’t see any past states of the text.

grafik

The KNX configuration:

knx:
  sensor:
    - name: knx_az_heating_diagnosis
      state_address: "4/2/9"
      type: string
      sync_state: expire 30

I would like to have it represented as any other text / string base sensor (e.g. sun) and by that have access to past states.

grafik

I know I could achieve it by setting up an additional template sensor, but that are a lot of templatesensores for all heating actuators…

Is there a better way?

Hi :wave:!

Maybe have a look at the Open your Home Assistant instance and show your logbook panel. for these state changes. They might show up there.

This is actually a little bit different than entities like sun - sun is a binary_sensor with a special device_class translating True and False to different things (like window “open” “closed” etc.). So there are only 2 possible states.
Unfortunately there is no sensor device_class for pure string sensors so the UI doesn’t seem to really support these.

Sadly, it is not in the logbook. The entity does not show up at all. But it does so in the history… with the known result.
The sun sensor is a bad example, as I now know. But I have other “string sensors”, for example the IP address or SSID of ESPHome devices. They are found in the logbook.

Is there a setting, customization or anything else, that can ‘force’ an entity in the logbook instead of the history?

Good question :thinking:
How does the IP sensor for example look in the history?

Has the diagnostic text changed once since you set it up? Maybe it needs a change before it is visible in logbook!?

The ESPHome text sensor looks like this in the logbook:

grafik

In the history it look like this:

grafik

And this is the ESPHome config, that generates the sensor:

text_sensor:
  - platform: version
    name: ${friendlyname} version

And the diagnostic text has changed multiple times already, unfortunately. Still the same.

Aha, interesting. Can you please also post the output of Open your Home Assistant instance and show your state developer tools. for this sensor? Maybe there is something I don’t know about. But I don’t have ESPHome or any other string entity here to check.

There we go. You found the problem:


The KNX integration generates the attribute “unit_of_measurement”, eventhough it is empty. But removing it by hand (temporarily) results in the desired outcome.

Now I have to figure out, why the KNX integration behaves like that. Or can I somehow remove a attribute in the customize section?

:+1:
It’s because the unit is read from the xknx library. You’d need to set it to None instead of "" there I guess.

Do you want to make the PR? There may be some test fixtures / type annotations that need adaption, but I guess it’s no big deal.

It can be tested by putting (symlinking) your local xknx fork to HAs config folder - it will load the local xknx then.

That did the trick. As far as I can tell, all related tests still pass, so no need for fixing.

I’ll file a PR. (Disclaimer: My first PR ever.)

:+1: great :smiley:

Don’t worry, CI will check the tests again.

Hello,
I have also MDT heating AKH-0800. I would be interesting to know how you configured in home assistant to get all info: set point, mode, current valve position, …

Hi :wave:!
Have a look at this thread: KNX Climate heating actuator MDT - #114 by Dennis1108