OpenMQTTGateway Autodiscovery with OpenHAB following Home Assistant convention

Today I uploaded lilygo-rtl_433 via Option 1 and got the newest version running. The version is now displayed on the display as “1.5.1”, while the former version showed “version_tag”. But this binary does not have the openHAB discovery activated. So I tried to compile the lilygo-rtl_433-oh environment from above with platformio/gitpod, but it throws an error:

/workspace/OpenMQTTGateway/main/ZgatewayRTL_433.ino:132:59: error: expected primary-expression before ')' token
           if (strcmp(parameters[i][0], "battery_ok") == 0)) {
                                                           ^

I tried to fix the code by removing the marked closed bracket on line 132 and the compilation succeeded. But unfortunately the resulting firmware binary did not run. Nothing was displayed and no WiFi AP was started.
What can I do now? Should I raise an issue on github?

Regards Christoph

I have launched a test build below:

It will be available in 1h30 from OpenMQTTGateway DEVELOPMENT SHA:9bbe90 TEST ONLY
lilygo-rtl_433-openhab

Note that the build will be overwritten tonight at midnight CEST

If it works we will see how to make this settings at runtime.

I waited for the build to finish and could upload the binary successfully. The version shows 775e81.
The configuration topic for my AmbientWeather sensor has now the val_tpl entry without “| is_defined” like expected:
grafik
So basically it looks fine, the value topics are correct and can be processed by openHAB.
I will look at the further processing and will also remove the Thing and wait for it to be recreated. I’ll keep you informed!

Thanks for your support!
Regards Christoph

1 Like

I face some issues with devices, that are not correctly recognized. I have a 433 Mhz based remote control, that is recognized by rtl_433 (native with a different SDR stick) as a Waveman-Switch device.
When I press some buttons with different channels selected, they are sometimes discovered by the OMG HA autodiscovery correctly and other times discovered als a Akhan-100F14 when I press a ON switch. Pressing the OFF switch, the device is discovered as a Smoke-GS558 device, but from time to time a config topic appears correctly for a Waveman-Switch.
See some samples below:


I have the test build from above. What is the right place to post such kind of issues regarding the rtl_433 integration?

Regards Christoph

Any news on this I have kind of the same issue.
OH found the sensor but I got a “UNKNOWN” status.

Using th standard OpenMQTT firmware.

Thank you in advance,

Evert

Let me see if I can add a parameter at runtime to remove HA specificity regarding discovery

Your best chance is into OpenMQTTGateway forum

Yea already look around and I found you there as well :slight_smile:

But I think I found where it is going wrong, it is the /+/+ in the Topic path.
Bellow the explanation and I hope some one can fix this as it took me 8 hours to figure this out…

I got a lilygo_rtl_443_ESP.

Discovery is working as I can find my temp sensor however as soon as I add it it is going to a “UNKNOWN” state. (Using Openhab3).

The lilygo itself is working but if I look at the configuration (MQTT Explorer)
“stat_t”:"MQTT01/OpenMQTTGateway_lilygo_rtl_433_ESP/SYStoMQTT

{"stat_t":"MQTT01/OpenMQTTGateway_lilygo_rtl_433_ESP/SYStoMQTT","avty_t":"MQTT01/OpenMQTTGateway_lilygo_rtl_433_ESP/LWT","name":"SYS: Auto discovery","uniq_id":"0C8B95A5CC54-discovery","retain":true,"val_tpl":"{{ value_json.discovery }}","pl_on":"{\"discovery\":true}","pl_off":"{\"discovery\":false}","pl_avail":"online","pl_not_avail":"offline","stat_on":true,"stat_off":false,"cmd_t":"MQTT01/OpenMQTTGateway_lilygo_rtl_433_ESP/commands/MQTTtoSYS/config","device":{"identifiers":["0C8B95A5CC54"],"name":"OpenMQTTGateway_lilygo_rtl_433_ESP","model":"[\"LilyGo_SSD1306\",\"rtl_433\"]","manufacturer":"OMG_community","sw_version":"v1.5.1"}}

Temp sensor:
stat_t":"+/+/RTL_433toMQTT/Nexus-TH/2/1

{"stat_t":"+/+/RTL_433toMQTT/Nexus-TH/2/1","dev_cla":"temperature","unit_of_meas":"°C","name":"temperature","uniq_id":"Nexus-TH-2-1-temperature_C","val_tpl":"{{ value_json.temperature_C | is_defined }}","state_class":"measurement","device":{"identifiers":["Nexus-TH-2-1"],"connections":[["mac","Nexus-TH-2-1"]],"model":"Nexus-TH","name":"Nexus-TH-2-1","via_device":"OpenMQTTGateway_lilygo_rtl_433_ESP"}}

Code that is working for me: (Just add a generic node and configure the channels.)

UID: mqtt:topic:88dabb9100
label: MQ_443_Garden01
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:b6a54d9f0e
location: Garden
channels:
  - id: Battery
    channelTypeUID: mqtt:number
    label: Battery
    description: null
    configuration:
      stateTopic: MQTT01/OpenMQTTGateway_lilygo_rtl_433_ESP/RTL_433toMQTT/Nexus-TH/2/1
      transformationPattern: JSONPATH:$.battery_ok
  - id: Temperature
    channelTypeUID: mqtt:number
    label: Temperature
    description: null
    configuration:
      stateTopic: MQTT01/OpenMQTTGateway_lilygo_rtl_433_ESP/RTL_433toMQTT/Nexus-TH/2/1
      transformationPattern: JSONPATH:$.temperature_C
  - id: Humidity
    channelTypeUID: mqtt:number
    label: Humidity
    description: null
    configuration:
      stateTopic: MQTT01/OpenMQTTGateway_lilygo_rtl_433_ESP/RTL_433toMQTT/Nexus-TH/2/1
      transformationPattern: JSONPATH:$.humidity

Just let me know if you need more information!

The issue comes from the fact that OH does not support this keyword so we need to remove it at runtime. This would avoid having separate environments to maintain between OH and HA

Thank you for your time.
Can you share the files that are already modified so I can flash them and test it?

Thank you in advance!

You need to add this macro to your environment,

this way the program will be built with OpenHAB supported discovery

Pull request done if you want to test it:

Is anyone available to test this before I merge it ?

I saw this item just now and will try to test. But I think I can only do it during the over next week.

It has been merged, so you can test it from OpenMQTTGateway DEVELOPMENT SHA:15416e TEST ONLY

I just got managed to test ist. These are the results:
New version 15416e:
grafik
Keyword is_defined is back:
grafik
ohdiscovery was false and is then set by to true via system command:
grafik
In the new config message, the parameter is_defined is no longer present:
grafik
In the new config message, the parameter is_defined is gone again:
grafik
From my perspective the new command is working as expected.

Regards Christoph

Thanks for the feedback!

New version released:

With the integration of OpenHAB HA autodiscovery convention setting at runtime

1 Like

i am trying the new version of openmqqt and i am trying to enable the ohdiscovery with this command
mosquitto_pub -t “home/OpenMQTTGateway/commands/MQTTtoSYS/config” -m ‘{“ohdiscovery”:true}’
but for some reason a get an error, the target machine refuse to connect.have to do with my mosquitto.
can i do this with the mqqt explorer?? if yes can someone point me in the correct topic and payload.
Thanks
Nikos

Hello,

I think you are missing the host/username/password on your command.
Yes you can also do it with mqtt explorer.
The publish button and entry field is on the bottom right.