TG-LR82: switch-profile / per-profile ul-period-s doesn't produce the expected reporting cadence

Device: TG-LR82 (dev_eui 0016c001f017e9aa), LoRaWAN 1.0.x, OTAA, EU868, ChirpStack v4 network server. Firmware version: querying now, will post in a reply (device confirms version frame contents).

What I'm trying to do

Use the 6 configuration profiles to implement a simple "fast reporting after an event, slow reporting at rest" pattern, driven entirely by data set-rule + switch-profile, without any extra downlink round-trip:

  • Profile 0 ("rest"): current-state + device-orientation frames every 3600s.
  • Profile 1 ("alert"): same two frames every 1800s (originally tried 300s, see below).
  • data orient-cfg 3,1,10,60,1,3,127 — reference vector set once, profile-mask=3 so it applies to both profiles (so angle_1 keeps being computed no matter which profile is active).
  • Rule 18: angle_1 > 25 → switch-profile=1, send current-state,device-orientation.
  • Rule 20: mag_sw_etm < 15 → switch-profile=1, send current-state,device-orientation.

(I originally also had exit rules — angle_1 < 20 / mag_sw_etm > 900 → switch-profile=0 — but deleted both after realizing their test-expr is permanently true while the device is at rest, i.e. not a real edge. I now switch back to profile 0 via an explicit downlink instead. Mentioning this in case it's relevant to the behavior below — happy to be told this reasoning is wrong.)

Encoding verified correct: every hex payload below was independently re-generated with tg-lrx2-encode against the official tg-lrx2-2.0-desc.yml and matches byte-for-byte what was actually sent (so this isn't an encoding mistake on my end, as far as I can tell).

cfg-state CRCs (cfg_data_crc, cfg_rules_crc, cfg_frames_crc) confirm each of these configuration changes was actually received and stored by the device (each change produced the expected CRC delta).

What I'm seeing

After a real, sustained tilt (>40° off the reference vector, held for well over a minute), the device:

  1. Took ~54 minutes to report the new orientation at all (no sign of an "immediate" uplink independent of the normal cadence — the report arrived right around when the next regular cycle was due anyway).
  2. After that, instead of settling into a 1800s (30 min) cadence for current-state/device-orientation, the actual gaps I measured were 60 / 120 / 274 minutes — no clean relationship to either 3600s (profile 0) or 1800s (profile 1).

This is independent of signal quality — I moved the device much closer to the gateway (RSSI improved from -93 to -62 dBm) and the irregular cadence persisted.

Separately: the device's gateway is intentionally restricted to a single enabled uplink channel (enabled_channels=[0] in every LinkADRReq I've seen). I don't know if that's related, but it's the only "scarce resource" factor I can point to.

Questions

  1. Does switch-profile (as a rule action) actually change which ul-period-s is used for the next scheduled uplink immediately, or does the frame-group's internal timer keep running from whenever it last fired under the previous profile (i.e. could the first post-switch interval legitimately be "whatever was left" rather than the new period)?
  2. Does send-frame (as a rule action) force an uplink independent of the configured ul-period-s/duty-cycle scheduling for that frame group, or does it just mark the frame to be included in the next transmission that was going to happen anyway? The behavior I'm seeing looks a lot like the latter, but I can't confirm it from the docs.
  3. Is there any internal duty-cycle/airtime self-throttling that would silently extend the actual interval beyond what's configured in frame set-cfg, especially relevant on a single-channel gateway?
  4. Does switching the active profile (via switch-profile or app profile) reset the edge-detection ("previous value") state used by other rules? Concretely: if rule A just switched to profile 1, and rule B's test-expr happens to already be true at that moment, can rule B fire on the very next evaluation even though its condition didn't actually just become true?

Any pointers — official documentation, firmware changelog, or just "this is a known limitation" — would save me a lot more trial-and-error. Happy to post more config details, decoded frame dumps, or try specific test commands if that helps.

Ughhh.... long, hard to read and understand text

Please start with "happines" and share config as config makes helping easier: Forum rules - #5 by gigabyte091

We do not even know how devices are interconnected but you ask such detailed questions.

Hi, sorry for that. Just wanted to make it as clear as possible and thanks in advance for any support. Not sure how to transfer all information even shorter.. =)

