KenyonWX is a Next.js app to display desired weather data from a weather station connected to your WeatherLink account in a clean, simple fashion.
KenyonWX was built using:
- Memcached (v1.6.14+)
- Next.js (v13.4.0+)
- Tailwind CSS (v3.3.0+)
It is easy to get a copy of KenyonWX running locally.
In order to run KenyonWX locally, the following will need to be installed on your development environment:
- Next.js (required)
- Next.js is required to run KenyonWX
- Installation Instructions: https://nextjs.org/docs/getting-started/installation
- npm (required)
- npm is used to manage the packages needed by KenyonWX to run on top of Node.js
- Installation Instructions: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
- Memcached (optional)
- Memcached is a recommended, optional dependency used to cache the API response to prevent an API call from being made on every page visit.
- Installation Instructions: https://devcenter.heroku.com/articles/memcachier#local-usage
This project requires that you have a WeatherLink v2 API Key and Secret.
The WeatherLink Developer Portal outlines how to get your API key at https://weatherlink.github.io/v2-api/tutorial:
To retrieve your WeatherLink v2 API Key and API Secret you can go to WeatherLink.com and visit the Account page at https://www.weatherlink.com/account.
Once on the Account page you can click the Generate v2 Key button to create a new WeatherLink v2 API Key and API Secret.
Navigate to the location on your development machine where you want to place this project's directory and clone the repository by running the following command:
git clone https://github.com/mike-weiner/kenyonwx.git
KenyonWX requires several packages to run on top of Node.js. Those packages can be installed by running:
npm install
This project requires several environmental variables to be set. Before running the project locally for this first time, you must set the necessary variables.
This project assumes that you are running in a development
environment. Ensure that your NODE_ENV
variable is set to development
. If NODE_ENV
is not set on your machine, Node.js defaults to setting NODE_ENV
being set to development
. Read more here: https://nodejs.dev/learn/nodejs-the-difference-between-development-and-production.
If you plan on running this code in a production environment, ensure that all of the project environment variables defined in Set Project Environment Variables are set within your production environment.
The Next.js KenyonWX project requires several additional environment variables. Set the values of these variables:
- Create a file named
.env.local
in the project root directory. - Within the newly created
.env.local
file, add the content found below. Replace any text contained within< >
with your own values.
MEMCACHEDCLOUD_SERVERS="<host>:<memcached_server_port>"
PORT=<desired_webserver_port>
WEATHER_LINK_API_KEY="<your_weather_link_v2_api_key>"
WEATHER_LINK_API_SECRET="<your_weather_link_v2_api_secret>"
WEATHER_LINK_BASE_API_URL="https://api.weatherlink.com/v2/"
WEATHER_LINK_STATION_ID=<your_weather_station_id_from_weather_link_account>
WEATHER_LINK_SUMMARY_URL=<your_weather_station_weather_link_live_summary_url>
When you are ready to run the project locally, navigate to the directory with this repository's code on your local machine.
If you have installed memcached on your local machine, start your local memcached server by running:
memcached
Start the KenyonWX web app by running:
npm run dev
Visit localhost:<desired_webserver_port>/ to view the weather information pulled from your weather station.
You can easily change what weather data is pulled from your WeatherLink weather station by modifying parseWeatherLinkAPIResponse(data)
within /src/utils/weather-link.js
.
You will then also need to update the /src/pages/index.js
view with the updated data that you are pulling from the WeatherLink API response.
Information about what type of weather data is available within the WeatherLink API from different weather stations and sensors can be found here: https://weatherlink.github.io/v2-api/interactive-sensor-catalog.
All contributions are welcome! First, open an issue to discuss what contributions you would like to make. All contributions should be conducted in a feature/
branch as a PR will be required before any changes are merged into the main
branch.
Distributed under the MIT License. See LICENSE.txt
for more information.