The Things Network Integration Config (Australia Meshed Node)

Hi,

Trying to setup the TTN integration but it seems the integration has hardcoded the URL for the API which doesn’t work for the Australian Meshed node.

The code shows:

TTN_DATA_STORAGE_URL = (
    "https://{app_id}.data.thethingsnetwork.org/{endpoint}/{device_id}"
)

but I believe for Australia it should be(there is no appid at the start)

TTN_DATA_STORAGE_URL = (
    "https://data.thethings.meshed.com.au/{app_id}/{endpoint}/{device_id}"
)

Is there an easy way to modify the file in question that is part of the integration? I understand if I have to patch it every time I apply an update.

Thanks,
Ryan

Worked this out by copying it as a custom component and making the changes to the code. Works ok to talk to TTN but seems that the payload is different to what the plugin is expecting due to the DecodeDataObj in the payload field.

So off to try and bridge it with MQTT instead of TTN.

As a side question, anyone have any clue how to get the data in when the output from TTN via the API is this:

[
  {
    "DecodeDataHex": "0802016b076871067327cc0267010204020220",
    "DecodeDataObj": "map[battery:3.63V environment:map[gasResistance:5.44KΩ humidity:56.5% RH temperature:25.80°C barometer:1018.80hPa]]",
    "device_id": "insideair01",
    "raw": "CAIBawdocQZzJ8wCZwECBAICIA==",
    "time": "2020-12-30T05:34:12.770444682Z"
  },
]

The TTN sensor in HA doesnt seem to want to read the DecodeDataObj.

Does the decoder in TTN need modifying to output the data differently?

Hi Ryan,

Did you ever get the integration with TTN Australia working?
I have two applications on the AU meshed server and struggling to get the data into HA.

ps I got to the same point as you (edited the config but the payload isnt correct)

  • Ben

Hey Ben,

No Joy with it, even changed the decoder to simplify the payload, could never pick it up properly.

I ended up giving up and using Node Red instead, which works really well to subscribe to the TTN Meshed MQTT and then I split the payload into separate topics on my MQTT broker and use HA to listen to the topics.

It works well so far and pretty reliably for another Lorawan node I have(RAK7204).

One thing that happens is that the Lora nodes either stop sending data or the gateway stops sending data, so I’m trying to implement a watchdog which is only partially succesful using other code from here.

Which is this code(its here on the forum but I can’t find the source right now)

  - platform: time_date
    display_options:
    - "date_time"
  - platform: template
    sensors:
      inside_sensor_age:
        friendly_name: "Inside Sensor Age"
        entity_id: sensor.date_time
        value_template: >-
          {% if states.sensor.inside_air_sensor_temperature.last_changed > states.sensor.inside_air_sensor_humidity.last_changed %}
            {{ (states.sensor.date_time.last_changed - states.sensor.inside_air_sensor_temperature.last_changed).total_seconds() | round(0) }}
          {% else %}
            {{ (states.sensor.date_time.last_changed - states.sensor.inside_air_sensor_humidity.last_changed).total_seconds() | round(0) }}
          {% endif %}
        unit_of_measurement: "Seconds"

Then an automation is setup if the timer goes above 1000 seconds for more than an hour it sends me a push notice. I then have to work out if its the sensor or the gateway then not responding.

Have bought a zigbee gateway to try that MQTT implementation as its hopefully a bit more reliable.

Cheers,
Ryan

This is my node red flow:

Heya Ryan,

Very nice… I was hoping to implement something a bit simpler. I haven’t gotten my head around node red yet.
Using MQTT do you have an open listener on the internet receiving messages (ie static IP / DNS which TTN sends the messages?

I am also having similar issues monitoring my gateway. I found there is an API on the things network which sends back gateway information. Have not had time to write anything to poll it yet.
https://www.thethingsnetwork.org/gateway-data/gateway/eui-xxxxxxxxxxxxx

But… in the meantime Im using tago.io to provide a few basic dashboards and a script to make sure the devices check in on a regular basis. Seems to work but would be nice to have it integrated with home assistant.

Ben