TG-LR82 -- LoRaWAN --> single-channel Heltec ESP32 gateway (868.1 MHz only) --MQTT--> ChirpStack v4 (self-hosted) --MQTT--> my app

OTAA, EU868. Only this one device uses its device-profile. Network ADR disabled on the device, fixed DR2 (lora adr-cfg 0,2) — ruled out as a factor, see below.

Goal: fast reporting while "alert" (tilted or magnet recently changed), slow reporting at rest — via profiles + switch-profile, no extra downlink round-trip.

Current config (profile 0 = rest, profile 1 = alert):

  • Profile 0: current-state+device-orientation every 3600s
  • Profile 1: same frames every 1800s
  • orient-cfg 3,1,10,60,1,3,127 (profile-mask=3, both profiles)
  • Rule 18: angle_1 > 25 → switch-profile=1, send current-state+device-orientation
  • Rule 20: mag_sw_etm < 15 → switch-profile=1, send current-state+device-orientation
  • No "return to profile 0" rules anymore (see below) — that's now a plain downlink (app profile 0,1)

Exact hex payloads (port 2):

cmd hex
frame set-cfg 1,3600,0,0,current-state,device-orientation 98020201cd0e1000000105
frame set-cfg 2,1800,0,0,current-state,device-orientation 98020202cd070800000105
data orient-cfg 3,1,10,60,1,3,127 99040e03010a3c01037f
data set-rule 18,angle_1 > 25,,1,,,,,current-state,device-orientation 9c041412a532383e3235c001c0c0c0c00105
data set-rule 20,mag_sw_etm < 15,,1,,,,,current-state,device-orientation 9c041414a531333c3135c001c0c0c0c00105
lora adr-cfg 0,2 9401090002

What's wrong: after a real, sustained tilt, the device takes anywhere from ~1h to several hours (sometimes none observed at all) to report the new orientation — never clearly faster than the already-configured periodic interval. Afterwards the reporting interval doesn't settle on either profile's configured period; I've measured gaps of 60/90/120/148/180 min in the same session, with no visible pattern.

What I've ruled out so far:

  • Encoding: every hex payload above was independently re-generated with tg-lrx2-encode and matches byte-for-byte what was sent.
  • Two of my own rules were buggy: I originally had angle_1 < 20 / mag_sw_etm > 900 rules to auto-return to profile 0. Both test-expr are permanently true while the device is at rest — not a real edge. Deleted both.
  • ADR backoff re-enabling default channels (suggested by support on a separate ticket, relevant because of the single-channel gateway. The answer took some time which is why I opened the topic here too): disabled network ADR entirely, fixed DR2, confirmed applied via real device ACK.
  • Signal/gateway: RSSI has been excellent throughout (-55 to -58 dBm), gateway uptime continuous (checked stats pings, zero gaps).

Result after all of the above: briefly looked fixed (4 uplinks in a row exactly 60 min apart), then reverted overnight to the same irregular pattern. This morning's tilt test produced zero uplinks of any kind (not even the normal baseline) for 2+ hours.

Would be great if you could help me with any ideas or hints how to continue here. Do you know if switch-profile change the period used for the next uplink immediately, or does the frame-group's timer keep running from the previous profile? Or does a rule's send-frame action force an immediate uplink, or just get included in the next uplink that was going to happen anyway?

Thanks in advance!

BR

Still tough to read as it is just rephrased.

On any profile switch frame ul-period-s is updated immediately and frames are re-scheduled. Next frame uplink is scheduled based on new ul-period-s and already elapsed time since last uplink.

send-frame rule action schedules frame for uplink. This is independent of periodic uplinks, but they both use same logic. Frame is marked as scheduled. All scheduled frames are sent ASAP.

