My goal is to get the temperature and humidity displayed in openhab, but I di not even get the whole String from RTL_433_test.
No Values appear in my Test.sitemap:
Frame label="Aussentemperatur" {
Text item=RTL_433_temperature
Text item=RTL_433_humidity
Text item=RTL_433_temperatureX
Text item=RTL_433_humidityX
Text item=RTL_433_test
}
If you’re not getting even the full/raw string into openHAB but are successfully reading it by connecting to the mosquitto broker via mosquitto_sub, my guess is your MQTT configuration is incorrect in openHAB. Check the contents of your mqtt.cfg file in your openhab-conf/services folder to make sure you have the correct broker.url configured (most likely tcp://localhost:1883 if you’re running the broker on the same host as openHAB).
Also, I’ve seen issues in my setup if I have both the MQTT binding, as well as the MQTT action installed. Uninstall both, then install only the binding, and see if you start getting MQTT strings then.
(is this an example entry or are you using this broker alias in your OH2?)
from what I remember, the broker alias does not accept dots due to the parameters structure of the mqtt.cfg file
try to use another alias (and post the contents of your mqtt.cfg to check them)
I changed the name in the mqtt.cfg (the only set Item)
# URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883
#<broker>.url=tcp://<host>:1883
LocalMQTTbroker.url=tcp://localhost:1883
And the broker name in in my Test.sitemap to “LocalMQTTbroker” and now they work"
Could you or someone how the “transformer” has to be?
In Item “RTL_433_temperatureX” it seem to work with “JSONPATH($.temperature_C):.*]” but I don’t know why. I took it out of the example I found, The Docs: https://www.openhab.org/addons/bindings/mqtt1/#item-configuration-for-inbound-messages brings not much clarity. Execpt, that i could use default, wich now works on the Item RTL_433_test (gives the whole string). so what can I use besides the JSONPATH?
The regex part of the MQTT incoming config is a message matching mechanism. When a message is published on that topic the binding will first check it to see if it matches the regular expression and if it does it passes it to the transformation and assigns the result to the state of the Item. If it doesn’t match then it ignores that message for that Item.
By using .* as the regular expression at the end you are essentially saying “match all messages”. Since that is the default behavior of the Binding, supplying the .* is redundant and unnecessary.
So while it isn’t wrong to include them, it is not necessary. It is not causing any problems.
Most things cleared up, ony the regex expressions are a bit confusing, as I have to double escape some characters unlike the normal regexes I knew. But in my case I need the regexes, because if i did not use them, the JSONPATH throws warnings in the openhab log.