Commit graph

181 commits

Author SHA1 Message Date
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
sparky8512
e65ec37962 Fix SSL-related env var parsing
Per discussion in PR #40 comments.
2022-03-02 14:32:33 -08:00
sparky8512
b61f5a4789
Merge pull request #40 from DeanCording/main
Starlink-MQTT Systemd support
2022-03-02 14:14:04 -08:00
sparky8512
ea3c8b32e9
Merge pull request #41 from DeanCording/patch-1
Fix typo in README.md
2022-03-02 08:52:13 -08:00
Dean Cording
323fc26754 Fix for NaN values on startup that upset Javascript JSON decoders 2022-03-02 21:22:01 +10:00
Dean Cording
b3f60b0858
Update README.md
Fixed typo
2022-03-02 16:23:17 +10:00
Dean Cording
26437e00ea Typo fixed 2022-03-02 16:15:05 +10:00
Dean Cording
16bdf3df9d Added systemd support for dish_grpc_mqtt 2022-03-02 15:15:37 +10:00
sparky8512
3977f0b422
Merge pull request #39 from DeanCording/main
Added option to send data as a single MQTT message in JSON format.
2022-02-27 14:07:24 -08:00
Dean Cording
357ea6bcc7 Added option to send data as a single MQTT message in JSON format. 2022-02-27 22:03:31 +10:00
sparky8512
09b8717131 Tweaks/fixes mostly related to --poll-loops
Adjust how the --poll-loops option handles the first set of polled loops for history stats, to make that set of data run against a number of samples (and therefore total time interval) that more closely matches subsequent sets of polled loops. This especially applies to the case where the stats are resuming from a prior counter, where without this logic, the first set had an unintuitively large number of samples.

Fix timestamp reporting for history stats to better reflect the actual accumulated data, for cases where later polls of the history data had failed. This introduced the potential for the status data and the history stats data to have inconsistent timestamps, and required the timestamp collection to be moved from the individual output scripts into dish_common. Rather than deal with the complication this would create for CSV output, where there is only 1 timestamp field, just disallow the combination of options that could result in different timestamps (For CSV output only).

Fix an error case where poll loop counting was not being reset correctly.

Fix explicit --samples option to be honored when resuming from counter for history stats.
2022-02-20 13:39:07 -08:00
sparky8512
c0f7dd5096 Remove samples option default
Stop pretending 3600 is a meaningful default for the --samples command line option. That hasn't been the case since the history buffer was reduced to 900 samples.

The default behavior if loop interval not set is now to process all samples, which was what effectively what it was doing, anyway.
2022-02-20 10:36:09 -08:00
sparky8512
9ca1a8a51c Remove valid check from obstruction status data
Remove the validity check that was gating the reporting of the obstruction_duration and obstruction_interval data items.

When that got added to the grpc protocol, I assumed that the valid flag meant whether the other 2 fields were useful data. That may actually have been the intent, for all I know, but I've never seen that flag report true. However, I also never saw the banner in the app telling me I would get obstructions every X minutes, either. That is, until a few weeks ago, probably due to a dish firmware change. Now I see the app reporting this data, so it must be ignoring that valid flag, or at least not using it for that purpose.

Probably nobody cares about this data (including me), given that nobody ever complained about it always reporting empty values, but I don't want to remove it and mess up db schemas, so it might as well be populated.
2022-02-19 16:16:54 -08:00
sparky8512
32567059b8 Resume from counter for history stats CSV output
Add an option to output to a specified file instead of standard output (which is still the default), and if set, attempt to read prior end counter for use in resuming history stats computation at that point. This behavior can be disabled using the --skip-query (-k) option.

Resuming will only work for CSV files that start with a header line that matches the last line in the file, and is currently only enabled for history stats, not bulk history, because the file read operation is not at all optimized for large files. (And because I don't think anyone is really using CSV for recording bulk history data, I only implemented that because it was easy to do so and helps with testing.)

While testing this, I realized that the implementation of the --poll-loops option has an awkward interaction with resuming from prior counter value, but that impacts all the scripts that support resuming from counter, so I will address that in a subsequent change.
2022-02-19 15:51:46 -08:00
sparky8512
0225a9783c Various fixes to the InfluxDB 2.x script
This should address all the comments I dropped onto pull request #37.

The only significant fix here is that the SSL command line options should all work now, although slightly differently than how they work in the InfluxDB 1.x script. Whether or not SSL is enabled is controlled by the URL, specifically whether it is an https: URL or an http: one, and the options just control the CA cert parameters.
2022-02-19 15:33:58 -08:00
sparky8512
52dc5ec79d Document new alert added in most recent firmware 2022-01-20 14:07:40 -08:00