Programming - First steps
P.
97 of 349
So our control center would be ready. The status of our lights is displayed on the main page and we
have the possibility to go to the central page with just one click. At a glance we get information about
the outside temperature, cloudiness, 3-day weather trend, wind speed, date, time as well as sunrise
and sunset.
What is missing now is a real look into the future. We create an additional weather page that will tell
us all about the coming hours and days.
[
Webserver
]
page(WeatherPageID)[$General$,$Weather page 2$]
design $black$
header(0)
footer(0)
For this we need a large database of weather data. To get to this a user account is required on
Weather Wunderground.
If you have successfully completed this, you must generate a key under the Key Settings tab. Here,
for Developer the free version is sufficient. However, you must take into account that the free version
has a limited number of inquiries. This amounts to a maximum of 10 inquiries per day and 500 per
minute.
If you have generated your key, you must install it in our Macro Weather Forecast.
[
Macros
]
WetterForecast(
Key
,WetterStation,Germany,after(systemstart(),1300u64) or cycle(10,00))
For the weather station you have to register your city or search for a suitable station for your area.
If the data is all entered, you will see a list of new variables that is provided by Weather Underground
after system startup in the variable query (F5). Check if your weather station also provides the data
you want to implement. If everything fits, the data can now be displayed using a button or shifter.
Example:
[
Webserver
]
page(WeatherPageID)[$General$,$Weather page 2$]
design $black$
header(0)
footer(0)
button(WINDID)[WIND]$Wind in km/h$ pbutton(14)[WEATHER]$Weather$ pbutton(25)[WEATHER]$Rain
probability$ pbutton(24)[RAIN]$humidity$ pbutton(12)[TEMPERATURE]$Outer temp.: Min$ pbutton(13)
[TEMPERATURE]$Outer temp.:Max$
[
EibPC
]
///Wounderworld Weather
//Weather forecast today
if after(systemstart(),3000u64) or change(WeatherForecast_Today_Wind_Max_Direction) then
pdisplay(11,$aus$ + convert(WeatherForecast_Today_Wind_Max_Direction,$
$),WIND,ACTIVE,BLINKBLUE,WeatherPageID) endif
if after(systemstart(),3000u64) or change(WeatherForecast_Today_Temperatur_Min) then
pdisplay(12,convert(WeatherForecast_Today_Temperatur_Min,$$)+$
°C$,TEMPERATURE,ACTIVE,BLINKBLUE,WeatherPageID)endif
if after(systemstart(),3000u64) or change(WeatherForecast_Today_Temperatur_Max) then
pdisplay(13,convert(WeatherForecast_Today_Temperatur_Max,$$)+$
°C$,TEMPERATURE,BRIGHTRED,BLINKRED,WeatherPageID)endif
if after(systemstart(),3000u64) or change(WeatherForecast_Today_Weather) then
pdisplay(14,convert(WeatherForecast_Today_Weather,$$),WEATHER,STATE4,GREY,WeatherPageID)endif
if after(systemstart(),3000u64) or change(WeatherForecast_Today_RainProbability) then
pdisplay(25,convert(WeatherForecast_Today_RainProbability,$
$),WEATHER,STATE6,BLINKBLUE,WeatherPageID)endif
if after(systemstart(),3000u64) or change(WeatherForecast_Today_Humidity) then
pdisplay(24,convert(WeatherForecast_Today_Humidity,$$),RAIN,ACTIVE,BLINKBLUE,WeatherPageID)endif
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]