March 10th, 2024: The style guide has had an overhaul to make it easier to understand! Please check what's changed, and chime in with feedback so that our wiki can continue to improve.

Weather Station

Weather Station
Type Plugin
Developer(s) Zichqec
Language(s) English
Release date February 1st, 2022
Download

Weather Station is a plugin by Zichqec, which provides weather data for all open ghosts, and a menu for the user to view all weather data directly. The plugin uses information from weatherapi.com, which it processes and distributes as needed to ghosts.

Weather Station is able to provide a variety of information, including current weather type, temperature, humidity, wind speed, cloud cover, chance of rain/snow, pressure, sunrise/sunset times, moonrise/moonset times, and much more. All of this data is available in imperial units and metric units, where applicable.

This plugin is written in YAYA.

User Information

The plugin must be set up when it is first installed by entering a location. This may be done from the settings menu. A search box will open, and the user may type in the name of their city, or search by zip code if in the USA, postcode if in the UK, or postal code if in Canada. The plugin will return a list of search results, and the user can pick the one closest to their location. The user may also choose whether the data should be displayed in imperial units or metric units. The location can be changed or removed at any time from the settings menu.

Additionally, there is an option to allow ghosts to see location data. This option is recommended to be left off, for privacy.

Once this setup is complete, the user may simply let it be. Weather Station will run any time that SSP is opened, and will update the weather data every hour and automatically inform all open ghosts of the new data. Any ghosts that are set up to receive this data should get it automatically, unless the developer of that ghost has added extra setup on the ghost's side. The ghost's information should be consulted in this case.

If the user wishes to view the weather data themselves, they can open the plugin menu for the current weather and air quality data. There are also menus for astronomy data, which includes the sunrise and sunset times, moonrise and moonset times, and the phase of the moon; forecast data, which can be viewed as a daily forecast or an hourly forecast, for up to 2 days in the future; and a weather alert menu, which is only available if there are currently any weather alerts.

Developer Information

Setting up a ghost to accept weather data is simple. All it needs to do is implement one or more of the events used by the plugin, and also implement the OnWeatherStation.Error event to clear the data in the case of an error.

The following events are available:

  • OnWeatherStation.Weather - The data for the current weather
  • OnWeatherStation.Astro - The current astronomy data
  • OnWeatherStation.Alerts - The current weather alerts
  • OnWeatherStation.Forecast.Day - The forecast data for the specified day
  • OnWeatherStation.Forecast.Hourly - The forecast data for each hour of the specified day
  • OnWeatherStation.Error - Error information if the weather data cannot be gathered

Of these events, only OnWeatherStation.Weather is sent automatically. It is sent every hour, and every time a ghost boots.

OnWeatherStation.Error will also occur on its own, if an error is encountered while processing any other event.

Otherwise, each of these events must be called manually via \![raiseplugin]. For example: \![raiseplugin,Weather Station,OnWeatherStation.Astro] would return the astronomy data for the current day.

For the Astro and Forecast events, an extra argument can be added at the end. 0 for the current day's data, 1 for tomorrow's data, and 2 for the day after tomorrow's data. If it is omitted, the current day's data will be given.

Each of these events contains a lot of data, and the developer can pick and choose which information they want from each event. See Weather Station on Ukadoc for the list of references for each event. The references may also be found within events_reference.txt inside Weather Station's folder.

Example Implementation

Below is a simple implementation that gathers a few bits of weather data. Note that this is set up specifically for YAYA.

Click to reveal example.