Giter VIP home page Giter VIP logo

starlink-graph's Introduction

starlink-graph

Show Starlink stats in a nice graph in an app instead of using a web browser. It has been tested on linux and MacOS.

Important Information!

The database has changed in this version!

If you don't care about the history then you can just remove starlink-history.db.

If you want your history then:

  • Stop any currently running version
  • Run python convert_database.py to convert the database
  • This can take serveral minutes to run depending on the size of your current database
  • The original database will be saved
  • Once converted start the starlink-graph.py again

Prerequisites

You will need starlink-grps-tools from https://github.com/sparky8512/starlink-grpc-tools
Some distributions (Manjaro) do not have matplotlib installed by default. Install it with pip3 install matplotlib or apt install python3-matplotlib

To create the new obstruction animation ffmpeg is required (called directly so no python modules are needed)

NEW: Added experimental usage tracking. The data is saved in a sqlite3 database, so to use the feature sqlite3 must be installed on your system.

NEW: Changed to using SQLAlchemy 2.0 for database access to allow usage with MySQL and other database.

  • Currenly only tested with sqlite3
  • You probably should use a venv!
  • pip3 install 'sqlalchemy>=2.0'

MacOS Notes

Thank you to reddit user u/virtuallynathan for the following information
Use brew to install these packages: cairo, gtk+3, gtksourceview3 gobject-introspection
Use pip3 to install: pyGObject, pychairo, humanize, matplotlib

Optional

The humanize module is used if installed. Install it with pip3 install humanize

Preperation

Copy the example starlink-graph-default.ini to starlink-graph.ini and edit it to change billing_date to the start day of your billing cycle.

Running

Just clone the git and run the script: python starlink-graph.py

If you have the environment variable PYTHONPATH set to include the location of starlink-grpc-tools then the script should run. If you don't have it set you will prompted to select the location of starlink-grpc-tools

Release Notes

  • V 0.2: Removed command line options in favor of having a GUI setting window.
  • V 0.3: Added basic obstruction map
  • V 0.4: Added controls to the obstruction map
  • V 0.5: Added ability to save obstructions history and create an animation from the history
  • V 0.6: No real functional changes, but major code re-factoring and cleanup
  • This branch is experimental!

starlink-graph's People

Contributors

bmillham avatar

Stargazers

 avatar  avatar Deanna avatar Chris avatar Chris Morris avatar Taras Khalimanenko avatar Taras Kalapun avatar Fed avatar Shak Saleemi avatar  avatar Tyler Longren avatar Vittorio Graglia avatar Carlo J. Calica avatar Mike Puchol avatar Mediacast  avatar Joss Reeves avatar  avatar  avatar Sebastian Pincheira avatar Terrance Robotham avatar

Watchers

 avatar John Kane avatar  avatar

Forkers

kcmon md-hexdrive

starlink-graph's Issues

allow more frequent updates of obstructions

Automatically updating the obstructions is currently limited to 10 seconds. Updating more frequently certianly is wasteful of CPU, but it can be very cool to see the tracks of birds update in real time, especially when the terminal has recently been powered on. So I suggest letting it be set to 1 second, which works well in my testing after modifying the code to allow it.


--- a/starlink-graph.glade
+++ b/starlink-graph.glade
@@ -17,7 +17,7 @@
     <property name="page-increment">10</property>
   </object>
   <object class="GtkAdjustment" id="obstructionadjustment">
-    <property name="lower">10</property>
+    <property name="lower">1</property>
     <property name="upper">900</property>
     <property name="value">10</property>
     <property name="step-increment">10</property>

(btw I had to guess what the units are in the config page)

Timezone Issue on MacOS

After cloning and trying to run I get this..

โžœ starlink-graph git:(main) python3 starlink-graph.py
Traceback (most recent call last):
File "/Users/kdekorte/git/starlink-graph/starlink-graph.py", line 290, in
ani = startup()
File "/Users/kdekorte/git/starlink-graph/starlink-graph.py", line 275, in startup
sd.outages()
File "/Users/kdekorte/git/starlink-graph/starlinkdata.py", line 104, in outages
fix = self._gps_to_gmt(o.start_timestamp_ns)
File "/Users/kdekorte/git/starlink-graph/starlinkdata.py", line 65, in _gps_to_gmt
return leapseconds.gps_to_utc(datetime.datetime(1980,1,6) +
File "/Users/kdekorte/git/starlink-graph/leapseconds.py", line 229, in gps_to_utc
return tai_to_utc(gps_to_tai(gps_time))
File "/Users/kdekorte/git/starlink-graph/leapseconds.py", line 219, in tai_to_utc
return tai_time - dTAI_UTC_from_tai(tai_time)
File "/Users/kdekorte/git/starlink-graph/leapseconds.py", line 181, in dTAI_UTC_from_tai
return _dTAI_UTC(tai_time, lambda ls: ls.utc + ls.dTAI_UTC)
File "/Users/kdekorte/git/starlink-graph/leapseconds.py", line 205, in _dTAI_UTC
leapseconds_list = leapseconds()
File "/Users/kdekorte/git/starlink-graph/leapseconds.py", line 91, in leapseconds
raise ValueError('Unable to open any tzfile: %s' % (tzfiles,))
ValueError: Unable to open any tzfile: ['/usr/share/zoneinfo/right/UTC', '/usr/lib/zoneinfo/right/UTC']

not sure why "right" is in the path for the tzfile

error on startup

On Raspberry pi Bullseye


python starlink-graph.py
Traceback (most recent call last):
  File "/home/user/starlink-grpc-tools/starlink_grpc.py", line 1089, in history_bulk_data
    history = get_history(context)
  File "/home/user/starlink-grpc-tools/starlink_grpc.py", line 936, in get_history
    return call_with_channel(grpc_call, context=context)
  File "/home/user/starlink-grpc-tools/starlink_grpc.py", line 582, in call_with_channel
    return function(channel, *args, **kwargs)
  File "/home/user/starlink-grpc-tools/starlink_grpc.py", line 931, in grpc_call
    resolve_imports(channel)
  File "/home/user/starlink-grpc-tools/starlink_grpc.py", line 522, in resolve_imports
    importer.resolve_lazy_imports(channel)
  File "/usr/local/lib/python3.9/dist-packages/yagrc/importer.py", line 335, in resolve_lazy_imports
    _lazy_importer.configure(channel, filenames=filenames)
  File "/usr/local/lib/python3.9/dist-packages/yagrc/importer.py", line 201, in configure
    loaded = self.reflector.load_protocols(channel, filenames=filenames)
  File "/usr/local/lib/python3.9/dist-packages/yagrc/reflector.py", line 113, in load_protocols
    for response in responses:
  File "/usr/local/lib/python3.9/dist-packages/grpc/_channel.py", line 426, in __next__
    return self._next()
  File "/usr/local/lib/python3.9/dist-packages/grpc/_channel.py", line 826, in _next
    raise self
grpc._channel._MultiThreadedRendezvous: <_MultiThreadedRendezvous of RPC that terminated with:
	status = StatusCode.DEADLINE_EXCEEDED
	details = "Deadline Exceeded"
	debug_error_string = "UNKNOWN:Deadline Exceeded {created_time:"2022-09-12T21:21:33.309093606+00:00", grpc_status:4}"
>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/user/starlink-graph/starlink-graph.py", line 223, in <module>
    ani = startup()
  File "/home/user/starlink-graph/starlink-graph.py", line 205, in startup
    sd.history()
  File "/home/user/starlink-graph/starlinkdata.py", line 78, in history
    z = starlink_grpc.history_bulk_data(self._config.history)[1]
  File "/home/user/starlink-grpc-tools/starlink_grpc.py", line 1091, in history_bulk_data
    raise GrpcError(e)
starlink_grpc.GrpcError: Deadline Exceeded


Thanks

obstruction map colors

The color scheme for the obstruction map makes it hard to notice small obstructions, where there may just be a few reddish pixels at the edge of a lot of blue. Especially ones where the red is less saturated.

The starlink-grpc-tools dish_obstruction_map.py color scheme of red/white/black has much higher contrast and works much better.

fails to start when terminal has not been powered on for very long

I powered on my starlink terminal 10 minutes ago, and:

joey@darkstar:~/tmp/starlink-graph#main>./starlink-graph.py 

(starlink-graph.py:156946): Gtk-WARNING **: 11:02:11.930: Content added to the action area of a dialog using header bars

(starlink-graph.py:156946): Gtk-WARNING **: 11:02:26.718: Content added to the action area of a dialog using header bars

(starlink-graph.py:156946): Gtk-WARNING **: 11:02:40.678: Content added to the action area of a dialog using header bars
Traceback (most recent call last):
  File "/home/joey/tmp/starlink-graph2/./starlink-graph.py", line 357, in <module>
    ani = startup()
  File "/home/joey/tmp/starlink-graph2/./starlink-graph.py", line 340, in startup
    sd.history()
  File "/home/joey/tmp/starlink-graph2/starlinkdata.py", line 86, in history
    l = {k: z[k][i] for k in z.keys()}
  File "/home/joey/tmp/starlink-graph2/starlinkdata.py", line 86, in <dictcomp>
    l = {k: z[k][i] for k in z.keys()}
IndexError: list index out of range

Setting history = 10 in starlink-graph.ini worked around this problem. It was 900, and I guess it expects to be able to pull 900 seconds (15 minutes) of history, which it cannot when the terminal has not been on that long.

obstruction map auto-update

I expected the obstruction window to automatically update, but reading the code I see that's not the case, and I have to click on the menu entry, which will update it (in place).

So, it seems like it would be easy to have it auto-update when the window is visible. This would be a great feature to be able to watch the tracks develop in real time, especially after boot.

window does not get painted when starlink is powered off

I power my starlink terminal off overnight to save power, and I noticed that, when it's powered off, starlink-graph's window does not get painted, at all.

When it's in this state, this gets output on the console:

Not connected: UNKNOWN@2022-08-02 10:48:47.159192-04:00
No history returned
Not connected: UNKNOWN@2022-08-02 10:48:53.393420-04:00
No history returned

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.