Commit graph

217 commits

Author SHA1 Message Date
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
sparky8512
8655f75bab Record stats from polled data on script shutdown
If there was history data collected via the --poll-loops option, but not yet used to compute history stats, do so on script shutdown. This should reduce the amount of data lost when the script restarts, for example to reboot the system on which it runs, since --poll-loops allows for collection of history data beyond the 15-minute buffer size the dish (currently) holds.

This will only work if the script is shut down via SIGTERM or SIGINT (for example, by interrupting with Control-C).
2022-01-20 14:07:09 -08:00
sparky8512
7dbb47ab40 New utility script to record dish protocol data
Not really Starlink specific, and pretty much redundant with similar functionality in grpcurl, but more appropriate for running periodically, as it will use a filename that should be specific to the protocol data content, so old data will not be overwritten when there is new data available.
2022-01-20 14:04:46 -08:00
sparky8512
0ace643acc A few more updates related to the new script
Add the  Python packages required for the InfluxDB 2.x client to Dockerfile, at the specific versions that I tested with. Most of the package dependencies overlap with the InfluxDB 1.x client package, so there was not much added.

Note the new script name in the relevant parts of the README.
2021-11-26 15:34:51 -08:00
sparky8512
abd63c2225 Correct a few cosmetic copy/paste errors
Noticed while reviewing the new InfluxDB 2.x script, which was derived from this one.

Also, denote this script as being for InfluxDB 1.x, since there is now a separate script for 2.x.
2021-11-26 14:58:50 -08:00
sparky8512
5b6521a51c
Merge pull request #37 from derpeter/main
add native support for influxDB 2.0 / Dashboard for influxDB 2.0
2021-11-26 14:36:24 -08:00
Peter Hasse
acca52ce75 added grafana dashboard for influx2 2021-11-26 11:02:51 +01:00
Peter Hasse
6fc08ec277 updates systemD unit 2021-11-26 11:02:33 +01:00
Peter Hasse
d8cf8c6a7f updated readme for inlfuxdDB 2.x 2021-11-26 11:02:16 +01:00
Peter Hasse
5d47274cdc small changes on systemd unit 2021-11-24 18:14:51 +01:00
Peter Hasse
f303f28209 added simple systemd unit 2021-11-24 17:26:57 +01:00
Peter Hasse
08ebefcb6e revert from utc to local time 2021-11-24 17:26:40 +01:00
Peter Hasse
0471a2d6e1 updates requirements for influx2 2021-11-24 15:09:03 +01:00
Peter Hasse
5905fb00f9 initial commit influxDB 2.0 client 2021-11-24 15:06:36 +01:00
sparky8512
859dc84b88 Documentation updates
A bunch of content from the README and get_history_notes.txt has been moved to the Wiki, as it is not critical to understanding how to install or use the scripts.

Move the checked in Grafana dashboard into a subdirectory in a feeble attempt to encourage other people to submit more of them.

Change the officially supported Docker image to the one published to GitHub Package repository by this project's workflow task.
2021-11-08 20:10:39 -08:00