From 41caa76962910903ec89aeed1e4323f0e63697da Mon Sep 17 00:00:00 2001 From: sparky8512 <76499194+sparky8512@users.noreply.github.com> Date: Sun, 5 Sep 2021 17:41:13 -0700 Subject: [PATCH] Add a few more fields to the status group Add dish direction and "prolonged" obstruction info to the status mode group. These were added to the grpc service at some point over the last several months. Only lightly tested, given that my dish no longer reports significant periods of obstruction. This is related to discussion in issue #27, although it doesn't address that issue in the slightest. --- dish_grpc_sqlite.py | 2 +- starlink_grpc.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/dish_grpc_sqlite.py b/dish_grpc_sqlite.py index 6008a07..b6ff651 100644 --- a/dish_grpc_sqlite.py +++ b/dish_grpc_sqlite.py @@ -46,7 +46,7 @@ import time import dish_common import starlink_grpc -SCHEMA_VERSION = 2 +SCHEMA_VERSION = 3 class Terminated(Exception): diff --git a/starlink_grpc.py b/starlink_grpc.py index 38b0298..c8dc4bf 100644 --- a/starlink_grpc.py +++ b/starlink_grpc.py @@ -66,6 +66,19 @@ This group holds information about the current state of the user terminal. not packets were able to be transmitted or received. See also *count_obstructed* in general ping drop history data; this value will be equal to that value when computed across all available history samples. +: **obstruction_duration** : Average consecutive time, in seconds, the user + terminal has detected its signal to be obstructed for a period of time + that it considers "prolonged", or None if no such obstructions were + recorded. +: **obstruction_interval** : Average time, in seconds, between the start of + such "prolonged" obstructions, or None if no such obstructions were + recorded. +: **direction_azimuth** : Azimuth angle, in degrees, of the direction in which + the user terminal's dish antenna is physically pointing. Note that this + generally is not the exact direction of the satellite with which the user + terminal is communicating. +: **direction_elevation** : Elevation angle, in degrees, of the direction in + which the user terminal's dish antenna is physically pointing. Obstruction detail status data ------------------------------ @@ -433,6 +446,10 @@ def status_field_names(context=None): "fraction_obstructed", "currently_obstructed", "seconds_obstructed", + "obstruction_duration", + "obstruction_interval", + "direction_azimuth", + "direction_elevation", ], [ "wedges_fraction_obstructed[12]", "raw_wedges_fraction_obstructed[12]", @@ -479,6 +496,10 @@ def status_field_types(context=None): float, # fraction_obstructed bool, # currently_obstructed float, # seconds_obstructed + float, # obstruction_duration + float, # obstruction_interval + float, # direction_azimuth + float, # direction_elevation ], [ float, # wedges_fraction_obstructed[] float, # raw_wedges_fraction_obstructed[] @@ -560,6 +581,13 @@ def status_data(context=None): if field.number < 65: alert_bits |= (1 if value else 0) << (field.number - 1) + if status.obstruction_stats.avg_prolonged_obstruction_valid: + obstruction_duration = status.obstruction_stats.avg_prolonged_obstruction_duration_s + obstruction_interval = status.obstruction_stats.avg_prolonged_obstruction_interval_s + else: + obstruction_duration = None + obstruction_interval = None + return { "id": status.device_info.id, "hardware_version": status.device_info.hardware_version, @@ -576,6 +604,10 @@ def status_data(context=None): "fraction_obstructed": status.obstruction_stats.fraction_obstructed, "currently_obstructed": status.obstruction_stats.currently_obstructed, "seconds_obstructed": status.obstruction_stats.last_24h_obstructed_s, + "obstruction_duration": obstruction_duration, + "obstruction_interval": obstruction_interval, + "direction_azimuth": status.boresight_azimuth_deg, + "direction_elevation": status.boresight_elevation_deg, }, { "wedges_fraction_obstructed[]": status.obstruction_stats.wedge_abs_fraction_obstructed, "raw_wedges_fraction_obstructed[]": status.obstruction_stats.wedge_fraction_obstructed,