Jump to content

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

From Flowcode Help
No edit summary
m Text replacement - "width="90%" style="background-color:#D8C9D8; color:#4B008D;"" to "width="90%" class="mtx-class-macrohead""
 
(3 intermediate revisions by the same user not shown)
Line 93: Line 93:


===GetDayName===
===GetDayName===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetDayName'''
| width="90%" class="mtx-class-macrohead" | '''GetDayName'''
|-
|-
| colspan="2" | Gets the name of the currently selected day as a string. 
| colspan="2" | Gets the name of the currently selected day as a string. 
Line 107: Line 107:


===GetDaySummary===
===GetDaySummary===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetDaySummary'''
| width="90%" class="mtx-class-macrohead" | '''GetDaySummary'''
|-
|-
| colspan="2" | Gets the summary of the currently selected day as a string. 
| colspan="2" | Gets the summary of the currently selected day as a string. 
Line 121: Line 121:


===GetHumidity===
===GetHumidity===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetHumidity'''
| width="90%" class="mtx-class-macrohead" | '''GetHumidity'''
|-
|-
| colspan="2" | Reads the forecast humidity in Relative Humdity for the selected day. 
| colspan="2" | Reads the forecast humidity in Relative Humdity for the selected day. 
Line 135: Line 135:


===GetLocationName===
===GetLocationName===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetLocationName'''
| width="90%" class="mtx-class-macrohead" | '''GetLocationName'''
|-
|-
| colspan="2" | Reads the reported location name as a string. 
| colspan="2" | Reads the reported location name as a string. 
Line 149: Line 149:


===GetMaxTemperature===
===GetMaxTemperature===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetMaxTemperature'''
| width="90%" class="mtx-class-macrohead" | '''GetMaxTemperature'''
|-
|-
| colspan="2" | Reads the forecast maximum temperature in the selected scale for the selected day. 
| colspan="2" | Reads the forecast maximum temperature in the selected scale for the selected day. 
Line 168: Line 168:


===GetMinTemperature===
===GetMinTemperature===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetMinTemperature'''
| width="90%" class="mtx-class-macrohead" | '''GetMinTemperature'''
|-
|-
| colspan="2" | Reads the forecast minimum temperature in the selected scale for the selected day. 
| colspan="2" | Reads the forecast minimum temperature in the selected scale for the selected day. 
Line 187: Line 187:


===GetPollution===
===GetPollution===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetPollution'''
| width="90%" class="mtx-class-macrohead" | '''GetPollution'''
|-
|-
| colspan="2" | Reads the forecast pollution as a string for the selected day. 
| colspan="2" | Reads the forecast pollution as a string for the selected day. 
Line 201: Line 201:


===GetPressure===
===GetPressure===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetPressure'''
| width="90%" class="mtx-class-macrohead" | '''GetPressure'''
|-
|-
| colspan="2" | Reads the forecast air pressure in milli bar (mb) for the selected day. 
| colspan="2" | Reads the forecast air pressure in milli bar (mb) for the selected day. 
Line 215: Line 215:


===GetSunrise===
===GetSunrise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetSunrise'''
| width="90%" class="mtx-class-macrohead" | '''GetSunrise'''
|-
|-
| colspan="2" | Reads the forecast sunrise time as a string for the selected day. 
| colspan="2" | Reads the forecast sunrise time as a string for the selected day. 
Line 229: Line 229:


===GetSunset===
===GetSunset===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetSunset'''
| width="90%" class="mtx-class-macrohead" | '''GetSunset'''
|-
|-
| colspan="2" | Reads the forecast sunset time as a string for the selected day. 
| colspan="2" | Reads the forecast sunset time as a string for the selected day. 
Line 243: Line 243:


===GetUVRisk===
===GetUVRisk===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetUVRisk'''
| width="90%" class="mtx-class-macrohead" | '''GetUVRisk'''
|-
|-
| colspan="2" | Reads the forecast UV Risk for the selected day. 
| colspan="2" | Reads the forecast UV Risk for the selected day. 
Line 257: Line 257:


===GetVisibility===
===GetVisibility===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetVisibility'''
| width="90%" class="mtx-class-macrohead" | '''GetVisibility'''
|-
|-
| colspan="2" | Reads the forecast visibility for the selected day. 
| colspan="2" | Reads the forecast visibility for the selected day. 
Line 271: Line 271:


===GetWindDirection===
===GetWindDirection===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetWindDirection'''
| width="90%" class="mtx-class-macrohead" | '''GetWindDirection'''
|-
|-
| colspan="2" | Reads the forecast wind direction as a string for the selected day. 
| colspan="2" | Reads the forecast wind direction as a string for the selected day. 
Line 285: Line 285:


===GetWindSpeed===
===GetWindSpeed===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetWindSpeed'''
| width="90%" class="mtx-class-macrohead" | '''GetWindSpeed'''
|-
|-
| colspan="2" | Reads the reported wind speed in MPH for the selected day. 
| colspan="2" | Reads the reported wind speed in MPH for the selected day. 
Line 299: Line 299:


===Initialise===
===Initialise===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
| width="90%" class="mtx-class-macrohead" | '''Initialise'''
|-
|-
| colspan="2" | Sets up the component ready to collect weather data. 
| colspan="2" | Sets up the component ready to collect weather data. 
Line 313: Line 313:


===RequestData===
===RequestData===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''RequestData'''
| width="90%" class="mtx-class-macrohead" | '''RequestData'''
|-
|-
| colspan="2" | 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. 
| colspan="2" | 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. 
Line 327: Line 327:


===SetForecastDay===
===SetForecastDay===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetForecastDay'''
| width="90%" class="mtx-class-macrohead" | '''SetForecastDay'''
|-
|-
| colspan="2" | Chooses which day of the three day forecast to look at.  
| colspan="2" | Chooses which day of the three day forecast to look at.  
Line 346: Line 346:


===SetLocationCode===
===SetLocationCode===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetLocationCode'''
| width="90%" class="mtx-class-macrohead" | '''SetLocationCode'''
|-
|-
| colspan="2" | 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. 
| colspan="2" | 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. 
Line 366: Line 366:
==Property reference==
==Property reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="mtx-class-macrotable wikitable"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
| width="90%" class="mtx-class-macrohead" | '''Properties'''  
|-
|-
|-
|-

Latest revision as of 14:23, 13 July 2026

Author MatrixTSL
Version 1.0
Category Comms: IoT/Cloud


BBC Weather Forecast component

Easily allows you to collect observed weather metrics for your area using the BBC Weather data service. Supports temperature and humidity etc. for your selected area. Also available are Wind Direction, Wind Speed and Air Pressure but please note these are not always available depending on your selected area. This component is used for data gathering from the internet.

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.

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.

Here is an example of a next-day weather predictor that also shows the current-day weather for a ESP32 embedded device

ESP32 weather predictor


Macro reference

GetDayName

GetDayName
Gets the name of the currently selected day as a string. 
- STRING Return


GetDaySummary

GetDaySummary
Gets the summary of the currently selected day as a string. 
- STRING Return


GetHumidity

GetHumidity
Reads the forecast humidity in Relative Humdity for the selected day. 
- BYTE Return


GetLocationName

GetLocationName
Reads the reported location name as a string. 
- STRING Return


GetMaxTemperature

GetMaxTemperature
Reads the forecast maximum temperature in the selected scale for the selected day. 
- BOOL Scale
0 = Celcius, 1 = Farenheit 
- INT Return


GetMinTemperature

GetMinTemperature
Reads the forecast minimum temperature in the selected scale for the selected day. 
- BOOL Scale
0 = Celcius, 1 = Farenheit 
- INT Return


GetPollution

GetPollution
Reads the forecast pollution as a string for the selected day. 
- STRING Return


GetPressure

GetPressure
Reads the forecast air pressure in milli bar (mb) for the selected day. 
- UINT Return


GetSunrise

GetSunrise
Reads the forecast sunrise time as a string for the selected day. 
- STRING Return


GetSunset

GetSunset
Reads the forecast sunset time as a string for the selected day. 
- STRING Return


GetUVRisk

GetUVRisk
Reads the forecast UV Risk for the selected day. 
- BYTE Return


GetVisibility

GetVisibility
Reads the forecast visibility for the selected day. 
- STRING Return


GetWindDirection

GetWindDirection
Reads the forecast wind direction as a string for the selected day. 
- STRING Return


GetWindSpeed

GetWindSpeed
Reads the reported wind speed in MPH for the selected day. 
- BYTE Return


Initialise

Initialise
Sets up the component ready to collect weather data. 
- VOID Return


RequestData

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. 
- BOOL Return


SetForecastDay

SetForecastDay
Chooses which day of the three day forecast to look at.  
- BYTE Day
0 = Today, 1 = Tomorrow, 2 = Day After Tomorrow 
- VOID Return


SetLocationCode

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. 
- STRING NewLocation
New location string, see Location property tooltip for more info. 
- VOID Return


Property reference

Properties
LinkTo
 
BBC IP Address
IP Address linked to the following URL: weather-broker-cdn.api.bbci.co.uk 
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 
Receive Timeout
Maximum time to wait for valid incoming data.