Outside WiFi weather station "WS3500" and local customized upload (no cloud needed)

Hi Thomas,
Thanks for your reply - i hope i can change to write into textfile - i’ll give them a try.

Many Thanks!!!

PS: you’re German? because of the text in the items list (i’m from Austria)

Andy

shouldn’t be a problem with fputcsv! :wink:

…yes, I’m German, near Augsburg.

Hi,

I was looking for a Weather Station and found this topic.
Thank you very much for sharing!
I’m trying to get this running in docker with Dockerfile:

FROM php:7.2-apache
COPY . /var/www/html
EXPOSE 80
CMD apache2-foreground

If i omit the CMD, the docker container is stopped with:

[mpm_prefork:notice] [pid 1] AH00170: caught SIGWINCH, shutting down gracefully

It runs, and gives the following output on every update

10.0.3.1 - - [11/Jun/2020:20:51:33 +0000] “GET / HTTP/1.1” 200 241 “-” “python-requests/2.18.4”

Is it supposed to look like this?

However nothing happens in openhab (REST API is working, and $url is correct)

Any suggestion how to solve this, please?

Hi,

I have the same problem. The weather station calls the script every 20 seconds, but no values in openhab2. The rest api has tested and was working with this command:

curl -X POST --header “Content-Type: text/plain” --header “Accept: application/json” -d “ON” “http://192.168.xxx.xxx:8080/rest/items/Esszimmerlicht

There were some issues I had to solve:

  1. The Weatherstation was not calling the script, so i set Station ID: 1 and Station Key: 1 in the WS View app. I also forgot to add the “?” in path, so corrected to: /wetterstation.php?
  2. The script wasn’t working, so i tried to do the same request as logged from browser and found that the functions where somehow missing, so I wrote them.

The 10.0.3.1 calls are from something else.

So this is the modified working PHP-file:wetterstation.php.txt (3.6 KB)

1 Like

Thankx @Andreas_Pircher, you’re absolutely right, I somehow managed to not include the functions for calculating the metric values… I just updated the code in my initial post (I rounded on two digits)

And yes, one important thing is to type in the path to the script in the App with the trailing ? at the end, otherwise you won’t get the GET-attributes… (I also just updated the initial screenshot)

I discovered a calculation error in @binderth’s script I was using for over a year now … :slight_smile:
There was a in2cm function, but in Openhab I display mm.
This is the updated version: wetterstation.php.txt (4.4 KB)

1 Like

I’m using it since forever! :wink:
Thanks for spotting it! I’m not sure how that slipped. Perhaps something I configured in OH2 but in OH3 it’s different now… :man_shrugging: anyways: thanks!

Hi all,
Just thinking to order one of these weather stations.
Do you think this script will work with

Or do you have a correct link to one of the compatible stations as I get a few results for WS3500

Thanks in advance

Koen

This is the exact weather station I’m using since - with my script! :wink:

Okay,
Thx for your quick respons. I’m gonna order this one :grinning:

Finally a have some spare time to get this project going.
What would be the easiest straight forward methode of creating this website? webstation or would wordpress maybe easier?

it isn’t a website, you only need an PHP parser. if you’re running a Synology NAS you can use webstation with active PHP of course. or any other PHP-capable webserver… wordpress for pnly this purpuse would be the definition of overkill

Hello to all,

thank you for script it works on my side too.

I only recognized that these two items were not updated:

DateTime				Weatherstation_dateutc			"Uhrzeit"							<temperature>	(gWeather, Wetter)	

Number 					Weatherstation_elev				"Elevation [%.1f]"				<temperature>	(gWeather, Wetter)	

Is it the same on your setup?

@binderth: In the php file I found the “Beispiel von Wetterstation”. How did you read out this example from your weather station? I have no experience with PHP but maybe this script is good starting point for me.

// 192.168.0.119 - - [12/Jun/2020:20:29:37 +0000] "GET /wetterstation.php?ID=1&PASSWORD=1&indoortempf=81.1&tempf=70.5&dewptf=52.7&windchillf=70.5&indoorhumidity=40&humidity=53&windspeedmph=1.6&windgustmph=2.2&winddir=79&absbaromin=29.064&baromin=29.903&rainin=0.000&dailyrainin=0.000&weeklyrainin=0.000&monthlyrainin=0.000&solarradiation=0.00&UV=0&dateutc=2020-06-12%2020:29:37&softwaretype=EasyWeatherV1.5.0&action=updateraw&realtime=1&rtfreq=5 HTTP/1.0" 200 913 "-" "-"

first of all, the linked PHP-script in #12 is the starting point:

What the script does is the following:

foreach ($_GET as $key => $value) {

This loops through all GET-parameters, the weather station sends.

	switch (substr($key, -3)) {

this one looks for the las three digits of the key-string (e.g. indoortempf) and converts some units to “the correct” units. :wink:
if there’s no unit, it’s default just sends the value.

function sendOH2Command($item, $data) {

this one sends the value to openHAB via REST API.

So, if you’re missing a value, make sure, you have the corresponding item available in your items, and keep in mind:

$weatherprefix = "Weatherstation_"; // if you have a prefix in your OH2 items configuration
...
endOH2Command($weatherprefix.$key, $value);

so, the item name should bei Weatherstation_elev and the weather station should send a key “elev” and one “dateutc”.
My weather station (EasyWeather-WIFI50DD) sends the “dateutc”, but not “elev”.

Thank this helps me a lot.

You have mentioned that your weather station sends not the “elev” key.

How do you request the data/key from your weather station?
Can I just type in the browser e.g.

http://my_weather_station_ip/getData

I would like to check what my weather stations sends out, maybe the name is not matching.
But I do not know how to read out these information from the weather station

No, you can’t. Please read the thread from the beginning (I know, annoying, if there’s info splattered across).

You have to configure the weather station in the “WS View”-App to call a certain script. It will then do that periodically - you set the seconds in the “upload interval”.

you can

  1. you can check your PHP webserver’s logfile
  2. you can edit the PHP script to write the GET-parameters in a file or something

easiest would be 1. I guess, if you know, where it is.

Also, this is, what my WS3500 aka WIFI50DD sends (Firmware: EasyWeathev1.6.4) - already converted to JSON-format

{
  "ID": "123",
  "PASSWORD": "987",
  "indoortempf": "78.1",
  "tempf": "84.4",
  "dewptf": "56.8",
  "windchillf": "84.4",
  "indoorhumidity": "47",
  "humidity": "39",
  "windspeedmph": "1.8",
  "windgustmph": "3.4",
  "winddir": "165",
  "absbaromin": "28.358",
  "baromin": "30.036",
  "rainin": "0.000",
  "dailyrainin": "0.000",
  "weeklyrainin": "0.000",
  "monthlyrainin": "0.791",
  "solarradiation": "577.79",
  "UV": "5",
  "dateutc": "2022-07-28 13:36:02",
  "softwaretype": "EasyWeatherV1.6.4",
  "action": "updateraw",
  "realtime": "1",
  "rtfreq": "5"
}

Thanks, for your tip.
I have added this to the php file:
My first php code but it works :grinning:

	// write data from weather station into txt file
	$result = array($_GET);
	file_put_contents("weatherstation_data.txt",print_r($result, true));

Here my data:

Array
(
    [0] => Array
        (
            [ID] => XXX
            [PASSWORD] => XXXX
            [tempf] => 87.6
            [humidity] => 37
            [dewptf] => 58.3
            [windchillf] => 87.6
            [winddir] => 280
            [windspeedmph] => 3.80
            [windgustmph] => 5.82
            [rainin] => 0.000
            [dailyrainin] => 0.000
            [weeklyrainin] => 0.000
            [monthlyrainin] => 0.071
            [yearlyrainin] => -9999
            [totalrainin] => 0.071
            [solarradiation] => 225.11
            [UV] => 2
            [indoortempf] => 80.8
            [indoorhumidity] => 43
            [absbaromin] => 29.211
            [baromin] => 29.716
            [lowbatt] => 0
            [dateutc] => now
            [softwaretype] => EasyWeatherPro_V5.0.7
            [action] => updateraw
            [realtime] => 1
            [rtfreq] => 5
        )

)

Here my info regarding the weatherstation Sainlogic WS3500 built 05.2022.
When I look into WSView Plus app the weather station is called "EasyWeatherPro-0FDC2.1
image

We both have no “elev” and my “dateutc” is only a string with now.

I have created my additional data and changed the the Data to String, makes no sense but I get now all data provided by the weather station;-)

Number 					Weatherstation_lowbatt			"Batterie"				<temperature>	(gWeather, Wetter)	
Number:Length 			Weatherstation_yearlyrain		"Niederschlag/Jahr [%.1f mm]"   <rain>	(gWeatherHeight, Wetter)	
**String**  				Weatherstation_dateutc			"Uhrzeit"							<temperature>	(gWeather, Wetter)	

1 Like

I think, your Firmware has an bug with “now” instead of a UTC-timestamp!
other than that, it looks good! And beware of your skills in scripting growing over time using openHAB! :wink: