Getting data from LoRa - TTN network

Moderator: leecollings

Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Getting data from LoRa - TTN network

Post by Toulon7559 »

Making some progress with connection of EndDevice to TTN and further to Domoticz .....

'On the road' sometimes surprising discoveries.
Once more rereading the docs, now noticed that LoraWAN applies a definition for uplink (= from EndDevice towards Server)/downlink (= from Server to EndDevice),
which is opposite to other fields of communication such as Wifi and SATCOM.
Considering my own background,in hindsight that 'misunderstanding' might have been the reason for the 'problems' I had with earlier LoraWAN-setups.


TTN-side
The QR-diagram on my EndDevice Dragino LSN50v2D20 could not be scanned (= reported as ‘invalid’ at the TTN-Console),
but inside the packing-box another sticker revealed codes which enabled manual setup of the device at the TTN-Console.
Not without reason that the packing-sticker tells: Registration Key, Please keep it safely!

Enabled uplink-formatting for Cayenne_LPP, crossing fingers …….
Own Gateway not yet operational, but after setup now occasionally see messages popping up at the Console under 'Live Data', including report on quality
Data rate SF12BW125 SNR -13 RSSI -120
Looking at the Gateway_ID from those messages, to my surprise this link is not to one of the 2 Gateways at approx. 800m West or East low in a house in this suburb, but to a Gateway at approx. 3km, possibly located high up in a building on an industrial complex.

Domoticz-side
Setup for TTNMQTT progressed according to Wiki until the Password-line.
In the Wiki it states
The 'Password' refers to the base-64 encoded key under 'Access Keys'. Often only a 'default key' exists and looks something like 'ttn-account-v2.<bunchofcharactorsandnumbers>'
but at this moment for TTN_v3 apparently a different layout:
short hint appreciated for present names and locations to find the required password-info.

Once that question answered, the next aspect to be solved (having read also this Wiki-section, but not yet finding an answer):
under present/actual layout of TTN_v3, what is best practise for default-fill for following fields of Domoticz' Hardware_TTNMQTT?
Onderwerp IN voorvoegsel: ← Laat leeg voor Niet actief
Onderwerp UIT voorvoegsel: ← Laat leeg voor Niet actief
CA bestandsnaam:
TLS versie:
Mod09Mar2023:
Some minor textual adaptations/corrections, and addition of 2nd section and of bottom section
Last edited by Toulon7559 on Saturday 18 March 2023 19:39, edited 3 times in total.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Getting data from LoRa - TTN network

Post by Toulon7559 »

Many roads lead to Rome ....
Similarly various paths possible between an EndDevice and an Application.

Have succeeded to make a path from a Dragino-device type LSN50 to the TTN-Console.
Next step is linking to Applications:
- TTNMQTT in Domoticz still open questions as described in previous message (despite various experiments).
- As alternative route (with payload-format for the EndDevice reset to 'None') tried an interface by means of Datacake.de
Basically running with a Dashboard, Reporting and OutgoingWebhook in operation,
but would like to directly export (avoiding any 'middlemen') the Decoder-output as a JSON-file with predefined filename to a designated, fixed location.
Not with the detour etc. via Webhook.site as described in the Datacake-docs.
Simply said: take the hex-output visible at the TTN-Console => feed to Payload-decoder => save/upload result as JSON-file to defined destination-folder

Anybody with example experience on this subject?
Last edited by Toulon7559 on Monday 20 March 2023 18:44, edited 1 time in total.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
User avatar
kiddigital
Posts: 435
Joined: Thursday 10 August 2017 6:52
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Getting data from LoRa - TTN network

Post by kiddigital »

Once you have data from the end devices coming in on the TTN console and it is decoded (done automatically when CayenneLPP payload is detected), then you only have to configure Domoticz TTNMQTT module with the ‘TTN Application’ credentials so it can read the data.

Don’t forget to turn on ‘create new devices’ otherwise Domoticz can not create the appropriate devices.

