Hi Guido,
Like you, I also wanted to use live weather information to open and/or close my home’s sunscreens. I used the WeatherUnderground service, but I found it inaccurate and often lagging, and therefor not ideal. I opted for a personal weather station. I did some research and found this set, Renkforce WH2600 Wunderground. made by FineOfset (I guess that the devices you mentioned are also made by this company).
The WH2600 has some useful features in general:
- The set is quite affordable .
- The outdoor sensor-unit is solar powered.
- It’s also equipped with a light intensity sensor, convenient for using with screens.
- Its bridge is a small, mains powered device without a screen, buttons or batteries that you won’t be needing anyway.
And for integrating it with openhab it has multiple useful features: - It has a nice webinterface that shows the sensor data live, openhab can get the data from there by making an http GET request and parsing the WH2600’s reply.
- The set is intended to upload the sensor data to a personal Wunderground account. You can fetch that data from there and use it.
- The webinterface allows you to change the address the data is send to and the upload protocol’s specifications are public. So basically you can host your own webserver and relay the uploaded data to openhab’s rest api with a simple php script that performs some PUT requests (beware, the sensor data will be uploaded in empirical, so you might want to convert that to metric before relaying). For openhab1 the script can look like this:
<?php
function postUpdate($item, $data) {
$url = "http://192.168.1.11:8080/rest/items/" . $item . "/state";
$options = array(
'http' => array(
'header' => "Content-type: text/plain\r\n",
'method' => 'PUT',
'content' => $data //http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
foreach ($_GET as $i => $s) {
if($i == "solarradiation") {
$s = strval(round(floatval($s) / 0.0079,0)) ;
}
elseif($i == "windchillf" || $i == "dewptf" || $i == "tempf" || $i == "indoortempf") {
$s = strval(round(((floatval($s)- 32) * 5)/9,1)) ;
}
elseif($i == "baromin") {
$s = strval(round(floatval($s) * 33.864,1)) ;
}
elseif(strpos($i, "rainin") !== false) {
$s = strval(round(floatval($s) * 25.4,1)) ;
}
elseif(strpos($i, "mph") !== false) {
$s = strval(round(floatval($s) * 1.609344,1)) ;
}
postUpdate('weather_local_' . $i, $s);
}
if(true) {
echo "success";
}
?>
Without converting it can be as simple as:
<?php
function postUpdate($item, $data) {
$url = "http://192.168.1.11:8080/rest/items/" . $item . "/state";
$options = array(
'http' => array(
'header' => "Content-type: text/plain\r\n",
'method' => 'PUT',
'content' => $data //http_build_query($data),
),
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
foreach ($_GET as $i => $s)
postUpdate('weather_local_' . $i, $s);
if(true) {
echo "success";
}
?>
Cheers,
Jesse