Add new comment

Weather station

Michal Novotný's picture
Submitted by Michal Novotný on November 23, 2020 - 9:27pm
Groups audience
Teaser image
Average: 4.5 (2 votes)
Category
Obsah

Local weather station allows you to track the exact direction and speed of the wind, the amount of rainfall but also the intensity of the sun's radiation. This information can be used, among other things, to protect interior of the house from the sun or wind and to decide on the garden irrigation.

Weather station range from cheap to more expensive professional options. We decided on the possibility of universality of use and availability in our market. We have practical experience with the Renkforce WH2600 weather station. In theory any weather station containing its own Web server with values is usable for this guide. If you have another station, try typing in the comments or forum, surely there'll be some way to import data into OpenHAB. Try looking at the official OpenHAB forum as well.

Hardware

Weather station (e.g. Renkforce WH2600)

Pi-Home - see the How to in Smart Home section

Software

OpenHAB

Application

The weather station contains an outdoor unit powered by a battery and photovoltaic panel. Inside the house, an internal unit connects to the LAN network. The unit gets an address from DHCP or you can set a static address. Then type the address of the weather station into the web browser to see the local web interface. We will set OpenHAB to take data from the "Live Data" tab.

MeteoStanice v chytrém domě

 

OpenHAB

We will receive values to OpenHAB using the parser of the HTML page of the weather station with Live values. We then store the request values in the MySQL database at OpenHAB. Any data can be parsed in this way, even from any website. Useful feature! (currency, weather forecast, traffic, etc.)

1) At first go to OpenHAB interface PaperUI and install HTTP Binding and Regex transformation extensions.

Addons -> Binding -> HTTP Binding

OpenHAB - HTTP Binding

Addons -> Transformation -> RegEx Transformation

OpenHAB - Regex Transformation

 

In OpenHAB items, we create a new item, such as meteo.items. It will look something like this. Replace IP address 192.168.4.35 with the address of your weather station. The individual rows then store the values from the weather station into your OpenHAB and you can see them in BasicUI or arrange them in HABpanel.

/*First row is the group where the items will be shown */

Group weather_local "MeteoStanice" (all)

String weather_local_dateutc "Load time [%s]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?CurrTime.*?value=\"([0-9]*.[0-9]*)\".*)]" }

Number weather_local_tempin "Temperature inside [%.2f °C]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?inTemp.*?value=\"([0-9]*.[0-9]*)\".*)]" }
Number weather_local_humiin "Humidity inside [%d %%]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?inHumi.*?value=\"([0-9]*.[0-9]*)\".*)]" }

Number weather_local_tempout "Temperatire outside [%.2f °C]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?outTemp.*?value=\"([0-9]*.[0-9]*)\".*)]" }
Number weather_local_humiout "Humidity outside [%d %%]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?outHumi.*?value=\"([0-9]*.[0-9]*)\".*)]" }

Number weather_local_relbarom "Relative pressure [%.2f mb]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?RelPress.*?value=\"([0-9]*.[0-9]*)\".*)]" }
Number weather_local_absbarom "Absolute pressure [%.2f mb]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?AbsPress.*?value=\"([0-9]*.[0-9]*)\".*)]" }

String weather_local_winddir "Wind direction [%s °]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?windir.*?value=\"([0-9]*.[0-9]*)\".*)]" }
String weather_local_windspeed "Wind speed [%s km/h]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?windspeed.*?value=\"([0-9]*.[0-9]*)\".*)]" }
String weather_local_gustspeed "Gust speed [%s km/h]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?gustspeed.*?value=\"([0-9]*.[0-9]*)\".*)]" }

Number weather_local_solarradiation "Solar radiation [%.2f lux]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?solarrad.*?value=\"([0-9]*.[0-9]*)\".*)]" }
Number weather_local_UV "UV [%.2f index]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?uv.*?value=\"([0-9]*.[0-9]*)\".*)]" }

Number weather_local_rainin "Rain [%.2f mm]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?rainofhourly.*?value=\"([0-9]*.[0-9]*)\".*)]" }
Number weather_local_dailyrainin "Rain daily [%.2f mm]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?rainofdaily.*?value=\"([0-9]*.[0-9]*)\".*)]" }
Number weather_local_weeklyrainin "Weekly rain [%.2f mm]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?rainofweekly.*?value=\"([0-9]*.[0-9]*)\".*)]" }
Number weather_local_monthlyrainin "Monthly rain [%.2f mm]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?rainofmonthly.*?value=\"([0-9]*.[0-9]*)\".*)]" }
Number weather_local_yearlyrainin "Yearly rain [%.2f mm]" (weather_local) { http="<[http://192.168.4.35/livedata.htm:5000:REGEX(.*?rainofyearly.*?value=\"([0-9]*.[0-9]*)\".*)]" }


In the Rules section, you can then magic with what to do with the values from the weather station, for example:

  • if the wind is more than 60 km/h, close the blinds
  • if the intensity of sunlight is more than 50000 lux for half an hour, the blinds will be drawn
  • If rainfall in the last week is less than 2 mm, irrigate garden, etc., etc.

In HABpanel, it might look like this:

Meteostanice v chytrém domě OpenHAB - zobrazení