Comments

15 comments

  • Avatar
    Michael P

    Manual route update through the dashboard is a major annoyance. Automatically flowing to the dashboard, or being able to refresh and pull routes from the Karoo itself would be a massive help.

    0
    Comment actions Permalink
  • 0
    Comment actions Permalink
  • Avatar
    Martijn

    I’m going to setup my home automation to trigger the route refresh when my Karoo connects to my WiFi.

    0
    Comment actions Permalink
  • Avatar
    Anna Ronkainen

    That’s a great idea. Unfortunately it doesn’t solve the problem for me because I almost never use routes in the first place if I start the ride at home (i.e. turn the Karoo on within reach of my home wifi), but I guess I could just as well trigger the route refresh always once every few hours during the daytime. Now how do I do the refresh from a crontab with wget (or whatever)...?

    0
    Comment actions Permalink
  • Avatar
    Martijn

    Use this script in crontab::
    https://gist.github.com/spoetnik/ebeb9b6a62601643e5f25bc351fb47f7

    1
    Comment actions Permalink
  • Avatar
    Anna Ronkainen

    That’s perfect, thank you so much! For now I have it running 5 times per day, will change to hourly if it turns out that is not frequent enough. (I would hope that I can remember to do the refresh manually if I am actually planning a route right before the ride, but usually it’s with routes I’ve planned the night before (or earlier) that I forget it.)

    0
    Comment actions Permalink
  • Avatar
    Benjamin Hendler

    @Anna and @Martijn could you explain a bit more how you did and where? Great job btw!

    0
    Comment actions Permalink
  • Avatar
    Anna Ronkainen

    I have an always-on Linux machine (that I primarily use for watching tv...) so I just used cron (a system for running commands automatically on a predefined schedule) on it to run Martijn’s script (with appropriate modifications). Cron is available on macOS as well if you’re comfortable with using the command line, no idea how you would do the same on Windows.

    0
    Comment actions Permalink
  • Avatar
    Benjamin Hendler

    Thank you for the reply. I tried to implement it on my raspberry pi but couldn't get the script to work. Get the error  "Couln't connect to server, jq: error (at <stdin>:1): base64d is not a valid format". What changes did you do to the script beside username and password?

    0
    Comment actions Permalink
  • Avatar
    Anna Ronkainen

    No other changes (except adding the -s option to curl even though my crontab just discards the output).

    What do you get with "jq --version"?

    0
    Comment actions Permalink
  • Avatar
    Martijn

    I think jq is not installed on very minimal versions of linux, like on your raspberry PI

    Maybe these instructions could help you install jq, and let you have a working update script: https://lindevs.com/install-jq-on-raspberry-pi

    jq is a little commandline tool to process the JSON response from the hammerhead dashboard

    0
    Comment actions Permalink
  • Avatar
    Martijn

    I updated my script, and added the ' -s' option to the curl-command.

    And cleaned up some double code

    https://gist.github.com/spoetnik/ebeb9b6a62601643e5f25bc351fb47f7

    0
    Comment actions Permalink
  • Avatar
    Benjamin Hendler

    Thank you Anna and Martijn. I tested with the updated script and get the same error. jq --version gives the version jq-1.5-1-a5b5cbe

    file is saved as a .sh file and run with the bash command when testing.

    0
    Comment actions Permalink
  • Avatar
    Anna Ronkainen

    My version is jq-1.6, no idea if that makes a difference though... Other than that, my first bet would be a typo (or equivalent such as copy-paste corruption or download conversion error) somewhere in the script. Guess you’ll just have to debug the script yourself, I’d add lines like echo $token after each variable assignment to see exactly where it goes wrong. (Just don’t post the output here.)

    0
    Comment actions Permalink
  • 0
    Comment actions Permalink

Please sign in to leave a comment.