Commit graph

196 commits

Author SHA1 Message Date
luxifer
40cd0127dc add prometheus exporter 2022-11-15 16:45:24 +00:00
sparky8512
5887eb9816
Remove incorrect env option
Per discussion on issue #68, setting INFLUXDB_SSL to "false" is not useful here. This was probably copied over from the MQTT example service conf file, where it is supported (although essentially ignored).
2022-11-11 13:13:41 -08:00
sparky8512
36f7b169a0
Correct another issue in the systemd instructions
As noted in issue #67.
2022-11-10 12:58:06 -08:00
sparky8512
7c46577743
Merge pull request #70 from jbuck2005/patch-2
fix mkdir starlink-grpc-tool (missing s)
2022-11-10 11:18:11 -08:00
jbuck2005
125e918aba
fix mkdir starlink-grpc-tool (missing s)
fix missing "s" in

mkdir starlink-grpc-tool
and
cd starlink-grpc-tool

install location pointed to by https://github.com/sparky8512/starlink-grpc-tools/blob/main/systemd/starlink-influx2.service shows WorkingDirectory=/opt/starlink-grpc-tools/
2022-11-10 12:56:10 -05:00
sparky8512
000e3a4a62 Stop using a couple recently-obsoleted attributes
The dish firmware stopped reporting the wedge fraction obstructed detail a few weeks ago, and now has apparently dropped it from the grpc protocol.

The core module now reports a sequence of None values for those fields, which is represented as "no data" in most of the database outputs. Without meaningful data in these fields, the obstruction_detail mode group is mostly useless, but the obstruction map was a much better representation of that data, anyway.

This should address issue #65.
2022-11-08 15:03:21 -08:00
sparky8512
5cc43f6e1d Address a bunch of pylint and yapf complaints
I don't necessarily think all of these make the code better or easier to read, but it's easier to just go along with what the tools want, since they do generally make things better.

There should be no functional changes here.
2022-09-14 12:55:50 -07:00
sparky8512
24b8f95792
Merge pull request #64 from boswelja/typing-extensions
Introduce typing-extensions for proper TypedDict support on Python 3.7
2022-09-12 07:51:28 -07:00
Jack Boswell (boswelja)
98adc879ae Only specify unwrapped in UnwrappedHistory 2022-09-12 16:11:03 +12:00
Jack Boswell
3deb015c0d
Pin typing-extensions for Dockerfile 2022-09-12 15:35:52 +12:00
Jack Boswell
2d35afd0da
Remove rogue import 2022-09-12 15:35:26 +12:00
Jack Boswell (boswelja)
e45daca3c4 Add typing-extensions to Dockerfile 2022-09-11 16:42:40 +12:00
Jack Boswell (boswelja)
c3272cf781 Add typing-extensions for proper TypedDict support
Also updated UnwrappedHistory to expose its types
2022-09-11 13:45:39 +12:00
sparky8512
6a186b6e3b Address remaining mypy complaints
Add type hints for the variable that mypy couldn't figure out by context.

Also, one more field should have been marked as Optional[].
2022-09-10 16:19:04 -07:00
sparky8512
8650687f69 Correct CSV and sqlite support for location group
Add CSV header and sqlite schema support for the newly added location group, along with the necessary functions in the starlink_grpc module to expose the field names and types for that group. This really should have gone in with the prior change.

Also, correct the order of the ping_latency and ping_loaded_latency groups in the CSV header, which was backwards. This would have resulted in an incorrect CSV header if both those groups were selected.
2022-09-10 16:12:05 -07:00
sparky8512
29699f0f59 Add data group for GPS location data
Add a new mode group, location, for physical location data. This requires access to the location data being enabled on the dish in order to return data; see README file for more details. At least for now, this functionality should be considered experimental.

