This repository was archived by the owner on Dec 14, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed
Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,7 @@ func (n *networkServer) HandleActivate(activation *pb_handler.DeviceActivationRe
134134
135135 dev .LastSeen = time .Now ()
136136 dev .UpdatedAt = time .Now ()
137+ dev .ActivatedAt = time .Now ()
137138 dev .DevAddr = * lorawan .DevAddr
138139 dev .NwkSKey = * lorawan .NwkSKey
139140 dev .FCntUp = 0
Original file line number Diff line number Diff line change @@ -36,8 +36,9 @@ type Device struct {
3636 Options Options `redis:"options"`
3737 ADR ADRSettings `redis:"adr,include"`
3838
39- CreatedAt time.Time `redis:"created_at"`
40- UpdatedAt time.Time `redis:"updated_at"`
39+ CreatedAt time.Time `redis:"created_at"`
40+ UpdatedAt time.Time `redis:"updated_at"`
41+ ActivatedAt time.Time `redis:"activated_at"` // Indicates whether the device was activated via OTAA method
4142}
4243
4344// ADRSettings contains the (desired) settings for a device that uses ADR
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ func (n *networkServer) handleUplinkMAC(message *pb_broker.DeduplicatedUplinkMes
9797 }
9898
9999 // We did not receive an ADR response, the device may have the wrong RX2 settings
100- if dev .ADR .ExpectRes && dev .ADR .Band == "EU_863_870" && viper .GetInt ("eu-rx2-dr" ) != 0 {
100+ if dev .ADR .ExpectRes && dev .ADR .Band == "EU_863_870" && viper .GetInt ("eu-rx2-dr" ) != 0 && dev . ActivatedAt . IsZero () {
101101 settings := message .GetResponseTemplate ().GetDownlinkOption ()
102102 if settings .GetGatewayConfiguration ().Frequency == 869525000 {
103103 if loraSettings := settings .ProtocolConfiguration .GetLoRaWAN (); loraSettings != nil {
You can’t perform that action at this time.
0 commit comments