I am trying to connect OpenHab with TTN throug the MQTT binding to visualyze the data but i am not able to do it.
According to the OpenHab documentation, the first step is create the MQTT broker but it remains always Offline.
I have configured the binding to eu.thethings.network adding my app_id and access_key.
That part seems ok because if (only for test) i write a bad password on purpose i receive an error message. So app_id and password are OK.
It is a bit strange, because the configuration for the broker only needs those 3 fields.
Reviewing the logs you can see the following:
2020-04-19 18:30:56.719 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to ‘eu.thethings.network’ with clientid miguel635_prueba
2020-04-19 18:30:57.027 [WARN ] [.transport.mqtt.MqttBrokerConnection] - Failed subscribing to topic homeassistant/#
It seems that the second message is the cause but i dont know why. I have asked in the openhab community forum and probably the root cause is that TTN is rejecting the connection for some reason.
Have anyone connected OpenHab with TTN?
Does anyone know the reason for that message?
Thank you in advance.
There is no such topic on TTN. Check the mqtt quickstart documentation (In the examples after the -t command line switch) or the mqtt api documentation for the topic format used by TTN.
Hello kersing, jfmateos,
Thank you for your answer.
I have compared your configuration with mine and seems OK.
Is it neccessary activate anything in TTN applicattion?
I dont understand why the broker is looking for a topic called “homeassistant” since i have not configured anything with that name.
Thank you for your help.
Are you sure temperature is the name of the field? Take into account that TTN usually uses a raw payload, and will only decode it as payload fields if you select a payload format. For example, i use Cayenne LPP
With this payload format, a typical packet will decode this way
I am using a custom payload as follows:
And this is how is decoding the payload
I am going to test with CayennLPP to check if that can be the problem.
Your sending sensor packets every 15 seconds ?
Ok I see the problem, you have written payloads_fields, but it should be payload_fields
I have fix the error in the payload but the broker is still Offline:
Please compare yours
You are right, sorry.
But still Offline.
One doubt, Apart from that, Shouldn’t the broker be online even when the JsonPath was wrong?
Yes, the MQTT broker should be online
Miguel, would you mind to allow me (jfmateos) as collaborator of your miguel635_prueba application (through the Settings tab) to check it
I have just configured your user in my openHAB installation and the broker is online.
Please check the full configuration carefully; if everything is OK, I would bet for a problem with the firewall or other network issue
I have also configured your sensor and it is working properly
Please remember that openhab must be rebooted after any modification related to MQTT
According to your recomendation, i am going to reinstall everything, test with other pc or other network to determine where is the problem.
I will let it know what is the issue.
I really appreciate your help
Thanks Miguel, take into account that my installation is OpenHAB 2.4 (not 2.5)
I’ve already removed myself as collaborator of your application
Do you keep the TTN fair access policy in mind with you sensors? On average 30 seconds of airtime each day for a sensor means you can send small amounts of data about every 5 minutes using SF7, more often means your usage is in excess of the fair access policy.