WxCenter

by Craig Hendricks
codefenix@conchaos.synchro.net

ConstructiveChaos BBS:
codefenix@conchaos.synchro.net  
 telnet://conchaos.synchro.net  
  https://conchaos.synchro.net  



Description:

This is a weather forecast viewer for Synchronet BBS. It makes use of several
different online APIs to retrieve weather forecast data for any specified
location and displays it to the user using an ANSI presentation.

If there's an active alert in the forecast area, a brief description is
shown, with the option to display the details.

It's also capable of displaying regional weather maps in SIXEL, using the
optional Digital Showroom module.

This mod was inspired by syncWXremix https://github.com/KenDB3/syncWXremix,
which was rendered inert with the phasing out of the free Weather Underground
API.



How it works:

WxCenter uses the following APIs to retrieve its data:

 Geolocation:
 - Ip-Api.com:  Geocoding for IP addresses
 - Open-Meteo:  Geocoding for cities
 
 Weather Forecasts:
 - Weather.gov: Primary weather & alert API for US locations
 - Open-Meteo:  Secondary weather API, used in case the primary API call
                fails, or if the location is non-US

Either Weather.gov or Open-Meteo can be configured as the preferred API by 
the sysop. WxCenter will optionally try to get forecast data from the other 
API if the call to the preferred API fails.

Imperial units are always used for US locations, and metric units are used for
international locations (with the opposite unit type shown in parentheses).



Instructions:

 1. Extract the contents of the ZIP file to /sbbs/xtrn/wxcenter

 2. Add to SCFG -> External Programs-> Online Programs (Doors):
    
    Name                  WxCenter
    Internal Code         wxcenter
    Start-up Directory    ../xtrn/wxcenter
    Command Line          ?wxcenter.js
    Execution Requirements   ANSI
    
    At this point, WxCenter is ready to show forecast data for all locations 
    in the world.

 3. OPTIONAL: To enable viewing regional weather maps in SIXEL, install
    Digital Showroom (dsr). Once it's installed, make sure to set the 
    pathToSixelViewer in the wxcenter.ini file so it correctly points to 
    the path where it's installed.

    pathToSixelViewer = ../xtrn/dsr/dsr.js

    If it was installed correctly, the "M" option will appear on the WxCenter
    main menu to let users access the weather map submenu.

    The wxmaps.json file comes pre-configured with a selection of publicly
    accessible map image resources. Image resources may be added or removed
    from this file as desired.



Configuration and Customization:

Configure the following additional options in wxcenter.ini to your liking:

    * systemLocation         This lets the sysop enter a valid location name
                             in case the system specified one in SCFG is
                             something invalid (e.g.: Anytown, USA). The
                             recommended format is "City, State, Country"
                             (e.g.: Canton, OH, USA). If this is left blank,
                             the system.location value is used by default.

    * preferredSource        This allows the sysop to specify whether which
                             API to use as the primary source. Acceptable
                             values are PRIMARY for Weather.gov or SECONDARY 
                             for Open-Meteo. If this is left blank, PRIMARY
                             is used by default.

    * useOtherSourceOnFail   This tells WxCenter to call the other API in
                             the event that that an error is encountered
                             when calling the preferred one (e.g.:
                             temporarily offline). Acceptable values are
                             true or false. If his is left blank, the
                             default setting is true.

    * verboseLogging         This logs all informational messages (non-error
                             and non-warning) to the Terminal Server log.
                             Useful for troubleshooting, as it logs all API
                             calls and location data used at the time the
                             calls were made. Acceptable values are true or
                             false. The default setting is false if it's
                             left blank.
                             
    * theme                  Name of theme directory. Described in detail
                             below:
                             
WxCenter includes a few different ANSI themes located in the /gfx/themes
subdirectory. Pick the one you want by editing wxcenter.ini and setting the
value of theme to the name of the desired subdirectory. A preview PNG image
is given for each one. Of course, you can also add your own themes to suit
your BBS's personality. It may take some trial-and-error to get them to look
suitable in the terminal.

Edit the included wxcenter.msg, info.msg, and sixelmaps.msg files in the
/gfx subdirectory to your liking in PabloDraw.

* wxcenter.msg:  This is the main title screen, the first thing the user
                 sees on startup.

* info.msg:      This is shown to the user when the user presses "A" to
                 view information about WxCenter.

* sixelmaps.msg: This is the SIXEL weather map image submenu header.



Other Notes:

APIs come and go. Some are free, and others require paid subscriptions to use.

Weather.gov was chosen as the primary API because it is a publicly available,
authoritative source of weather data in the United States. However, since it 
does not provide weather data for regions outside the US, a secondary source
was needed. This is where Open-Meteo comes in.

WxCenter will only ever be as good as the APIs it's calling. In other words, 
when one changes significantly or shuts down unexpectedly, this mod will cease
to function as designed.

That said, I will do my best to keep up with any API changes, but I make no
guarantee that the script will work forever.

The latest version of WxCenter will always ne available on ConstructiveChaos BBS
at conchaos.synchro.net. The old versions should be considered outdated and for 
that reason are no longer available on Github. 
  


Version History:
   
v 0.250523 - May 23 2025:

  + WxCenter has been reworked to use Open-Meteo for international weather
    forecasts instead of OpenWeatherMap.org. 
    