The Things Network (TTN) - new adapter for v3

Hi Thomas, I have a Dragino Water Flow meter which does not appear in the devices configuration, do you have any advice?

Hi Paul,
I have the same device and also 5 other new Lora-devices from Dragino all sucessfullly registered and comunicating within an TTN APP. But the HA integration doesn´t show the devices in the configuration. I just opened a topic [No devices found in TTN (new version) v0.2.0 ¡ Issue #15 ¡ angelnu/home_assistant_thethingsnetwork ¡ GitHub] in Github.
Kind regards
Timo

Hi, ty for creating this adaptor. Having an issue seeing / displaying the proper sensor data.

im running HA with your new adaptor installed.
I have one lorawan sensor - a seeed sense cap 2105 and a 3rd party lorawan gateway.
everything connected to the things network

my 2105 seems to be sending only a portion of the 3 fields of data it can receive to TTN.
And the field received, is gibberish in HA.

Have you installed the payload decoder in TTN for your sensecap ?
Also I advise you to use the regular mqtt path instead of the TTN V3 connector as it’s not reliable and not supported anymore by its creator :frowning:

Thx for the reply.
I went to applications - payload formatters - use device repositories, if that’s what you are referring to?

And in terms of MQTT - if im using a few other sensors throughout my house that are connected via MQTT broker to HA, can i not add TTN as a second MQTT

If device is known by TTN you can do that but I advise to put the payload formatter supplied by manufacturer :wink: GitHub - Seeed-Solution/TTN-Payload-Decoder

Not sure to understand your questions. For TTN you create a MQTT bridge between MQTT server from TTN and your local one :wink: You can have a look at that thread where I explain how to do the setup: The Things Stack integration ? (on TTN V3)? - #41 by sp8 I use it here since more than a year for a bunch of Lora devices and it works perfect !

1 Like

the data is being formatted correctly in TTN. however not in HA. im running TTN from HACS.

this is what I see -

and second question - if I just go down the mqtt path -

and use the mqtt host for ttn - nam1.clpud.thethings.network

is there a way to keep the existing home mqtt devices I have running on my local HA at 192.168.X.XXX network?

Did you check options of integration:
Screenshot_20230512_184002
Then select Fields and setup them at best :wink:

yep it won’t interfere ! You use the standard included mqtt broker of HA add-ons ?

The issue is - HA sees the sensor data as a message - and is not parsing out the relevant values. In TTN, im using the device specific payload formatted.

So as u can see above - HA sees “messages” as a sensor. It would seems like HA should see the 3 or 4 values within the messages as the sensors.

It’s not HA but the integration and you can’t do anything about it that’s why I suggest you since few messages to use the MQTT way as you can then easily extract any data you need :wink:

Im trying MQTT - but im having a problem.

I configure the MQTT broker in HA with the host, and username/password - but nothing populates in devices, MQTT.
And i know the Ttn MQTT is working bc if i go to any program that receives MQTT feeds, it will work.

Nothing here is showing up as a device -
image

This is the set up w the proper credentials that receives data if i try to listen for it on other devices.

It’s absolutely not the way to do it ! Please look at link in my previous posts where I explain how to configure HA MQTT add-on to get it to communicate it with TTN :wink: You have to create a bridge configuration !

1 Like

I am not seeing your instructions on creating a bridge. where should I look? I looked at post #41 - but im not seeing instructions there

have a loot at my post there: The Things Stack integration ? (on TTN V3)? - #5 by vincen

so if I understand the sequence correctly

  1. go to add on’s - go to the mqtt broker app configuration -
    change the text to
logins: []
customize:
  active: true
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false
anonymous: false

from

then - add

connection nameitasyouwant
address eu1.cloud.thethings.network
bridge_protocol_version mqttv311
remote_username xxxxx@ttn (to get on device profile page in TTS console)
start_type automatic
notifications false
try_private false
remote_password NNSXS.XXXXXXX (named API keys in TTS console)
bridge_insecure true
topic # in 0
cleansession true

if this is correct - where do I put the above code? I dont see a folder named mosquito? where would I look - or does this get entered in an integration?

absolutely not needed, never indicated that in post linked above :wink:

it has to be put in a bridge.conf file that you’ll save in /share/mosquitto folder in HA :wink: If it’s properly done, when you restart the mqtt addon you’ll see in logs that it connects the bridge ! something similar to that:

[10:56:31] INFO: Starting mosquitto MQTT broker...
1684400191: Loading config file /share/mosquitto/bridge.conf
1684400191: Warning: Bridge dragino-ttn-bridge using insecure mode.
1684400191: Warning: Bridge boutons-inputs using insecure mode.
1684400191: Warning: Bridge tracker-tbeam-ttn-bridge using insecure mode.
1684400191: Warning: Bridge trackit-ttn-bridge using insecure mode.
2023-05-18 10:56:31: Warning: Mosquitto should not be run as root/administrator.
[10:56:32] INFO: Successfully send discovery information to Home Assistant.
[10:56:32] INFO: Successfully send service information to the Supervisor.

ahh, ok. starting to understand

in terms of the file location that im going to add - i can find 2 share directories. one is /share and is currently empty, and the other share directory is - usr/share/

do I put the /mosquitto/bridge.conf file in the first directory that is currently empty?

many thx for the help

I created bridge.conf in /share/mosquito

the bridge file is -

connection XXXXXlora
address nam1.cloud.thethings.network
bridge_protocol_version mqttv311
remote_username my-XXX-XXX@ttn (to get on device profile page in TTS console)
start_type automatic
notifications false
try_private false
remote_password NNSXS.00000000000000000000000UI.ABCDEFGHM53ZRLKTKEL5DAXPSVZ27IDIEM7YWJUAG3PHQ (named API keys in TTS console)
bridge_insecure true
topic # in 0
cleansession true

and now im seeing in the ttn log -

invalid authorization -

{
  "name": "as.mqtt.connect.fail",
  "time": "2023-05-18T12:12:09.714448981Z",
  "identifiers": [
    {
      "application_ids": {
        "application_id": "my-hamp-soil"
      }
    }
  ],
  "data": {
    "@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
    "namespace": "pkg/identityserver",
    "name": "invalid_authorization",
    "message_format": "invalid authorization",
    "correlation_id": "370a70acd0e1435e9d5f2b2364b32f8b",
    "code": 16
  },
  "origin": "ip-10-101-14-141.us-west-1.compute.internal",
  "context": {
    "tenant-id": "CgN0dG4="
  },
  "visibility": {
    "rights": [
      "RIGHT_APPLICATION_TRAFFIC_READ"
    ]
  },
  "unique_id": "01H0QCCN3JGQCEGD6TWGCANFAJ"

and in the mqtt add on log -

2023-05-18 08:13:18: Received CONNACK on connection local.core-mosquitto.hampttnlora.
2023-05-18 08:13:18: Connection Refused: not authorised
time="2023-05-18T08:13:48-04:00" level=debug msg="found in cache: XXXXX"
2023-05-18 08:13:18: Client local.core-mosquitto.hampttnlora closed its connection.

and in TTN - under applications - im setting up integrations - mqtt - to get the key that im using that seems to be saying invalid

ok, seem to be making progress…

had to turn the false to true in the mqtt config.

and now see in the mqtt logs -


[06:44:02] INFO: Starting mosquitto MQTT broker...
1684493042: Loading config file /share/mosquitto/bridge.conf
1684493042: Warning: Bridge hampttnlora using insecure mode.
2023-05-19 06:44:02: Warning: Mosquitto should not be run as root/administrator.
[06:44:03] INFO: Successfully send discovery information to Home Assistant.
[06:44:03] INFO: Successfully send service information to the Supervisor.

now the question is - where should the ttn data be visible? in the ttn integration or in the mqtt integration? I was thinking in the mqtt integration - and just log into the local mqtt broadcast - as I thought this would be bridged to show everything? unless im mis understanding.