Also, take a look at the ‘ttnmqtt_aliases.json’ file in the Domoticz root directory in case you need aliasses for some devicetypes.
One RPi with Domoticz, RFX433e, aeon labs z-wave plus stick GEN5, ha-bridge 5.4.0 for Alexa, Philips Hue Bridge, Pimoroni Automation Hat
One RPi with Pi foundation standard touch screen to display Dashticz
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Getting data from LoRa - TTN network

Post by Toulon7559 »

The setup to get Cayenne-payload looks easy enough.
After default setup of the LSN50v2D20 with Payload-formatter = 'None', the hex-payload is as described in the LSN50-manual.
To get 'Cayenne-transfer', have changed the setting for Payload-formatter both for Device and for Application to 'CayenneLPP',
but at the TTN-Console the payload looks the same as for 'None'.
The decoded payload at the TTN_Console has this segment

Code: Select all

"data": {
    "@type": "type.googleapis.com/ttn.lorawan.v3.ErrorDetails",
    "namespace": "pkg/messageprocessors/cayennelpp",
    "name": "output",
    "message_format": "invalid output",
    "correlation_id": "cda311810767406a9b08ff6b8e6df8a9",
    "code": 3
The report at 'message format' casts doubt that the setup is correct to get CayenneLPP.

Furthermore, for setup of CayenneLPP the registration at the Cayenne-website also is/remains a hurdle,
but that might be resulting from / related to the problem described above.
At end of Cayenne-Registration_Step1, it is required to insert an Address/Location.
Used various info copied from the TTN_Console and other 'inventions', but no luck:
if trying one of the IDs containing a textstring toulon (which is the name of the street I live), the setup is accepted as valid, but the result is showing on the map as an address in the harbour of Toulon(France), at Network Acklio, which both is far 'out of range' and not useful ....
Inserting a short, real geolocation the resulting error report is 'Confict', as shown below.
A longer string comprising a practical set of <Streetname>,<Place>,<Country> is recognized by the software, but still stop with error 'Conflict', and no device found.
.
Screenshot_Step1_Cayenne
Screenshot_Step1_Cayenne
screenshot-cayenne.mydevices.com-2023.03.23-Registration [320x200].png (19.06 KiB) Viewed 1246 times
.
Apparently must have missed a few 'subtleties' in the setups.
1. What could be wrong for the TTN_PayloadFormatter-setup?
2. What is for Cayenne_Registration correct format&contents and/or data-source for Address/Location?
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Toulon7559
Posts: 843
Joined: Sunday 23 February 2014 17:56
Target OS: Raspberry Pi / ODroid
Domoticz version: mixed
Location: Hengelo(Ov)/NL
Contact:

Re: Getting data from LoRa - TTN network

Post by Toulon7559 »

Dragino provides an uptodate, compatible series of PayloadDecoders for it's devices at https://github.com/dragino/dragino-end-node-decoder
including a NodeRed-interface. Sensecap-scripts can be found at https://github.com/Seeed-Solution/TTN-Payload-Decoder
Be aware to take the TTN_v3 versions, not those for TTN_v2!
You just need to find howto link such decoder-script at the TTN-Console.
[because e.g. manual for Dragino LSN50 is not (yet) aligned with the latest layout of TTN-Console]
At this moment,
- for PayloadFormatter/Uplink select 'Custom Javascript Formatter',
- past the selected formatter-script in the appearing script-window,
- test with a base64-payload-string in the window at righthand side of the script-window,
- and (if tested_OK) 'Save Changes',
after which the decoded payload is available for inclusion in files resulting from the TTN-server.
Set1 = RPI-Zero+RFXCom433+S0PCM+Shield for BMP180/DS18B20/RS485+DDS238-1ZNs
Set2 = RPI-3A++RFLinkGTW+ESP8266s+PWS_WS7000
Common = KAKUs+3*PVLogger+PWS_TFA_Nexus
plus series of 'satellites' for dedicated interfacing, monitoring & control.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest