Sorry but quite confused by your explanations… If you use an mqtt client on your phone you don’t connect it at mqtt broker of ha, but mqtt server of TTN/TTS for test Then using dragino documentation, find out how to properly format the Lora downlink message and once it works you can try to do the same from HA through its own MQTT server
I was able to get the bridge to the HA MQTT add-on to work fine. I’m using it now with Node-Red. Thanks for that!
Now I’m trying to get it to work directly through the configuration.yaml, bypassing Node-Red, but I only get state of sensor.temp_ds = ‘unknown’.
Here’s what I have in my config file:
- platform: mqtt
state_topic: "v3/mqtt-rpi3b@ttn/devices/eui-70b3d57ed004d338/up"
name: "Temp DS"
value_template: '{{ value_json.uplink_message.decoded_payload.degreesC }}'
unit_of_measurement: "°C"
But it doesn’t work. I’m pretty sure state_topic is right, because I find it on my MQTT client app connected to TTS MQTT server. Did you do anything else to get it to work?
Thanks for your help in gett HA mqtt working with TTN.
I use Rak edge lite as my gateway and whilst I can get it to work with TTN, I cannot get the gateway to connect to my Chirpstack server. Chirpstack does not allow me to connect the RAK gateway as it states the connection is refused when I try to add the gateway. I have tried all different ports/addresses but no luck.
How do you configure your rak gateway to support Chirpstack?
that is quite a different problem so would be better to start a new thread for that problem or even better in Rak Wireless forum https://forum.rakwireless.com
Did you try to use the chipstarck server included with RAK softwares to configure gateway ?
Sorry to dig up this old thread, but trying to figure out why I can’t get the ssl version of TTNv3 working, only port 1883 works.
connection bridge-nam1
address nam1.cloud.thethings.network:8883
bridge_protocol_version mqttv311
bridge_insecure true
start_type automatic
notifications false
try_private false
remote_username USER@ttn
remote_password SECRET
topic # in 0 /ttn/
cleansession true
I’ve tried changing the bridge_insecure to false, but not sure if that really matters as thought that was cert to name mapping anyways. Basically it connects, then drops after a bit with both the older 1.16 based Add on and the new 2.0 based one.
Is there a chance that the TTN v3 integration will happen on HA?
It would be great to update the integration to the latest TTNv3 version
it is doable, but using mqtt gives you a very fast updates in home assistant vs regularly fetching the latest values, which would probably delayed.
Have you tried mqtt based solution?
+1 to the mqtt solution. I initially tried the plugin, but switched to mqtt via the included HA addon. For those looking for how, it’s really easy:
File: share/mosquitto/mosquitto.conf
connection bridge-nam1-nodes
address nam1.cloud.thethings.network:8883
bridge_protocol_version mqttv311
bridge_capath /etc/ssl/certs
try_private false
bridge_insecure false
notifications false
remote_username <REPLACEUSERNAME>
remote_password <REPLACEPASSWORD>
topic # in 0 /ttn/
cleansession true
I did put their root ca into my config/certs directory, but not sure if necessary.
I am a beginner on HA, I am just getting to grip with things.
I have used TTNv2 and TTNv3 for a while now and I send data from various lorawan devices there to an IoT stack (influxDB/Grafana). Someone else help me set that one up.
I was impressed to see a TTNv2 integragration, hence I was very interested to check if TTNv3 might be fully integrated at some point. It would be great to easily connect HA to TTNv3.
I haven’t tried MQTT in HA yet, but I will try to find out more on how it could be done.
I am reading the instructions by @noebl1 but I am probably missing some of the necessary steps, as I cannot understand how to use the file and commands given.
If you need some help, @sp8 , feel free to dm me! I currently run the MQTT add on which isn’t too bad to set up. For it to work with TTN, you need to set up an MQTT bridge so you can watch your node(s) traffic. You can even have multiple bridges for multiple applications (which is what I do for testing).
I also send all my traffic to my TIG stack
same here, one bridge per application in TTNv3 and all good and it works perfect since a year when V3 was released
Can you share the speed of reaction?
@anon63427907 sorry for late answer but not really any real latency but I use it only for some weather sensors and I have a local TTN gateway but everything runs still through TTN servers for sure
Hey,
thanks for the introduction to the mqtt bridge. I can receive data. The only thing, I haven’t figured it is how to access the values correctly.
My live data format on TTN looks like following:
"received_at": "2023-03-08T09:50:48.979376486Z",
"uplink_message": {
"session_key_id": "AYbAlRIHL38aAluagjIbeA==",
"f_port": 1,
"f_cnt": 6,
"frm_payload": "V9QAowCgEyZBhw==",
"decoded_payload": {
"bytes": {
"decodingInfo": "values: [t=0, t-1, t-2, ...]",
"status": {
"configuration2ChannelsActivated": true,
"configurationDone": false,
"configurationInconsistency": false,
"frameCounter": 6,
"hardwareError": false,
"lowBattery": false,
"timestamp": true
},
"temperatures": [
{
"name": "temperature 1",
"unit": "°C",
"values": [
16.3
]
},
{
"name": "temperature 2",
"unit": "°C",
"values": [
16
]
}
],
"timestamp": "2023-03-08T10:50:47.000",
"type": "0x57 Temp 4 periodic data"
}
},
How can I access the both temperature values? The only thing I can access is f_port by using
value_template: "{{ value_json.uplink_message.f_port }}"
Anyone has an idea how to write the correct value_template?
I’ve solved it with the following value_template:
value_json.uplink_message.decoded_payload.bytes.temperatures[0]['values'][0]
I also added:
device_class: "temperature"
unit_of_measurement: '°C'
and now it’s working fine.
perfect you found out by yourself the good way and I can also add that now at least for sensors you don’t need anymore all the mqtt thing and the parsing, it exists a non official but working perfect so far integration for TTN V3: GitHub - angelnu/home_assistant_thethingsnetwork: TheThingsNetwork v3 integration for Home Assistant
Is that an HACS integration? I cannot find it over HACS if I search for “TTN”, “the things” or “adapter”. Do I need to add the repository first?
It needs to be added to the list of repositories for HACS, as it’s not included by default yet.
Any idea where I can find some payload formatter code to decrypt the messages on TTN? I have an Innotas heating counter but the payload doesnt decrypt with the standard formatter on the Thing Stack.