This is being lumped into the "status" category for the purposes of database schema, but it's a separate grpc request from the other status data, and can fail at times when the other status request does not, so it has a separate function in the starlink_grpc module.
2022-09-10 14:43:50 -07:00
sparky8512
29c813b51a Correct a (harmless) typo 2022-09-09 15:39:33 -07:00
sparky8512
c37dbdfaa4
One more field that should be marked optional 2022-09-09 15:23:25 -07:00
sparky8512
ab0fba7b88 Document another recently added alert 2022-09-09 11:27:57 -07:00
sparky8512
f759e4cc3b
Merge pull request #62 from sparky8512/return-type-hints-2
Type hints for status and history return values
2022-09-09 11:13:34 -07:00
sparky8512
1167742f75 Correct Python 3.7 compatibility hack
mypy complained about the signature of conditional def of get_args not matching the one from typing module, so I made it match, but apparently hadn't actually tested it with Python 3.7. It was just the return type hint, but it sill needs to parse at run time.

Also, fix up a few other (non-error) gripes from pylint.
2022-09-09 11:01:53 -07:00
sparky8512
5ff207ed8c Type hints for status and history return values
Implement type hints for the data returned from status_data, history_stats, and history_bulk_data, and modify the *_field_names and *_field_types functions to make use of the same data.

This is complicated a little by the fact that the field names returned for sequences in the returned data are slightly different from those in *_field_names, for reasons that I'm sure made perfect sense to me at the time.

Should work with static type checkers on Python 3.8 and later. Python 3.7 is still supported for the run time, but possibly in a way that static type checking will not be able to understand.

This is for issue #57
2022-09-07 13:44:54 -07:00
sparky8512
0a4aae4ffb
Merge pull request #61 from boswelja/patch-1
Add return hint for get_id
2022-09-07 07:19:01 -07:00
Jack Boswell
18ced80c25
Add return hint for get_id 2022-09-07 13:18:43 +12:00
sparky8512
feccac23ee A few doc string updates
Reword the is_snr_above_noise_floor description to be more consistent with the rest of the field docs.

