Mqtt homeassistant thing detected no channel

Hi Everyone,
first time openhab user here, excuse me if i’m asking/missing a silly thing.
I did look around on the forum but didn’t find an answer to my question.

setup: OH3 running in docker, mosquitto bridge set up - works fine.

I’m experimenting with homeassistant mqtt autodetect.

I manually post the HA sensor example to the autodiscovery topic on my mqtt broker:
topic homeassistant/sensor/sensorBedroomT/config
message {"device_class": "temperature", "name": "Temperature", "state_topic": "homeassistant/sensor/sensorBedroom/state", "unit_of_measurement": "°C", "value_template": "{{ value_json.temperature}}" }
and
topic homeassistant/sensor/sensorBedroomH/config
message {"device_class": "humidity", "name": "Humidity", "state_topic": "homeassistant/sensor/sensorBedroom/state", "unit_of_measurement": "%", "value_template": "{{ value_json.humidity}}" }

as expected this results in two devices popping up in my inbox:
screenshot removed

then I add both as things.

then I post a measurement to the state topic (as per the HA example)
topic homeassistant/sensor/sensorBedroom/state
message { "temperature": 23.20, "humidity": 43.70 }

at this stage I was expecting the values to show up automagically in OH3,
as individual channels under the thing(s). But the channels remain unpopulated.
screenshot removed

What am I missing? How to get values populated automatically in the channels?
(or ideally as multiple channels under the ‘one thing’ , but baby steps first :wink: )

thanks, and my apologies for the long post.
(i had to remove most of the screenshots - as i’m a new member - hope it still makes senses)

Hello @undef

I have not had good luck with the homeassistant auto discovery, for some things the discovery seems to make some channels that make sense, for others barely anything that makes sense.
I am using it together with Zigbee2mqtt so i thought it might have been on that end the problem resides, this however indicates something else

@joriskofman

Hi Joris,
Yes, there seems to be something odd with the homeassistant discovery:

the encoding/decoding seems broken. _ gets encoded as _5F , messing up the channels (i think)

and even the HA/JINJA encoding seems off:
Transformation service JINJA for pattern {{value_json.temperature}} not found!
which AFAIK, looks correct.

This actually means that you don’t have the JINJA Transformation Service installed. I think it’s required for all this to work!

Yes, got to Settings -> AddOns -> Transformation and add JSONPath- an JINJA-Transformations

image

You can have a look at my Tasmota with Homeassistant-Autodiscovery Tutorial

Looks like a perfect fit for your tests.

I am using zigbee2mqtt with homeassistant-autodiscovery, too. And it is working perfect.
As stated before you need both Transformations, JSONPath and JINJA to get the results you are looking for.

@Christian_Brosius I also don’t quite think I was saying that it did not work, I stated that I did not get the results that I was looking for.
For me if I have to specify both JSONPath and JINJA transformations to get the information that I need out of a channel it would be much easier to just specify the channel directly on a attribute topic instead, then I don’t need to do any transformations

Great! adding those two addons made the channel show up.

There wasn’t any mention of this in the documentation, and I was expecting dependencies like this to be handled by OH. Anyway I created a PR for the docs adding a short note. (but now github is complaining about something sign-off :-/ … ah well, get OH3 up first) .

anyway, thanks for the help.

Still, any idea why OH3 is garbling _ as _5F?
(5F a straight ASCII hex encoding of _ so it smells like a bug to me, but maybe i’m still missing something in the config.)