Closed ezamp closed 2 years ago
The issue heading and the expected behaviour don't match. Are no downlinks sent or are Class C downlinks not sent "immediately"?
It's seems like it's not the former because I see a downlink being scheduled in your log
_2022-04-01 16:15:32.650 CEST_:
DEBUG Generated downlink {"ack": false, "adr": true, "band_id": "EU_863_870", "dev_addr": "00EF5A9E", "device_class": "CLASS_C", "device_uid": "urbana-platform-devices.7898428ac6197297", "downlink_type": "data", "f_cnt": 1, "f_pending": false, "f_port": 0, "frequency_plan_id": "EU_863_870_TTN", "full_f_cnt": 1, "m_type": "UNCONFIRMED_DOWN", "mac_count": 1, "mac_length": 5, "mac_version": "MAC_V1_0_2", "max_downlink_length": 230, "namespace": "networkserver", "payload_length": 17, "phy_version": "PHY_V1_0_2_REV_B", "priority": "HIGHEST", "started_at": 1648822532.6476429, "transmit_at": 1648822537.221302}
_2022-04-01 16:15:32.650 CEST_:
DEBUG Schedule downlink {"attempt_rx1": true, "attempt_rx2": true, "band_id": "EU_863_870", "dev_addr": "00EF5A9E", "device_class": "CLASS_C", "device_uid": "urbana-platform-devices.7898428ac6197297", "downlink_class": "CLASS_A", "downlink_priority": "HIGHEST", "downlink_type": "data", "frequency_plan": "EU_863_870_TTN", "frequency_plan_id": "EU_863_870_TTN", "namespace": "networkserver", "path_count": 1, "rx1_data_rate": "lora:<bandwidth:125000 spreading_factor:7 > ", "rx1_delay": "RX_DELAY_5", "rx1_frequency": 867300000, "rx2_data_rate": "lora:<bandwidth:125000 spreading_factor:9 > ", "rx2_frequency": 869525000, "started_at": 1648822532.6476429}
_2022-04-01 16:15:32.652 CEST_:
DEBUG Scheduled downlink {"absolute_time": null, "attempt_rx1": true, "attempt_rx2": true, "band_id": "EU_863_870", "dev_addr": "00EF5A9E", "device_class": "CLASS_C", "device_uid": "urbana-platform-devices.7898428ac6197297", "downlink_class": "CLASS_A", "downlink_priority": "HIGHEST", "downlink_type": "data", "frequency_plan": "EU_863_870_TTN", "frequency_plan_id": "EU_863_870_TTN", "namespace": "networkserver", "rx1_data_rate": "lora:<bandwidth:125000 spreading_factor:7 > ", "rx1_delay": "RX_DELAY_5", "rx1_frequency": 867300000, "rx2_data_rate": "lora:<bandwidth:125000 spreading_factor:9 > ", "rx2_frequency": 869525000, "started_at": 1648822532.6476429, "transmission_delay": 4.568867733, "transmit_at": 1648822537.2204938}
TTN network server should schedule "immediately" the downlinks for class C devices.
What do you mean by immediate? The server should account for transmission delays and scheduling conflicts so no downlink would really be immediate.
It seems like you're not setting the Absolute time for the downlink "absolute_time": null,
. Without that, the network will choose to send the downlink on the next available downlink slot. Please check our docs for Class C dowlinks.
The downlink was pushed at 15:46:13 but the downlink was at 16:15:32, 30 minutes later when the device sent an uplink. If I send a downlink message from the platform how can I set the absolute time?
I guess by platform you mean the UI (Console). We don't support that yet. You can use the CLI and that's documented in the link I shared above. I'll add it here as well; https://www.thethingsindustries.com/docs/devices/class-c/
Actually we have a second instance of TTN (v3.18.2) and If I try to send a payload via UI, the downlink is scheduled after some seconds.
Ok but is both using Class C and the same type of device+gateway?
Yes, they both use class C devices and the same gateway model.
On the instance where the downlinks for class C work as expected, in the event detail "Schedule data downlink for transmission on Gateway Server" (on UI) appears "class": "CLASS_C" inside the "request" key:
"request": {
"class": "CLASS_C",
"downlink_paths": [
{
"uplink_token": "Ch4KHAoQMjRlMTI0ZmZmZWYwNjE5MBIIJOEk//7wYZAQ3KO66g8aDAiM8KqSBhC3x8uVAyDghqfX195dKgwIjPCqkgYQ4MjFjAM="
}
],
"rx2_data_rate": {
"lora": {
"bandwidth": 125000,
"spreading_factor": 9
}
},
"rx2_frequency": "869525000",
"frequency_plan_id": "EU_863_870_TTN"
},
"class": "CLASS_C" is not present in the event generated by the instance where the downlinks are sent after the next uplink.
Ok but what is then the difference between these instances? Are they running the same version of TTS with the same configuration? Are you using the same device in both cases? If yes, how are the MAC settings configured?
Summary
Application downlinks are not scheduled. The join accept or ADR response downlinks are scheduled correctly. This behavior occurs with all devices, regardless the class or the gateway used.
Steps to Reproduce
I don't think it's easily reproducible on other TTN instances. To replicate the problem on my instance:
What do you see now?
What do you want to see instead?
TTN network server should schedule "immediately" the downlinks for class C devices.
Environment
TTN cluster, v3.18.2 Redis 6.2.5
Can you do this yourself and submit a Pull Request?
No. This looks like a bug in the TTN network server, I'm not familiar with that code.