Make gateway state consistent + make stats interval configurable.

This:

* Makes the gateway stats interval configurable (default 30 sec)
* Adds GatewayState type (NEVER_SEEN, OFFLINE, ONLINE)
* Adds gateway state to gateway lists
* Fixes dashboard inconsistencies

Closes #76.
This commit is contained in:
Orne Brocaar
2023-01-11 10:39:18 +00:00
parent d065df2805
commit 438d120fb0
32 changed files with 875 additions and 486 deletions

View File

@ -124,7 +124,7 @@ message DeviceProfile {
// Uplink interval (seconds).
// This defines the expected uplink interval which the device uses for
// communication. When the uplink interval has expired and no uplink has
// communication. If the uplink interval has expired and no uplink has
// been received, the device is considered inactive.
uint32 uplink_interval = 11;

View File

@ -66,6 +66,17 @@ service GatewayService {
}
}
enum GatewayState {
// The gateway has never sent any stats.
NEVER_SEEN = 0;
// Online.
ONLINE = 1;
// Offline.
OFFLINE = 2;
}
message Gateway {
// Gateway ID (EUI64).
string gateway_id = 1;
@ -87,6 +98,11 @@ message Gateway {
// Metadata (provided by the gateway).
map<string, string> metadata = 7;
// Stats interval (seconds).
// This defines the expected interval in which the gateway sends its
// statistics.
uint32 stats_interval = 8;
}
message GatewayListItem {
@ -116,6 +132,11 @@ message GatewayListItem {
// Last seen at timestamp.
google.protobuf.Timestamp last_seen_at = 9;
// Gateway state.
// Please note that the state of the gateway is driven by the stats
// packages that are sent by the gateway.
GatewayState state = 10;
}
message CreateGatewayRequest {

View File

@ -264,11 +264,11 @@ message GetGatewaysSummaryRequest {
}
message GetGatewaysSummaryResponse {
// Active count.
uint32 active_count = 1;
// Online count.
uint32 online_count = 1;
// Inactive count.
uint32 inactive_count = 2;
// Offline count.
uint32 offline_count = 2;
// Never seen count.
uint32 never_seen_count = 3;