Difference between revisions of "Component: BBC Weather Forecast (Comms: IoT/Cloud)"

From Flowcode Help
Jump to navigationJump to search
Line 85: Line 85:
  
 
On an embedded device you would need a TCP/IP component to allow the communications to the BBC server. This then links to the Network Comms component.
 
On an embedded device you would need a TCP/IP component to allow the communications to the BBC server. This then links to the Network Comms component.
 +
 +
  
  
Line 90: Line 92:
 
==Macro reference==
 
==Macro reference==
  
 +
===GetMaxTemperature===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 108: Line 111:
  
  
 +
===GetVisibility===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 121: Line 125:
  
  
 +
===GetDaySummary===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 134: Line 139:
  
  
 +
===GetMinTemperature===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 152: Line 158:
  
  
 +
===GetWindDirection===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 165: Line 172:
  
  
 +
===RequestData===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 178: Line 186:
  
  
 +
===GetPollution===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 191: Line 200:
  
  
 +
===GetSunset===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 204: Line 214:
  
  
 +
===GetHumidity===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 217: Line 228:
  
  
 +
===GetDayName===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 230: Line 242:
  
  
 +
===GetWindSpeed===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 243: Line 256:
  
  
 +
===SetLocationCode===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 261: Line 275:
  
  
 +
===GetSunrise===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 274: Line 289:
  
  
 +
===GetPressure===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 287: Line 303:
  
  
 +
===SetForecastDay===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 305: Line 322:
  
  
 +
===GetUVRisk===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 318: Line 336:
  
  
 +
===GetLocationName===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 331: Line 350:
  
  
 +
===Initialise===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-

Revision as of 11:48, 3 February 2023

Author MatrixTSL
Version 1.0
Category Comms: IoT/Cloud


BBC Weather Forecast component

Easily allows you to collect three day forecasted weather metrics for your area using the BBC Weather data service. Supports Min/Max temperature, Wind Direction, Wind Speed, Visibility, Pressure, Humidty, UV Risk, Pollution and Sun Rise/Set times for your selected area.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_BBCWeatherForecast.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_BBCWeatherForecast.fcfx

Detailed description

No detailed description exists yet for this component

Examples

Here is a basic example to read the three day forecast data and report the information on a graphical display.

FC6 Icon.png BBCWeatherForecastDemo


The location can be set by adjusting the BBC Weather location property, see the component property tooltips for more information on how to do this.

On an embedded device you would need a TCP/IP component to allow the communications to the BBC server. This then links to the Network Comms component.



Macro reference

GetMaxTemperature

Fc9-comp-macro.png GetMaxTemperature
Reads the forecast maximum temperature in the selected scale for the selected day. 
Fc9-bool-icon.png - BOOL Scale
0 = Celcius, 1 = Farenheit 
Fc9-s16-icon.png - INT Return


GetVisibility

Fc9-comp-macro.png GetVisibility
Reads the forecast visibility for the selected day. 
Fc9-string-icon.png - STRING Return


GetDaySummary

Fc9-comp-macro.png GetDaySummary
Gets the summary of the currently selected day as a string. 
Fc9-string-icon.png - STRING Return


GetMinTemperature

Fc9-comp-macro.png GetMinTemperature
Reads the forecast minimum temperature in the selected scale for the selected day. 
Fc9-bool-icon.png - BOOL Scale
0 = Celcius, 1 = Farenheit 
Fc9-s16-icon.png - INT Return


GetWindDirection

Fc9-comp-macro.png GetWindDirection
Reads the forecast wind direction as a string for the selected day. 
Fc9-string-icon.png - STRING Return


RequestData

Fc9-comp-macro.png RequestData
Requests data about your selected location from the BBC weather service. Returns true if the request was successful. Must be called before trying to call any of the GetXXX macros. 
Fc9-bool-icon.png - BOOL Return


GetPollution

Fc9-comp-macro.png GetPollution
Reads the forecast pollution as a string for the selected day. 
Fc9-string-icon.png - STRING Return


GetSunset

Fc9-comp-macro.png GetSunset
Reads the forecast sunset time as a string for the selected day. 
Fc9-string-icon.png - STRING Return


GetHumidity

Fc9-comp-macro.png GetHumidity
Reads the forecast humidity in Relative Humdity for the selected day. 
Fc9-u8-icon.png - BYTE Return


GetDayName

Fc9-comp-macro.png GetDayName
Gets the name of the currently selected day as a string. 
Fc9-string-icon.png - STRING Return


GetWindSpeed

Fc9-comp-macro.png GetWindSpeed
Reads the reported wind speed in MPH for the selected day. 
Fc9-u8-icon.png - BYTE Return


SetLocationCode

Fc9-comp-macro.png SetLocationCode
Allows the location code to be altered from the default location code set in the component properties. After changing the location the RequestData macro must be called to refresh the forecast variables. 
Fc9-string-icon.png - STRING NewLocation
New location string, see Location property tooltip for more info. 
Fc9-void-icon.png - VOID Return


GetSunrise

Fc9-comp-macro.png GetSunrise
Reads the forecast sunrise time as a string for the selected day. 
Fc9-string-icon.png - STRING Return


GetPressure

Fc9-comp-macro.png GetPressure
Reads the forecast air pressure in milli bar (mb) for the selected day. 
Fc9-u16-icon.png - UINT Return


SetForecastDay

Fc9-comp-macro.png SetForecastDay
Chooses which day of the three day forecast to look at.  
Fc9-u8-icon.png - BYTE Day
0 = Today, 1 = Tomorrow, 2 = Day After Tomorrow 
Fc9-void-icon.png - VOID Return


GetUVRisk

Fc9-comp-macro.png GetUVRisk
Reads the forecast UV Risk for the selected day. 
Fc9-u8-icon.png - BYTE Return


GetLocationName

Fc9-comp-macro.png GetLocationName
Reads the reported location name as a string. 
Fc9-string-icon.png - STRING Return


Initialise

Fc9-comp-macro.png Initialise
Sets up the component ready to collect weather data. 
Fc9-void-icon.png - VOID Return



Property reference

Fc9-prop-icon.png Properties
Fc9-type-16-icon.png LinkTo
 
Fc9-type-10-icon.png BBC IP Address
IP Address linked to the following URL: weather-broker-cdn.api.bbci.co.uk 
Fc9-type-10-icon.png Location Code
BBC code for your area. In a web browser go to www.bbc.co.uk/weather/ Then type in your city in the search bar and your code will be shown at the end of the URL. For example Manchester in the UK = 2643123 In the UK you can also use the first half of your post code, e.g. HX1 
Fc9-type-21-icon.png Receive Timeout
Maximum time to wait for valid incoming data.