Since uplinks can be limited in maximal size or prevented due to duty limits pending frames may be delivered later. Configuring a lot of uplinks may result in device exhausting all air time. All periodic or rule logic will still work and mark frames as pending as previously, but actual message delivery will be postponed until available air time.

Rules don't reset internal state during operation. Rule action is executed only if evaluated state becomes true and previous state was false. As expected timers and states don't continuously execute action once becoming true.

Regarding the race condition. Rules with no input dependencies are evaluated first and in numeric order. Rules depending on other rules are evaluated after that. All actions except profile switch will be executed for each "triggered" rule. Profile switch will be performed based on last rule that sets profile. That is - If multiple profiles execute profile switch in single evaluation, the last value will be used.

This looks more like general uplink reception issue. Can you first verify that reception works with factory defaults? Setting up rules not knowing if single channel operation works will just make it a lot more difficult. I suggest to perform factory reset and check if default 5 minute uplinks work consistently.

I've written minimal configuration for angle triggered profile switching as a reference and tested locally. I've used 3min for "idle" and 1min for "alert" for faster testing. Also orientation polling is set to 10s.

# Configure frame intervals.
frame clear-cfg 3
frame set-cfg 1,180,0,1,current-state,device-orientation
frame set-cfg 2,60,0,1,current-state,device-orientation

# Configure orientation polling, reference vector and disable activity monitor.
data orient-cfg 3,1,10,10,1,3,127
data activity-cfg 3,0

# Rules for profile switching and frame uplinks on ref-1 angle.
data del-rule
data set-rule 18,angle_1 > 25,,1,,,,,current-state,device-orientation
data set-rule 19,angle_1 < 20,,0,,,,,current-state,device-orientation

Encoded commands:

- b64: lZoCkgQDApYBzLQAAQEFAjwAAQEFBJgOAwEKCgEDf5MMAwAT 
  hex: 959a02920403029601ccb400010105023c0001010504980e03010a0a01037f930c030013 
  len: 36 
  port: 3 
- b64: nQQUmhKlMjg+MjXAAcDAwMABBROlMjg8MjDAAMDAwMABBQ== 
  hex: 9d04149a12a532383e3235c001c0c0c0c0010513a532383c3230c000c0c0c0c00105 
  len: 34 
  port: 2

Thanks for the pointers, very helpful so far. Tried triggering a factory reset via the magnet switch to get back to known-good defaults.

  • Entered the device's factory PIN → confirmed with 3 short LED blinks.
  • Immediately followed by 6-9-9 → also 3 short blinks, but then one additional long pulse right after.

Looks like "command recognized" followed by "execution failed" — but not sure. Any idea what the long pulse after the 3 blinks means in this case, or what we might be missing?

Magnet switch command result indication always follows after command execution. So 3x short blink indicates command was executed successfully.

The single "long" blink is on FW startup/reset while initial device configuration is performed.

It seems factory reset was performed on your device. Just a reminder that after factory reset device is in shutdown mode and needs to be activated and server side needs nonce/mac reset.

Thanks a lot for the help so far — the shutdown-mode hint solved it. Your reference config (180s/60s) runs rock solid.

Since then I bisected the ul-period-s for profile 0: 180s runs at 100%, no failures. 1800s gets ~65%, recovers on its own. 3600s gets ~55%, recovers on its own. 10817s completes exactly one clean cycle, then goes dead until a rule-triggered send wakes it up.

