OpenMQTTGateway Autodiscovery with OpenHAB following Home Assistant convention

I have modified the code of OpenMQTTGateway to make it compatible with Autodiscovery:

I have done some tests but I would like to have some feedbacks if some OpenHAB users are interested on testing it?

This function rely on Home Assistant Autodiscovery topics.

1 Like

I have an esp32 with IR, BT, RF integrated flashed with 0.92beta. I am using openhab.
is it worthwhile to flash to 0.93?
The homeassistant convention messes up with my zigbee2mqtt connections in 0.92beta

sorry to say, but I have problems with openHAB 4

2023-08-03 18:35:36.034 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JINJA-transformation failed: An error occurred while transformation. UnknownTokenException: Unknown token found: value_json.rssi | is_defined

2023-08-03 18:35:36.037 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JINJA-transformation failed: An error occurred while transformation. Could not resolve function ‘float’

2023-08-03 18:35:36.039 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JINJA-transformation failed: An error occurred while transformation. UnknownTokenException: Unknown token found: value_json.humidity | is_defined

2023-08-03 18:35:36.041 [WARN ] [t.generic.ChannelStateTransformation] - Executing the JINJA-transformation failed: An error occurred while transformation. UnknownTokenException: Unknown token found: value_json.temperature_C | is_defined

if you need some more debug output let me know

peter

You need to send this command to have OMG use OpenHAB discovery:

I’ve got it running on a lilygo_rtl_433_ESP board using the rather new FSK modulation feature. It does detect my Jansite-Solar sensor successfully and sends the MQTT event message under this topic:

OMG/OMG_lilygo_rtl_433_ESP/RTL_433toMQTT/TPMS/Jansite-Solar/8a8e6a

and the payload is:

{"model":"Jansite-Solar","type":"TPMS","id":"8a8e6a","flags":57,"pressure_kPa":17.6,"temperature_C":20,"code":"8a8e6a394b0b080bb2","mic":"CRC","protocol":"Jansite TPMS Model Solar","rssi":-77,"duration":21320}

From this message I could create the corresponding thing in openHAB using the script “rtl_433_mqtt_hass.py” delivered with rtl_433 with the following command as I use it for my native instances of rtl_433:

python /usr/local/bin/rtl_433_mqtt_hass.py -H ds218plus -f -T devices[/model][/id][/channel] -d -r'

Now I am waiting for the payload of the device message in:

OMG/OMG_lilygo_rtl_433_ESP/devices/TPMS/Jansite-Solar/8a8e6a/temperature_C

but nothing appears.
I fear that I am on a wrong way, but what is the right one? How must the config messages be built for the thing channels to correspond to the OMG messages?

Regards
Christoph

We are not using this topic structure to publish the messages, this discovery script is made for RTL_433 original program not for OMG.

You can either define your sensor manually or wait for the integration of FSK devices.

OK, I remember that I did not use the script, when I tested the new ESP command “ohdiscovery” in April. That’s clear now. I tested again with the unmodified environment of lilygo-rtl_433 from gitpod.io. My supported sensor AmbientWeather-TX8300 was discovered, the OH thing was created automatically and is working correctly. OMG is sending the messages with the correct topic. Here are both config messages. Left is rtl_433 and right is from rtl_433_ESP included in OMG:

The FSK support is already included in the actual version 1.6.0 of OMG and I compiled the package using these compiler options, so that the modulation is switched to FSK:
grafik
Here I have some Jansite-Solar TPMS sensors for testing. They are working well as FSK modulated with the native rtl_433 software. When I change the pressure of my pressure test bottle, the data is recognized and decoded by OMG, but no OH thing gets created in my inbox. Here are both config messages from rtl_433 native (left panel) and from OMG (right panel) and I added the base message payload in the lower area of both panels:

From my point of view the state_topic is composed incorrectly. The first line in the right panel (red background colour) shows the topic that is used by OMG to send the messages from this sensor:

OMG/OMG_lilygo_rtl_433_ESP/RTL_433toMQTT/TPMS/Jansite-Solar/8a8e6a

But the state_topic (stat_t) is:

+/+/RTL_433toMQTT/Jansite-SolarSolar/8a8e6a

The fourth topic level TPMS, which is the sensor type is missing and the next level, which is the model, is created as Jansite-SolarSolar, while it should be only Jansite-Solar.

When I create the thing and its channels manually, the item data is shown as expected.

Regards Christoph