SkyWeather2 Installation Guide

In a previous post, I raved about the SwitchDoc Labs SkyWeather2 KickStarter project. When you purchase the kit, there is an option to buy an SD Card with all the required software installed. I passed on it, and cloned the SkyWeather2 software from Github.

To get it all working, I had to sort through all of the dependencies. This took time.

As far as I know, there is no documentation anywhere that describes how to get the SkyWeather2 system up and running from scratch. So – Ol’ Sopwith decided to do something about it.

I created a bash script that installs all of the required application and Python module dependencies. In addition, I wrote a detailed 18 page “How-To” guide.

Hopefully, this makes it easier to get your SkyWeather2 up and running if you choose the DIY route.

Sopwith

27 thoughts on “SkyWeather2 Installation Guide

  1. Hello Sopwith
    I dare to bother you again with a question.
    I tried updating my SkyWeather2 software to version # 25 a few days ago using the commands listed by SDL in the SkyWeather-forum.
    But I got the following error after “git pull”:

    Updating 983d208..ab73ae3
    error: Your local changes to the following files would be overwritten by
    merge:
    SkyWeather2.py
    dash_app/index.py
    dash_app/status_page.py
    dash_app/weather_page.py
    Please commit your changes or stash them before you merge.
    Aborting

    On the Skyweather forum, “BP” informed me that the error was a result of making changes to my local software copy and needing to backup and reinstall. Or that I have “to merge my changes”.
    I have indeed adapted a few python files so that the titles in the dashboard are in Dutch.
    I have also modified the BMP280.py file so that the air pressure in hPa is correctly calculated (was a factor of 10 too small).
    I would rather avoid a new install because in the meantime I have also installed mosquitto, Node-Red, InfluxDB and Grafana on my SD-card, but I don’t know enough linux to know how to handle such a merge.
    On the forum “tecronin” let me know that I can do “git stash” and then “git stash pop”.
    Is this also your opinion?
    For the update, do I also need to enter the following commands after “git stash” and “git stash pop”:
    git pull
    sudo pip3 install vcgencmd
    sudo mysql -u root -p <WeatherSenseWireless.sql
    sudo mysql -u root -p WeatherSenseWireless <updateWeatherSenseWireless.sql

    I hope you can help me again.

    Thank you.
    Hervé

    • Hi Herve,

      It looks like git has identified four (4) files that are in conflict between the new SkyWeather2 code and your custom changes.
      I am not a git expert, but my recommendation is to first examine the differences in each file. I know git can tell you this, but
      I prefer to use a visual diff tool. For Windows I prefer Windiff, and on Linux I use meld. Any diff tool will work.

      When you run a diff on each file (Yours and V.025) you can see the extent of changes. I am guessing the diffs will be small and easy to manually merge. If the diffs are large, then I suggest you have one of the git experts walk you through the stash/pop process.

      Please let me know what you find.

      Sopwith

      • Hello Sopwith
        Yesterday I tried to find the differences between the 025 files and the corresponding files in my running SkyWeather2 – version 024. I used WinMerge (https://winmerge.org/?lang=en) for that. There were only minor differences and I was able to update them using WinMerge. But despite that, when trying to install version 025 again, I got the same error message that you could see in my previous post …
        But luckily I still had a backup of the old files that I installed via your Installation Guide v.1.0. When I started using it, the update to 025 was successful!
        Now everything is running perfectly and my processing of the data in Node-Red via MQTT, InfluxDB and Grafana also works perfectly.
        I want to thank you again for your valued support!
        Hervé
        Hoeselt – Limburg – Belgium

  2. Camera images not showing up on the dashboard. There were no error messages when I ran the camera test. Alas, there’s no image on the dashboard. AS I track the dash_app on the terminal, t gives the following information:

    updateSkyCamImage 2021-04-13 20:42:07.784009 102
    +++++++value= Div([Img(height=350, src=’/assets/skycamera.jpg?’, width=619.5), Figcaption(‘/assets/skycamera.jpg?’)])

  3. If you’re working on updating this excellent guide, under step 12, testing the temperature, for me, at least, I had to enter:
    sudo python3 testBMP280.py
    What it shows is:
    sudo testBMP280.py
    I hope you get something out of this from SwitchDoc. This is a really valuable thing you’re doing.

    • Mike,

      Thanks for pointing out this error. I have updated the How-To guide so others do not have the same issue.

      Sopwith

  4. Thanks so much for your gracious work on this project. I’ve appreciated it greatly. I’ve gotten to your instructions to create databases on pages 7, 8 but am seeing an error:
    pi@skyweather:~/SDL_Pi_Skyweather2 $ sudo mysql -u root -p < SkyWeather2.sql
    Enter password:
    pi@skyweather:~/SDL_Pi_Skyweather2 $ sudo mysql -u root -p < WeatherSenseWirelss.sql
    -bash: WeatherSenseWirelss.sql: No such file or directory

    I've rerun the instructions three times. I see that there are 4 databases created:
    SkyWeather2
    information_schema
    mysql |
    performance_schema

    Any suggestions? Thank you. I realize that your time is valuable and there's no obligation to assist.

    Mike Davis

    • Mike,

      There is a typo in the guide that is tripping you up. Missing an ‘e’ in the word Wireless.

      $ sudo mysql -u root -p < WeatherSenseWirelss.sql Shoud be: $ sudo mysql -u root -p < WeatherSenseWireless.sql Sorry about the confusion. I will update the guide. Sopwith

  5. E: unable to locate package librtr-dev

    error message: –error installing librtr-dev

    installed synaptic package manager and couldn’t find librtr-dev as an available package any clues on how to get the pi to see librtr-dev?

  6. Hello Sopwith
    Yesterday I thought my problems were solved, but unfortunately that is not the case…
    I keep having problems starting up my SkyWeather2 after rebooting via rc.local.
    When I start SkyWeather2.py and index.py via the command line in Putty, everything runs normally: in the dashboard I see green LEDs and the weather data are being refreshed.
    But when I reboot my RPi nothing works anymore.
    When check with
    ps ax | grep index.py | grep -v grep
    and
    ps ax | grep SkyWeather2.py | grep -v grep
    or with
    ps -aux | grep python
    I don’t see anything appear. So Ik think those python files are not started.
    I no longer know how to proceed with this.
    And as long as I can’t fix this, I can’t get my SkyWeather2 to a final location.
    For my RPi I use Buster as OS. Could it be that my rc.local does not work in Buster
    To be clear, this is my rc.local:
    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will “exit 0” on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.
    # Print the IP address
    _IP=$(hostname -I) || true

    if [ “$_IP” ]; then
    printf “My IP address is %s\n” “$_IP”
    fi
    cd /home/pi/SDL_Pi_Skyweather2
    nohup sudo python3 SkyWeather2.py &
    chmod 666 nohup.out
    cd /home/pi/SDL_Pi_SkyWeather2/dash_app
    nohup sudo python3 index.py &
    chmod 666 nohup.out

    exit 0

    I hope you can give me a hint on how to proceed.
    Hervé

  7. Hello Sopwith
    Eureka! Suddenly it now seems to work!<
    Although I have not changed anything, after a reboot I can start the dashboard and the weather data are updated.
    I'm now going to reboot a few more times and check if the situation remains stable.
    I will keep you informed, but I would like to thank you already very much for your help and the time you have invested in it.
    Maybe I can contact you later, because I am now going to try to process the JSON via MQTT and Node-Red in InfluxDB and Grafana, because I find the Skyweather graphs don't seem very neat copared to Grafana.
    Best regards
    Hervé
    Hoeselt – Belgium

  8. Hello
    As I already informed you, with the help of your installation guide everything went without a hitch and all tests went well. But when compiling the rc.local file, things go wrong. I hadded the instructions as described on page 17 of your guide and on the advice of a member of the SkyWeather-forum I have also added the following:
    cd / home / pi / SDL_Pi_SkyWeather2 / dash_app
    nohup sudo python3 index.py &
    chmod 666 nohup.out
    However when I do a reboot and try to open the dashboard with
    192.168.1.115: 8050 (my RPi4’s IP address is 192.168.1.115) then I get: “This site is unavailable”.
    Could anything else be wrong?
    When I start SkeyWeather2.py via the command line with
    sudo python3 SkyWeather2.py
    I see that data is indeed stored in the MySQL database. I don’t really know what to do anymore … I hope you can give me a hint

    • Herve,

      I suggest you first make sure the app dashboard works. From your SkyWeather2 Pi terminal, type the below commands:
      $cd /home/pi/DSL_Pi_Skyweather2/dash_app
      $sudo python3 index.py

      You should see some text telling you the web service is running on http://0.0.0.0:8050.
      Open a browser on another computer and enter address: http://192.168.1.115:8050
      You should see a SkyWeather2 dashboard appear. Click on the ‘SkyWeather Status’ page and there should be some green LED’s lit if there is weather data in the database.

      If you get this far, then you know your system is configured correctly. If you do not see green LED’s or cannot get the web service to work – let me know.

      As far as the rc.local file, in your above text, you have spaces in the cd path (cd / home / pi / SDL_Pi_SkyWeather2 / dash_app).
      Make sure the first line is: cd /home/pi/SDL_Pi_Skyweather2/dash_app
      You also have the SDL folder name wrong. It should be “SDL_Skyweather2” not “SDL_SkyWeather2” (Need a small w, not a big W).

      If this is what is in the rc.local file, the service will never start. Fix your rc.local file and reboot.

      Try these tips and let me know if you have success. I know this can be frustrating, but you are real close to getting it running.

      Sopwith

      • Dear Sopwith
        I can open the dash-app, but I do not see green LEDs in the SkyWeather Status page.
        In the Weather tab I see old data (Weather Updated at:06-Apr-2021 17:44:03).
        In my Putty Terminal is see scrolling:
        192.168.1.133 — [07/Apr/2021 01:10:43] “POST / dash-update-component HTTP/1.1” 204 –
        On the webpage tab is see Dash alternating with Updating, but I do not see any change in the weather data.

        • Herve,

          Here are a couple of things to check.
          1) Make sure you have database logging turned on.
          $cd /home/pi/SDL_Skyweather2
          $sudo python3 SkyWeatherConfigure.py
          From a browser, go to http://pi_ip_here:8001
          On the main page, make sure “enable MySQL Logging” checkbox is checked and the word “password” without quotes is in the text box just below it.
          Click

          2) Run the dash_app service again and look for the green LED’s. on the status page. I have a green LED beneath the WeatherRack2 text and another one below the Channel 1 text.
          The green LED’s will only appear if the service can access the MySQL database and the database contains data.

          Just to be clear. There are TWO services that must be running on the Pi for this to work.

          1) The SkyWeather2.py script collects the weather data from the WeatherRack2, and the indoor thermometer, and puts it in the database IF database logging is enabled. If database logging is not enabled, then the dash app will not have any data to display. This script must be running all the time.

          2) The dash_app web service must be running (index.py) for you to access your historical weather data in a browser. The app reads data from the database and displays it.

          In your earlier post, you showed that you were starting the dash_app from your /etc/rc.local.
          In the SkyWeather2 docs this is what should be in your rc.local file:

          cd /home/pi/SDL_Pi_SkyWeather2
          nohup sudo python3 SkyWeather2.py &
          chmod 666 nohup.out

          NOTE: These entries start the SkyWeather2.py script (the collector), not the dash_app.
          (It appears you are trying to run the dash_app without running the collector)
          To run the dash_app at startup, add these lines below the chmod line in your rc.local
          cd /home/pi/SDL_Skyweather2/dash_app
          sudo python3 index.py

          So your additions to the rc.local file should look like this:

          cd /home/pi/SDL_Pi_Skyweather2
          nohup sudo python3 Skyweather2.py &
          chmod 666 nohup.out
          cd /home/pi/SDL_Pi_Skyweather2/dash_app
          sudo python3 index.py

          Also, make sure the “exit 0” line is the last line in the rc.local file.

          Finally, you must run the SkyWeather2.py script for a while before data starts showing up in the database. It only writes data to the database every 30 minutes or so.

          Sopwith

          • Hello Sopwith
            I have followed all your instructions but my problem is still not solved. I have sent you an extensive report by e-mail of all the steps that have been taken. I added multiple screenshots. I hope we can find a solution anyway …

  9. Hello
    My Skyweather2 package arrived last week and I am very happy with your very clear installation guide: “it works out of the box – what fun is that!”. I am now going to try to get the JSON in Node-Red via MQTT. That will take me a lot of effort, because I am not an experienced programmer. If you have any tips for me in this regard, they are certainly welcome!
    Best regards
    Hervé Tavernier

    • Herve,

      It is fairly easy to get Node-Red (MQTT) working with SkyWeather2 data. I was able to get it up an running quickly.
      You need to get a Node-Red server up and running and configure the topic you want to use. Then you need to tell SkyWeather2 what MQTT topic and the location of the Node-Red server. This is done in the SkyWeather2 configuration dashboard.

      Node-Red is quite popular with the SkyWeather2 users, so you should be able to get good advice in the SkyWeather2 support forum.

      Sopwith

  10. The Raspberry Pi Foundation has released new Pi OS images this month (March 4, 2021).
    I have tested the new image with my SkyWeather2 installation script and it works fine. No changes required.

    If you are going to use the installation script, please use the latest Pi OS image.

    Also, be sure to update the image upon first boot – BEFORE you run the SkyWeather2 install script.
    $ sudo apt update
    $ sudo apt upgrade -y
    $ sudo reboot

    Sopwith

Leave a Reply

Your email address will not be published. Required fields are marked *