diff --git a/README.md b/README.md index 8d51a7e..cf64cc2 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Note that the Python package versions available from various Linux distributions ### Generating the gRPC protocol modules -This step is no longer required, as the grpc scripts can now get the protocol modules classes at run time via reflection, but generating the protocol modules will improve script startup time, and it would be a good idea to at least stash away the protoset file emitted by `grpcurl` in case SpaceX ever turns off server reflection in the dish software. +This step is no longer required, as the grpc scripts can now get the protocol module classes at run time via reflection, but generating the protocol modules will improve script startup time, and it would be a good idea to at least stash away the protoset file emitted by `grpcurl` in case SpaceX ever turns off server reflection in the dish software. The grpc scripts require some generated code to support the specific gRPC protocol messages used. These would normally be generated from .proto files that specify those messages, but to date (2020-Dec), SpaceX has not publicly released such files. The gRPC service running on the dish appears to have [server reflection](https://github.com/grpc/grpc/blob/master/doc/server-reflection.md) enabled, though. `grpcurl` can use that to extract a protoset file, and the `protoc` compiler can use that to make the necessary generated code: ```shell script diff --git a/starlink_grpc.py b/starlink_grpc.py index 587d79f..718c7ed 100644 --- a/starlink_grpc.py +++ b/starlink_grpc.py @@ -374,6 +374,9 @@ def status_field_names(): A tuple with 3 lists, with status data field names, alert detail field names, and obstruction detail field names, in that order. """ + if not import_ok: + with grpc.insecure_channel("192.168.100.1:9200") as channel: + import_protocols(channel) alert_names = [] for field in dish_pb2.DishAlerts.DESCRIPTOR.fields: alert_names.append("alert_" + field.name) @@ -410,6 +413,9 @@ def status_field_types(): A tuple with 3 lists, with status data field types, alert detail field types, and obstruction detail field types, in that order. """ + if not import_ok: + with grpc.insecure_channel("192.168.100.1:9200") as channel: + import_protocols(channel) return [ str, # id str, # hardware_version