The plug-in can triggered by the following methods:
Timed
Select the Data Source tab and make sure Enable Fetch is checked and the Read Interval is set to the desire fetch interval (in minutes). Read Interval determines how often the weather plug-in will fetch the weather data. Read Interval set to 0 disables timed fetches.This is the most common method to trigger weather fetches.
Via Serial Commands
Weather related serial commands allow your HomeVision Controller schedule to control how the Weather plug-in fetches and speaks the weather and whether or not it loads the controller's weather variables.To use a serial command to trigger a weather fetch, send a serial command from the HomeVision Controller with the text "weather: fetch bkgnd". An example line in the schedule would be like this:
Serial port 1 (Main serial port): Transmit string 'weather: fetch bkgnd'The Timed method can also be used simultaneously. However, a serial command triggered fetch will restart the Read Interval timer.
A serial command from the HomeVision Controller with the text "weather: speak now" will speak the previously fetched weather (it does not fetch new data). An example line in the schedule would be like this:
Serial port 1 (Main serial port): Transmit string 'weather: speak now'This serial command has no effect on the Read Interval timer.
Complete List of Weather Related Serial Commands
Enable/disable fetching of weather info
No weather can be fetched by any means when disabled. (Sets/clears the Fetch Enable checkbox in the Configuration Data Source tab.)
weather: fetch enable|disable
Fetches new weather info in the background
weather: fetch bkgnd
Note: To speak the new weather with a serial command (see below) directly after this command, a wait of a few seconds is necessary to bridge the time needed to fetch the weather information in the background. Due to the amount of time it typically takes to retrieve data from the web, an immediate fetch is not reliable as it may cause the serial command to time out. Restarts the Read Interval timer. Fetch Enable must be set.
Controls speaking of the weather
Sets the Never, Always, or Serial Cmd Only radio button in the Configuration Speech tab.
weather: speak never|always|serialonly
Speak the current weather now
Always or Serial Cmd Only must be set.
weather: speak now
Enable/disable loading of the HomeVision Controller weather variables
Enable/disable loading of the HomeVision Controller weather variables when the weather is fetched. (Sets/clears the Enable Update checkbox in the Configuration HV Vars tab.)
weather: hvwxvars enable|disable
Set the Station ID for current weather
stationid must be contained within quotes.
weather: station "stationid"
Set current, forecast or both
Set the current, forecast or both values for the given location type. The location value must be contained within quotes. Note for the latlong value, the latitude and longitude are separated with a "," but no spaces. The location type is also selected as the current source.
weather: current|forecast|both station "stationid" weather: current|forecast|both zipcode "zipcode" weather: current|forecast|both latlong "lat,long" weather: current|forecast|both hvlatlong
Set the current, forecast or both data sources
The data source types are not case sensitive. METAR is only valid for current weather.
weather: current|forecast|both none weather: current|forecast|both NWS weather: current|forecast|both METAR weather: current|forecast|both OpenWeather
Via Other Plug-ins
A weather fetch can be triggered from other plug-ins using the following code in the other plug-in:
WeatherSetVar
WeatherSetVar ?0 | 1 ?wx | fc | wxfc | fcwx??
Runs a weather fetch. If a first argument exists and is not a zero, then the weather data is fetched immediately before returning. if there is a second argument, it determines whether the current (wx), forecast (fc), or both (wxfc/fcwx) is fetched. If there are no arguments, the fetch is run in the background for both current and forecast weather.
The plug-in must import the command via:
hvImport WeatherSetVar
WeatherSet
WeatherSet ?current | forecast | both? \ Station stationID ?stationname? | \ ZipCode code | \ LatLong {lat long | lat,long} | \ HVLatLong | \ None | NWS | METAR | OpenWeather | \ GoSets station information and typically would be used before WeatherSetVar to set the station information to be used for current and forecast fetches. If current, forecast or both is not present as the first argument, then the setting is applied for both current and forecast weather. WeatherSet Go is identical to WeatherSetVar 1 wxfc.
The plug-in must import the command via:
hvImport WeatherSet"WeatherSet Station" is the same as "WeatherSetStation". "WeatherSetStation" remains available for backwards compatibility.
The Timed method can also be used simultaneously. However, a plug-in triggered fetch will restart the Read Interval timer.
Via The Web
Two additional commands are provided mainly to access weather information using <HV> tags in HTML pages. However, they can also be used by other plug-ins, similar to the method in the previous section.WeatherGet
Returns weather information.
<HV:Run WeatherGet ?Table? weather_item ?weather_item ...?>If "Table" is present, a table will be returned, with a table header and one row per weather item. The table uses the same style as the built-in tables provided by the Web plug-in. However, the style can be overridden by use of additional style definitions.
If "Table" is not present, weather data will be returned as a simple text string of concatenated weather items. An exception is the weather item weathericon, which will return an HTML <img> tag inserted in the string if other items are present.
Weather_items can be any combination of the items found in the Control Variable column of Table 2 and Table 3. The names are not case-sensitive when used in tags.
Weather items WeatherIcon and FcImgn, will return HTML <img> tags. If used in another plug-in (as opposed to within a web page), WeatherGetIcon should be used instead.
WeatherGetIcon
<HV:Image png WeatherGetIcon ?icon?>Returns weather icon image via an HTML <img> tag. When used in a plug-in, WeatherGetIcon returns icon image data.
If icon is specified, that icon will be provided. Icon may contain the extension, or the extension may be omitted. If omitted, it is assumed to be ".png". If icon is not specified, the weather icon for the current weather is provided.
Icon should be one of the icon names in the Icon column of Table 5 or one of the forecast icons.
This method is slightly different from
<HV:Run WeatherGet WeatherIcon>In fact, the Run method simply determines the weather icon for the current weather and calls an Image WeatherGetIcon command with the explicit icon name. The difference is only important if you use something similar to the example below.
Using WeatherSetVar and WeatherSet with HV:Run Tags
Tags using WeatherGet or WeatherGetIcon typically display data for the current weather (i.e., the last weather info fetched). They do not fetch new weather data on their own. However, WeatherSetVar and WeatherSet can be used in a Run tag to get new data for specific stations.
Examples:
<HV:Run WeatherSet Station KNYC CentralPark> <HV:Run WeatherSetVar 1> <HV:Run WeatherGet Table location weather wind Temp weathericon> <br> <HV:Run WeatherSet Station PAWS Wasilla> <HV:Run WeatherSetVar 1> <HV:Run WeatherGet Table location weather wind Temp weathericon>produces a table of info for Central Park, followed by one with info for Wasilla.
Notes:
- Running WeatherSet and WeatherSetVar in a web page changes the weather info stored by the Weather plug-in, as is the case for any other way to trigger weather fetches. If you are also using weather variables with Control Plug-in, or sending weather info to the HomeVision controller, that data will be affected by these two commands.
- Usually, WeatherSetVar should be run with a "1" argument, signaling WeatherSetVar to complete fetching weather info from the Internet before returning. Normally, data is fetched from the Internet in the background. However, in the web page scenario, new data may not arrive in time to be captured by a following Run tag.
Via The NetIO Server Plug-in
A weather fetch is triggered by the NetIO Server plug-in by the events or netioaction commands:
netioaction wx|fc|wxfc|fcwx update
or
events wx|fc|wxfc|fcwxFor more details, see Weather Info for NetIO.
Via The Control Plug-in
A weather fetch is triggered by the Control plug-in automatically when the Control plug-in starts up. This ensures that weather data variables in control screens are updated as soon as the Control plug-in starts. No user configuration is needed in either plug-in.Via MQTT
Most setting can be set and weather fetches triggered via MQTT. See Weather with MQTTfor complete details of the Weather with MQTT.
Next:
Weather Websockets
Custom Objects and Websockets
Weather Info for NetIO
Weather with MQTT
See Also:
Introduction to the Weather Plug-in
Web-Based Weather Data
Using Weather Control Variables
Forecast Examples
HomeVision Controller Weather Variables
Local Weather Data Files
Speaking Weather Data
Disclaimer