Correct the order the status field groups in the docs for the functions that return them to reflect the actual order in which they are returned.
2022-08-28 09:07:24 -07:00
sparky8512
40713e1426
Merge pull request #59 from DeanCording/is_snr_above_noise_floor
Added documentation for is_snr_above_noise_floor
2022-08-27 19:03:51 -07:00
Dean Cording
aad6ad9d2b
Added documentation for is_snr_above_noise_floor 2022-08-28 11:25:15 +10:00
sparky8512
3126e921d3
Merge pull request #58 from DeanCording/is_snr_above_noise_floor
Added is_snr_above_noise_floor flag
2022-08-27 07:27:39 -07:00
Dean Cording
f21ddd67e0
Added is_snr_above_noise_floor flag 2022-08-27 12:55:27 +10:00
sparky8512
c961ec90d0
Merge pull request #55 from boswelja/channel-context-type-hints
Introduce some type hints
2022-08-21 17:26:31 -07:00
Jack Boswell (boswelja)
b414e99f3f Replace remaining usages of | None with Optional 2022-08-22 11:31:14 +12:00
Jack Boswell (boswelja)
003c851e40 Use Optional[] instead of | None 2022-08-21 14:47:01 +12:00
Jack Boswell (boswelja)
39b850bc3d Specify some more type hints 2022-08-20 13:01:34 +12:00
Jack Boswell (boswelja)
4e91755200 Provide type hints for places where ChannelContext is used 2022-08-20 12:29:48 +12:00
sparky8512
75a8b875c4 Document a couple more alert bits
This adds alert_install_pending and alert_is_heating to the documentation at the top of the module. These alerts were added approximately forever ago, and get picked up automatically via reflection any time the scripts restart, so this is just to get the docs caught up.
2022-08-19 09:28:25 -07:00
sparky8512
8a0f44bfa6 Programmatic interface for reboot, stow, unstow
Per discussion in issue #52, add a few dish control functions to the starlink_grpc module for possible use by other projects.
2022-08-17 15:01:53 -07:00
sparky8512
48aebd6289 Emit specific error if protocol modules not found
This has now tripped up more than one user (see issues #47 and #53). There is a note in the README about this, but it's easy to miss if you don't read it thoroughly.
2022-08-17 13:59:22 -07:00
sparky8512
7cf1d62658 Fix setuptools_scm config 2022-08-17 08:23:59 -07:00
sparky8512
0deda55826 Packaging configuration for export of core module
Per issue #52
2022-08-17 07:58:45 -07:00
sparky8512
6ab737165e Correct help text and default for server URL arg
Not sure why I thought the InfluxDB 2.x client library accepted a bare host/port for the server, in addition to a full URL. It does not, as reported in issue #49.  The 1.x client did, but it didn't take a URL for server, anyway.

This corrects the help text to indicate the URL argument specifies a... URL, and corrects the default to be something that could actually work.
2022-07-06 16:51:48 -07:00
sparky8512
87e1f24e77
Clarify dump_dish_status.py requirements
Specifically, that the recommendation of skipping the generation of protocol modules does not apply, as discussed in issue #47.
2022-06-13 20:54:30 -07:00
sparky8512
30d20a4f5b
Note Python 3.7 as minimum version
While the scripts can mostly work with Python 3.5, the installation or pre-reqs gets really messy, per issue #45. Python 3.5 has been end-of-lifed for a while now, anyway.
2022-05-31 14:44:25 -07:00
sparky8512
b85e040761 Fix this silly example script
This never got updated to the gRPC protocol changes that happened almost a year ago.

This should address part 4 of issue #45.
2022-05-25 16:41:07 -07:00
sparky8512
8d2b25b971 Proper error handling
Print an error when getting obstruction map data from the dish fails, rather than crashing the script with an exception.

As reported in issue #45.
2022-05-25 16:30:56 -07:00
sparky8512
e01aea6bd4 Add simple script to reboot, stow, or unstow dish
As reported in issue #43, the unstow operation is not quite as straightforward to perform using grpcurl as reboot or stow.

This also serves as a simplified example of using reflection (via yagrc) to perform grpc operations on the dish.
2022-04-19 11:17:14 -07:00
sparky8512
f08682af30 Force line buffering when output is stdout
For some reason, I had decided that non-stdout output needed to be line buffered, but not stdout? Python will only line buffer stdout by default if it is a TTY, and there are lots of use cases where it is not. And since I started re-opening the output FD, the python executable command line option (-u) no longer works to force it to be unbuffered.

Fix #44
2022-04-13 08:54:25 -07:00
sparky8512
35150803ef New validity check for prolonged obstruction data
Reintroduce validity check for prolonged obstruction duration and interval, but based on checking for 0.0 and NaN values instead of relying on the valid flag in the gRPC message. Empirical evidence suggests that the dish reports (0, NaN) for those 2 values when it has no obstruction data with which to work, such as when there actually are no obstructions or when the dish has recently rebooted.

This should fix #42.
2022-03-26 15:22:02 -07:00
sparky8512
5f44f5ac41 Document different topic format for JSON mode 2022-03-02 15:10:31 -08:00
sparky8512
f25e58aa2b Filter out None values when not in JSON mode
I noticed this while testing the change that added the --json option, though it is not related to that change.

Sequence types get mushed into a string when not in JSON mode, and that was turning None object values into the string "None", which is not desirable. So, similar to how the text output script handles it, those now get emitted as an empty string instead. JSON mode is probably better to use for this type of data, anyway, but it was bugging me to have it report as "None".
2022-03-02 15:02:29 -08:00
sparky8512
b11e6f4978 Catch and ignore KeyboardInterrupt exception
Per discussion in PR #40 comments. This will prevent a stack dump from littering the output when interrupting script run via Control-C. That was useful to have for a while, but probably is not anymore.

Also, fix up a few corner cases where rc could be used without it having been set.
2022-03-02 14:48:51 -08:00