Rule-triggered sends stay fast/reliable throughout — only the periodic schedule degrades with longer periods (still on the single-channel gateway, in case that's relevant). Known behavior?

Currently testing/validating further to find the sweet spot for max battery savings while still getting ~2 status reports/day.

What do you mean by recovers on its own? Can you provide some logs? Did you check GW logs as well?

No, we haven't seen anything like that. We test a lot of different uplink intervals. I tested your exact configuration using TTN and 10000 second interval for profile 0 overnight. Device reports as expected.

I'll try to reproduce using chirpstack. I suspect its something to do with single channel operation. This is non standard and maybe some configuration quirks cause issues.

I've tested similar setup using chirpstack and R11e-LR8G GW configured with single enabled channel.

There are few issues to consider:

  • Join is a lot longer since you need to wait for join request to match frequency and SF of single channel GW.
  • If ADR is enabled TG-LR will switch to DR0 immediately after join accept. This means if GW DR is set higher than DR0 it will never receive following messages.
  • There is a bug in lora adr-cfg 0,x. With disabled ADR only DR0 can be set. Any other DR can't be configured. For any value other than 0 device will use DR0 and DR1 instead.

Practically this means you must use DR0 (SF12) with this kind of setup.

@jsk Thanks, that's very useful — likely explains part of what we're seeing too.

We had applied lora adr-cfg 0,2 on 2026-10-13, assuming it fixed DR2. Given your bug report, that was probably never actually honored and the device has likely been alternating DR0/DR1 since then without us realizing it.

We just switched to lora adr-cfg 0,0 and started logging the actual DR of every uplink to verify. Will report back once we have data.

Follow-up: switched to lora adr-cfg 0,0 on Oct 30. Confirmed via rxInfo that the device transmitted at DR0 right after.

Unfortunately reliability got worse, not better: over the following 12 days (55 periodic cycles at ul-period-s=3600), only ~13% landed in the normal ~1h window, median gap ~3h, two stalls of ~24h. With the previous adr-cfg 0,2 (same interval) we were seeing closer to ~50%.

So DR0 alone doesn’t seem to explain the erratic reporting for us — something else must be going on. Happy to share raw timestamps/logs if useful.

Yes, post the full logs and chirpstack configuration as well. What is the exact model of GW?

"new users can not upload attachements" -> Any hints or how I am able to upload?

Gateway model: Heltec WiFi LoRa 32 V3 (ESP32-S3 + SX1262), self-built single-channel
gateway, 868.1 MHz only. ChirpStack v4.19.2, EU868, OTAA.

Attached (secrets redacted): chirpstack.toml, region_eu868.toml (note
enabled_uplink_channels=[0], adr_disabled=false), and every log line for
dev_eui 0016c001f017e9aa from 2026-10-30 (when I set lora adr-cfg 0,0) to
2026-11-13 (last uplink ever received).

Likely culprit found in the logs: ChirpStack queues a new LinkADRReq on almost
every uplink (adr_disabled=false server-side), but the device only ever sent a
LinkADRAns 3 times in two weeks (Oct 31, Nov 3, Nov 5 — each confirming "ADR
disabled, DR0, channel 0"). After Nov 5 it never acked again, even though the
server kept re-sending LinkADRReq on every uplink — including the very last one,
after which the device has been completely silent (now ~5 days).

Cadence over that window: 61 uplinks, gaps from 0.1 min to 27h, avg 5.5h, 25 of
60 gaps >5h — matches the erratic pattern from earlier in this thread.

Questions: does this repeated LinkADRReq-without-ack loop have side effects
(e.g. eating the single gateway's scarce downlink slots)? Should I just set
adr_disabled=true since the device manages its own rate via adr-cfg?

I'll check if I can help with this.

Only changes I've made in region config are:

# Minimum data-rate.
min_dr=0

# Maximum data-rate.
max_dr=0

enabled_uplink_channels = [0]

You need to limit maximal DR or use lora adr-cfg 0,0, but since to issue this command you need device to join network you can't reliably do/repeat this.

What I suggest before you can provide more info or log files:

  1. Ensure GW is configured to 868.1 MHz and SF12 (didn't mention this).
  2. Edit region_eu868.toml min_dr, max_dr and enabled_uplink_channels.
  3. Recreate device in chirpstack so all previous context is removed.
  4. Perform factory reset of TG-LR82.
  5. Test default config uplinks after network join. Ensure GW works consistently.

With this setup device should switch to 868.1 since join accept would mark single usable channel. Next uplink should be DR0 and since max_dr=0 Chirpstack ADR engine will keep DR fixed at that value. Other parameters like TX power and repeat count could still be controlled by network server.