User Tools

Site Tools


Starting the Agent

With all of your settings made, it's time to start the Agent. Doing so allows WeatherSnoop 3 to communicate with your weather source. To start the Agent, click the red LED button with the caption “Stopped” located at the top right area of the Agent window's toolbar.

Upon clicking the icon, it will turn green and the caption will indicate “Running”. At this point, all user interface controls such as checkboxes and pop-up buttons are put in a disabled state in the Agent window, as well as other windows. This allows the Agent to run unencumbered.

The Status area at the bottom of the Agent window will provide information on connectivity to your weather source. Depending on your weather source and the settings, the Agent will behave differently when you start it.

IMPORTANT: When the Agent is running, all settings are greyed out. In order to make changes to the Agent's settings, you must first stop the Agent.

Let's take a closer look at how the agent Agent works.

How the Agent Works

The Agent is the intelligent component of WeatherSnoop 3 that understands how to communicate with a specific weather source. It has deep knowledge of both the weather source's various settings, as well as the weather properties that the weather source provides. Essentially, it acts as the interface between WeatherSnoop 3 and the data source.

Although weather sources can vary differently in both their features and the data they provide, there is a set of common steps performed when the Agent is started.

When the Agent is started, it does the following:

  1. Disables all user-interface options. You cannot make changes to the Agent's settings or other windows while the Agent is running.
  2. Captures the current date/time and records it as the time that the Agent was started.
  3. Compares the date/time that the Agent was last stopped to the start of the current day. If the agent was last stopped before the current day, then the day's minimum/maximum values for each property are reset to the value of the property.
  4. Establishes a connection to the weather source.
  5. Sets the weather source's time and date (provided that the source supports it, and that the option to do so is checked).
  6. Performs any other weather source-specific initialization.
  7. Downloads archived data from the weather source (provided that the source supports it, and that the option to do so is checked). The downloaded data is stored in the Site Document database. Depending on the amount of archived data in the weather source and the speed of the connection, this may take a while. During that time, gauges and the weather report are basically frozen, waiting for real time data to be obtained.
  8. Sets the day's minimum/maximum value for each weather property based on the archived data that has been downloaded.
  9. Polls the weather source for real-time data at a specific interval. As real-time data arrives, it is saved to the local database, possibly updates today's minimum and maximum values, and shared among the configured sharing services.

This last step takes place repeatedly until the Agent is stopped, either by user action, by the Mac being put to sleep, or by the user quitting WeatherSnoop 3.

When the Agent is stopped, it:

  1. Captures the current date/time and records it as the time that the Agent was stopped.
  2. Shuts down any outstanding communication to the weather source.
  3. Severs the connection to the weather source.
  4. Enables user-interface options. You can then make changes as needed.

Always-On vs. Wake/Sleep

There are two different ways that you can run your Mac:

  1. Always-On. You leave your Mac running 100% of the time. The Energy settings are set to never let the Mac sleep.
  2. Wake/Sleep. You put your Mac to sleep after using it, or let your Mac go to sleep after some amount of idle time.

WeatherSnoop 3 is designed to work in both scenarios.

If your Mac goes to sleep, the Agent is stopped in anticipation of the event. While the Mac is asleep, your weather source may still be collecting weather data (it depends on your weather source, but most all stations do). When your Mac awakes, the Agent is started (if it was running prior to sleep) and the entire Agent startup process takes place again.

It is important to understand that even if your weather station logs its data while your Mac is asleep or off, the data it logs may not be the full complement of data that it provides in real-time. Some stations, like the Davis Instruments stations, only log a subset of the data that is available when polling real-time.

IMPORTANT: WeatherSnoop 3 cannot obtain any data from the weather source while your Mac is sleeping!

Timed-Based Events

The nature of weather data means that certain time-based events have to take place. One important time-based task for WeatherSnoop 3 is resetting the daily minimum/maximum value for each weather property. It does this by setting the new day's minimum and maximum values to the last known value of the weather property.

The resetting of the daily minimum/maximum values happens every midnight at local time. Depending on if the Agent happens to be running at that time or not, one of two things will happen:

  1. If the Agent is running at midnight, WeatherSnoop 3 will reset the day's minimum/maximum value for each weather property at that time.
  2. If the Agent is not running at midnight, then the reset of the day's minimum/maximum values will happen the next time that the Agent is started (as noted in Step 3 in the above section How The Agent Works).

Next Steps

Now that the Agent has started, it's now time to take a look at Properties.

starting_the_agent.txt · Last modified: 2015/08/01 11:06 (external edit)