How to Set Up a weather and stocks server
Last updated: 04/11/2024
This tutorial will walk you through the steps to self-host weather and stocks services for your legacy devices. Keep in mind some of the projects used in this tutorial aren't mine.
This tutorial is for windows servers but if your on Linux you should still be able to mostly follow along. Lets get started:
Prerequisites
Prerequisite 1: OpenWeatherMap API key
Getting an OpenWeatherMap API key is simple and free.
Step 1:
Go to openweathermap.org and sign up for an account.
Step 2:
Once you've made an account and are on the dashboard, click on the Billing Plans tab.
Step 3:
Now in Billing Plans click subscribe for One Call API 3.0 and input all appropriate payment and location data.
Step 4:
You can edit the max number of calls per day to 999 so you don't exceed the 1000 free calls.
Step 5:
Now navigate to the API keys tab and create a key by naming it and then hitting generate.
You should now see you key. Keep this for later.
Prerequisite 2: Location Data
A file geoplanet_places_7.10.0.tsv is required for the server.
Go to here and download geoplanet_data_7.10.0.zip.
Prerequisite 3: Python and other software
Install python then using command prompt run this command.
pip install Flask sentry-sdk requests iso3166 geopy cachetools yfinance feedparser
Prerequisite 4: Server
You need to port forward or proxy the server for port 8000.
You also need a server and internet.
Installing the server:
Step 1: Install server files from github
From here download the server files. They have been modified to work better with my tweaks and also fix some stocks issues and other bugs.
The original server was made thanks to electimon and Obscure Mosquito. You can access the original server from here.
Step 2: Extract server files
Extract all of the contents of the zip and the geoplanet_data_7.10.0.tsv into a folder.
Your folder should look like this.
Step 3: Generating Database
Now with the server file and geoplanet_data_7.10.0.tsv in place run genDatabase.py.
A command prompt should show up for a breif period of time (depending on your servers performance) then a geoDatabase.json should have been created.
Your folder should look like this. Also take note of the geoDatabase.json file, it shouldn't be 0kb.
Step 4: Inserting API Key
Now in the file Weather.py change "sys.argv[1]" to the API key you got earlier from OpenWeatherMap (or if you want to use arguments at startup you can do that). Also include quote marks around the API key.
Step 5: Starting the server
The server can now be started!
Once the server is started it will be using port 8000 for communication.
Setup on legacy device:
Best method: Waiting
I've heard that a tweak that allows for custom urls is being worked on. (Not talking about NDBX, I stopped working on that lol)
Easy method: NDBX
Before you install!
My tweak which allows you to input your own urls is a bit buggy. The notification centre widget for weather doesn't work and the weather icons are messed up in the hourly report.
Messed up icons don't show up on 3.5" version of the weather app.
This tweak has only been tested on an iPhone 5, iPhone 4s and iPad mini 1 all running on iOS 6. So use at your own risk.
Step 1: Install NDBX
Add my repo to cydia and install NDBX.
Here is the source code if you want to check the code. NDBX
Step 2: Configure NDBX
In settings navigate to NDBX and insert the weather and stocks urls.
Hard method: NDBWeather and NDBStocks
This is going to be a simple overview of what to do because it would take an extreme amount of time to explain all of it.
Before you install!
The only issue with these tweaks is that the notification centre weather widget doesn't work.
These tweaks have only been only on an iPhone 5, iPhone 4s and iPad mini 1 all running on iOS 6. So use at your own risk.
Step 1: Download linux
Yep. It is linux time!
Download linux and either start up a virtual machine(suggested) or partition your drive or use another computer. Doesn't matter what you do as long as you have linux.
Step 2: Download and install theos
Follow the guide on how to install theos.
Step 3: Download the source code
Download the source code for NDBWeather.
Download the source code for NDBStocks.
Step 4: Replace
In the source code replace my url with your own.
Step 5: Make
Use the make package command to make a deb for each project.
Step 6: Install
Install on you legacy device and enjoy.
Additional Resources
If I missed something or there is an issue somewhere, email me. ([email protected])