Weatherman-controller binding

Hi Guys,

does anyone have experience with the weatherman-controller?

It is build for homematic but is now also able to send json data.

It´s a low price diy weatherstation with many functions - so quite interesting.
But i don´t no how stable it works, and how good the json integration works.
Or the best of all, if someone is working on a binding.

Hope anyone have experience with that.

thanks
vaillan

Hi, I can’t offer a binding for the weatherman, but I use a python script that feeds weatherman/wiffi/… data into openHAB:

Hope that helps.

Regards
mampfes

So you have the whole weatherman data in your OH System?

Do you have any Problems, or does it work well?

I am going to buy the weatherman, if there are good experience with it.
It´s sounds great and it´s very cheap compared to others.
But it´s a DIY solution so i want to be sure, that it works great with OH.

Thanks for answer.

Best regards
Vaillan

Hi Vaillan,

as I can see so far it gives me good and valuable readings. The script supports any reading (even future ones), but not the new data logger. But this is anyhow done better by openHAB, influxdb and grafana in my case. One problem I discovered so far applies to the rain gauge (not the current rain status): I think it doesn’t count correctly, but maybe its just the rocker inside that is frozen (I use a WH5300).

Best regards
mampfes

Hi mampfes,

you script is looking pretty nice. Thanks for sharing it.
I’m trying to get it work with my Weatherman. Unfortunately, I’m getting an error message but I can’t identify what the issue is.
Do you have an idea?

I updated the IP address of OH and wiffi in the py script.
CCU IP-Address was set to OH IP address in Weatherman settings.
Param:12 was set to 8189 in Weatherman settings.
I’m also getting the confirmation “connected with CCU” in Weatherman

Mar 19 23:07:14 openHABianPi systemd[1]: Started Wiffi 2 openhab.
Mar 19 23:08:42 openHABianPi wiffi2openhab.py[31363]: looking for openhab at 192.168.1.22:8080
Mar 19 23:08:42 openHABianPi wiffi2openhab.py[31363]: listening for wiffis on port 8189
Mar 19 23:08:42 openHABianPi wiffi2openhab.py[31363]: EXCEPTION {}
Mar 19 23:08:42 openHABianPi wiffi2openhab.py[31363]: {} ValueError('Invalid value "1033.60"',) b'{"modultyp":"weatherman","vars":[{"name":"0","homematic_name":"w_ip","desc":"weatherman_ip","type":"string","unit":"","value":"192.168.1.100"},{"name":"1","homematic_name":"w_temperatur","desc":"aussentemperatur","type":"number","unit":"gradC","value":"-1.0"},{"name":"21","homematic_name":"w_windchill","desc":"gefuehlte_temperatur","type":"number","unit":"gradC","value":"-1.0"},{"name":"9","homematic_name":"w_taupunkt","desc":"taupunkt_temperatur","type":"number","unit":"gradC","value":"-6.8"},{"name":"14","homematic_name":"w_himmeltemperatur","desc":"himmel_temperatur","type":"number","unit":"gradC","value":"0.0"},{"name":"2","homematic_name":"w_feuchte_rel","desc":"rel_feuchte","type":"number","unit":"%","value":"64.8"},{"name":"17","homematic_name":"w_feuchte_abs","desc":"abs_feuchte","type":"number","unit":"g/m3","value":"2.9"},{"name":"18","homematic_name":"w_regensensor_wert","desc":"regenmelderwert","type":"number","unit":"","value":"7"},{"name":"7","homematic_name":"w_regenmelder","desc":"regenstatus","type":"boolean","unit":"","value":"false"},{"name":"8","homematic_name":"w_regenstaerke","desc":"regenstaerke","type":"number","unit":"mm/h","value":"0.0"},{"name":"19","homematic_name":"w_regen_letzte_h","desc":"regen_pro_h","type":"number","unit":"mm","value":"0.0"},{"name":"20","homematic_name":"w_regen_mm_heute","desc":"regen_mm_heute","type":"number","unit":"mm","value":"0.0"},{"name":"32","homematic_name":"w_regenstunden_heute","desc":"regenstunden_heute","type":"number","unit":"h","value":"0.9"},{"name":"27","homematic_name":"w_regen_mm_gestern","desc":"regen_mm_gestern","type":"number","unit":"mm","value":"0.0"},{"name":"3","homematic_name":"w_barometer","desc":"nn_luftdruck","type":"number","unit":"mb","value":"1033.60"},{"name":"11","homematic_name":"w_barotrend","desc":"luftdrucktrend","type":"string","unit":"","value":"steigend"},{"name":"4","homematic_name":"w_wind_mittel","desc":"avg_windgeschwindigkeit","type":"number","unit":"m/s","value":"0.0"},{"
Mar 19 23:08:42 openHABianPi wiffi2openhab.py[31363]: name":"5","homematic_name":"w_wind_spitze","desc":"peak_windgeschwindigkeit","type":"number","unit":"m/s","value":"0.0"},{"name":"24","homematic_name":"w_windstaerke","desc":"bft_windgeschwindigkeit","type":"number","unit":"bft","value":"0"},{"name":"23","homematic_name":"w_windrichtung","desc":"windrichtung","type":"string","unit":"","value":"W"},{"name":"6","homematic_name":"w_wind_dir","desc":"windwinkel","type":"number","unit":"grad","value":"270"},{"name":"10","homematic_name":"w_lux","desc":"helligkeit","type":"number","unit":"lux","value":"0.0"},{"name":"22","homematic_name":"w_sonne_diff_temp","desc":"sonnen_difftemperatur","type":"number","unit":"gradC","value":"2.5"},{"name":"15","homematic_name":"w_sonnentemperatur","desc":"sonnen_temperatur","type":"number","unit":"gradC","value":"1.5"},{"name":"16","homematic_name":"w_sonne_scheint","desc":"sonne_scheint","type":"boolean","unit":"","value":"false"},{"name":"26","homematic_name":"w_sonnenstunden_heute","desc":"Sonnenstunden_heute","type":"number","unit":"h","value":"3.6"},{"name":"12","homematic_name":"w_elevation","desc":"sonne_elevation","type":"number","unit":"grad","value":"-36.9"},{"name":"13","homematic_name":"w_azimut","desc":"sonne_azimut","type":"number","unit":"grad","value":"331.2"},{"name":"30","homematic_name":"w_minuten_vor_sa","desc":"minuten_vor_sa","type":"number","unit":"min","value":"-987"},{"name":"31","homematic_name":"w_minuten_vor_su","desc":"minuten_vor_su","type":"number","unit":"min","value":"-268"}],"Systeminfo":{"MAC-Adresse":"xxx","Homematic_CCU_ip":"192.168.1.22","WLAN_ssid":"xxx","WLAN_Signal_dBm":"-82","sec_seit_reset":"26901","zeitpunkt":"2019.03.19/23:08:00","firmware":"weatherman_105"}}'

Thanks for you support!

Ronny

Hi Ronny,

the json module is complaining about the value “1033.60” for w_barometer. However, this looks like a valid value. I tried your JSON response with my Python environment and I don’t see an error. Therefore I assume this is an issue with your environment. Here is my test script with your data. Could you test it in your environment?
test.py.txt (7.7 KB)

Do you see this error with every response from the weatherman or only from time to time?

Best regards
Steffen

Hello Steffen,

your script seems to work. I don’t get any error message. This is the syslog entry:

Mar 21 21:14:23 openHABianPi systemd[1]: wiffi2openhab.service: Service hold-off time over, scheduling restart.
Mar 21 21:14:23 openHABianPi systemd[1]: Stopped Wiffi 2 openhab.
Mar 21 21:14:23 openHABianPi systemd[1]: Started Wiffi 2 openhab.
Mar 21 21:14:23 openHABianPi test.py[12521]: looking for openhab at 192.168.1.22:8080
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=TempAussen, state=-1.0
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=HumiAussen, state=64.8
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=IsRaining, state=ON
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=RainAmountLast1Hour, state=0.0
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=RainAmount, state=0.0
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=RainAmountYesterday, state=0.0
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=PressAussen, state=1033.60
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=WindSpeedAvg, state=0.0
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=WindSpeedPeak, state=0.0
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=WindDirectionStr, state=W
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=WindDirectionDeg, state=270
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=IlluAussen, state=0.0
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=SunIsShining, state=ON
Mar 21 21:14:23 openHABianPi test.py[12521]: oh.set_state(name=SunshineHoursToday, state=3.6

I figured out, my system was running with Python 2.7 by default. I made Python 3.5 as default version.
But the result is the same as shown above.

I also realized we are using different systemvariables at “homematic_name”.
e.g. your script is expecting “w_temperature” and my json is giving “w_temperatur” (without the e at end).
When you compare my JSON output with your script, you will find some differences:

{"modultyp":"weatherman","vars":[{"name":"0","homematic_name":"w_ip","desc":"weatherman_ip","type":"string","unit":"","value":"192.168.1.100"},{"name":"1","homematic_name":"w_temperatur","desc":"aussentemperatur","type":"number","unit":"gradC","value":"4.1"},{"name":"21","homematic_name":"w_windchill","desc":"gefuehlte_temperatur","type":"number","unit":"gradC","value":"4.1"},{"name":"9","homematic_name":"w_taupunkt","desc":"taupunkt_temperatur","type":"number","unit":"gradC","value":"-3.2"},{"name":"14","homematic_name":"w_himmeltemperatur","desc":"himmel_temperatur","type":"number","unit":"gradC","value":"0.0"},{"name":"2","homematic_name":"w_feuchte_rel","desc":"rel_feuchte","type":"number","unit":"%","value":"58.9"},{"name":"17","homematic_name":"w_feuchte_abs","desc":"abs_feuchte","type":"number","unit":"g/m3","value":"3.8"},{"name":"18","homematic_name":"w_regensensor_wert","desc":"regenmelderwert","type":"number","unit":"","value":"7"},{"name":"7","homematic_name":"w_regenmelder","desc":"regenstatus","type":"boolean","unit":"","value":"false"},{"name":"8","homematic_name":"w_regenstaerke","desc":"regenstaerke","type":"number","unit":"mm/h","value":"0.0"},{"name":"19","homematic_name":"w_regen_letzte_h","desc":"regen_pro_h","type":"number","unit":"mm","value":"0.0"},{"name":"20","homematic_name":"w_regen_mm_heute","desc":"regen_mm_heute","type":"number","unit":"mm","value":"0.0"},{"name":"32","homematic_name":"w_regenstunden_heute","desc":"regenstunden_heute","type":"number","unit":"h","value":"0.0"},{"name":"27","homematic_name":"w_regen_mm_gestern","desc":"regen_mm_gestern","type":"number","unit":"mm","value":"0.0"},{"name":"3","homematic_name":"w_barometer","desc":"nn_luftdruck","type":"number","unit":"mb","value":"1033.56"},{"name":"11","homematic_name":"w_barotrend","desc":"luftdrucktrend","type":"string","unit":"","value":"stabil"},{"name":"4","homematic_name":"w_wind_mittel","desc":"avg_windgeschwindigkeit","type":"number","unit":"m/s","value":"0.0"},{"name":"5","homematic_name":"w_wind_spitze","desc":"peak_windgeschwindigkeit","type":"number","unit":"m/s","value":"0.0"},{"name":"24","homematic_name":"w_windstaerke","desc":"bft_windgeschwindigkeit","type":"number","unit":"bft","value":"0"},{"name":"23","homematic_name":"w_windrichtung","desc":"windrichtung","type":"string","unit":"","value":"W"},{"name":"6","homematic_name":"w_wind_dir","desc":"windwinkel","type":"number","unit":"grad","value":"270"},{"name":"10","homematic_name":"w_lux","desc":"helligkeit","type":"number","unit":"lux","value":"0.0"},{"name":"22","homematic_name":"w_sonne_diff_temp","desc":"sonnen_difftemperatur","type":"number","unit":"gradC","value":"0.1"},{"name":"15","homematic_name":"w_sonnentemperatur","desc":"sonnen_temperatur","type":"number","unit":"gradC","value":"4.2"},{"name":"16","homematic_name":"w_sonne_scheint","desc":"sonne_scheint","type":"boolean","unit":"","value":"false"},{"name":"26","homematic_name":"w_sonnenstunden_heute","desc":"Sonnenstunden_heute","type":"number","unit":"h","value":"7.9"},{"name":"12","homematic_name":"w_elevation","desc":"sonne_elevation","type":"number","unit":"grad","value":"-34.2"},{"name":"13","homematic_name":"w_azimut","desc":"sonne_azimut","type":"number","unit":"grad","value":"325.0"},{"name":"30","homematic_name":"w_minuten_vor_sa","desc":"minuten_vor_sa","type":"number","unit":"min","value":"-970"},{"name":"31","homematic_name":"w_minuten_vor_su","desc":"minuten_vor_su","type":"number","unit":"min","value":"-243"}],"Systeminfo":{"MAC-Adresse":"xxx","Homematic_CCU_ip":"192.168.1.22","WLAN_ssid":"xxx","WLAN_Signal_dBm":"-84","sec_seit_reset":"140080","zeitpunkt":"2019.03.21/22:45:11","firmware":"weatherman_105"}}

But even if I rename the systemvariables of “homematic_name” in your script to the config of my Weatherman, I get the same error message.

What Weatherman Update version are you using?

Hi Ronny,

I’m still using an older version (v61) which has different names for the readings because I simply didn’t had the time to update yet. Anyhow, if the names don’t match the only effect is that they are not updated in OpenHAB.
If the test-script is working I really don’t know why there is a problem with the real script because the test-script uses exactly the data that crashed the real script.
Due to the shebang line the script should always use Python3 regardless what your system default is.
The only thing I can advise is to add debug output before the JSON decoder to see why this is causing the exception.

Regards

Steffen

Hi,

i installed the weatherman and tried to get it work with OH2

do i have to put the Service file to lib/systemd/System ?
And do i have to Change the path of the script, because i don´t have the Folder Tools?
I put the script file to the Folder /etc/openhab2/scripts/ and the .Service file to lib/systemd/System.
I also tried to change the user because i don´t have the user openhab.
But Nothing helps.

If i understand it right, the script should work on its own. So i tried to start it out of the cli.
My Studio Code reports an error, that it´s not possible to Import from openhab.

Unable to import 'openhab' pylint(import-error) [6,1]

nevertheless i tried start it at the cli and got this Output:

sudo python /etc/openhab2/scripts/wiffi2openhab.py  Traceback (most recent call last):
  File "/etc/openhab2/scripts/wiffi2openhab.py", line 6, in <module>
    from openhab import OpenHAB
ImportError: No module named 'openhab'

Your test script work.

i am running on python 3.4

hope you can help me

best regards
vaillan

Hi,

do i have to put the Service file to lib/systemd/System ?
This depends on your Linux distribution. On Raspbian it would be /etc/systemd/system.

And do i have to Change the path of the script, because i don´t have the Folder Tools?
Insert the absolute path of your script, whereever it is.

So i put it into the Folder /etc/openhab2/scripts/

OK

I also tried to change the user because i don´t have the user openhab.

No problem.

You can also try to start the script manually to test the connection and later add it as a service.

Best regards

Steffen

thx for Reply.

if i start the python script manually i get the Import error.

sudo python /etc/openhab2/scripts/wiffi2openhab.py  Traceback (most recent call last):
  File "/etc/openhab2/scripts/wiffi2openhab.py", line 6, in <module>
    from openhab import OpenHAB
ImportError: No module named 'openhab'

i am running on openhabian
what could that be, do i have to Change something in the script for openhabian?

You test script is working fine.

best regards
vaillan

Hi, the openhab library is missing. You can install it with:

sudo pip3 install python-openhab

Thx, already tried that.

But i think i had a corrupt python Installation
installing python 3.7.4 was not the best choice on raspian jessy :weary:

now i deleted all Cache, and corrupted python3 files in /var/lib/dpkg/info

Then i was able to go back to 3.4 python and now you script works great.

thank you for yor support

best regards
vaillan

Now everything seemed to work great, but after a day the python Task suspend.
So i get the Response, that there is already an open connection to the wiffi, and the python script is not working anymore.
i have to kill the Task, then it works great again - for one day.

I tried to execute the python script with your Service and with the openhab exec binding (every three minutes).
The Problem is the same, in one day, the python scripts seems not to disconnect correctly and the python Task stays open, so there is no reconnect possible anymore.

Do you have the same Problem?

best regards
vaillan

Hi, sorry again for the delay.

No I didn’t observe this issue yet. If you say “the Python task suspend”, how do you recognize this? Is it just that there are no new values in openHab or is the Python process somehow stalled?

Regards

Steffen

thx for rely.
the Output of the log is, that the script cannot run, because there is already a Connection.

i my router log, i can see, that there are many opened sessions between OH and the wiffi.

It seems to me, that the wffi don´t close the Connection Right after the script runs and the Python Task suspends if there is no port available anymore.

so it´s hard to figure out where the Problem is.
But if you don´t have any Problems with the script it seems to be a wiffi Problem.

looking for openhab at 192.168.0.120:8080
Traceback (most recent call last):
  File "/etc/openhab2/scripts/wiffi2openhab.py", line 284, in <module>
    server = socketserver.TCPServer((HOST, PORT), MyTCPHandler)
  File "/usr/lib/python3.4/socketserver.py", line 429, in __init__
    self.server_bind()
  File "/usr/lib/python3.4/socketserver.py", line 440, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/etc/openhab2/scripts/wiffi2openhab.py", line 294, in <module>
    server.server_close()
NameError: name 'server' is not defined

ps -fA | grep python                      openhab  18425   594  2 12:40 ?        00:00:03 python /etc/openhab2/scripts/wiffi2openhab.py
openhab+ 18739 18596  0 12:42 pts/1    00:00:00 grep --color=auto python

do you have any advices, how can i find out where the Problem is?

best regards
vaillan

Hi, no sorry - I don’t have a good idea how to find the problem. The Python script simply opens a port and waits for the wiffi to connect. If there are multiple sessions then you either started the script multiple times or the wiffi opens multiple connections.

Best regards

Steffen

Hey Guys,
I am pretty new on OH and I do not understand the folder structure.
I have the latest openhabian installed and I see totally different folders like

Openhab
\openHAB-conf
\openhabian
\openHAB-share

Could someone help where to place the files into the new structure?
I managet already to place the Items file at the correct position as the items are visible. However they do not have any values.
\OPENHAB\openHAB-share\openhab2-conf\items

Would be great if anybody could help.
Thanks

this is not the right thread, but the share Folder contains all folders you need - also the logging.

so you should use that Folder.

best regards
vaillan

anyway i would give Feedback to my weatherman Integration.

the wiffi2openhab script didn´t work for me.
the weatherman doesn´t close the sessions right, so after some time the session expire and i have to restart the Task.

my Workaround was, to Restart the Task after 4 Hours with cron, that worked better, but not perfect.

so i reactivate the http binding with jsonpath and that workes great now.

here is my config for the http.cfg in Folder Services:

weatherman.url=http://your_wethaerman_IP/json
weatherman.updateInterval=120000

and here is my items config:

Number                  TempAussen             "Aussentemperatur [%.1f %unit%]"      	{ http="<[weatherman:120000:JSONPATH($.vars.[1].value)]"}
Number:Temperature      Sonnentemperatur       "Sonnentemperatur [%.1f °C]"          	{ http="<[weatherman:120000:JSONPATH($.vars.[24].value)]"}           
Number:Temperature      TempSonneDifferenz     "Sonnentemperatur Differenz [%.1f °C]"	{ http="<[weatherman:120000:JSONPATH($.vars.[23].value)]"}
Number                  UV_Belastung           "UV Belastung"                           { http="<[weatherman:120000:JSONPATH($.vars.[22].value)]"}

Number:Dimensionless    HumiAussen             "Luftfeuchtigkeit Aussen [%.1f %%]"  	{ http="<[weatherman:120000:JSONPATH($.vars.[5].value)]"} 
Number:Pressure         PressAussen            "Luftdruck [%.2f hPa]"               	{ http="<[weatherman:120000:JSONPATH($.vars.[14].value)]"} 
String                  Luftdrucktrend         "Luftdrucktrend"                         { http="<[weatherman:120000:JSONPATH($.vars.[15].value)]"} 
Number:Illuminance      IlluAussen             "Helligkeit [%.0f lux]"              	{ http="<[weatherman:120000:JSONPATH($.vars.[21].value)]"} 

Number:Time             SunshineHoursToday     "Sonnenstunden [%.1f h]"             	{ http="<[weatherman:120000:JSONPATH($.vars.[26].value)]"}
Switch                  SunIsShining           "Sonne scheint"                     		{ http="<[weatherman:120000:JSONPATH($.vars.[25].value)]"}

Number                  RainAmount             "Regenmenge [%.1f mm/h]"            		{ http="<[weatherman:120000:JSONPATH($.vars.[9].value)]"} 
Number:Length           RainAmountLast1Hour    "Regenmenge 1h [%.1f mm]"           		{ http="<[weatherman:120000:JSONPATH($.vars.[10].value)]"} 
Number:Length           RainAmountToday        "Regenmenge 24h [%.1f l/m]"          	{ http="<[weatherman:120000:JSONPATH($.vars.[11].value)]"}
Number:Length           RainAmountYesterday    "Regenmenge gestern [%.1f mm]"       	{ http="<[weatherman:120000:JSONPATH($.vars.[13].value)]"} 
Switch                  IsRaining              "Regen Status"                   		{ http="<[weatherman:120000:JSONPATH($.vars.[8].value)]"} 

Number                  WindSpeedAvg           "Windgeschwindigkeit [%.1f m/s]" 		{ http="<[weatherman:120000:JSONPATH($.vars.[16].value)]"}
Number                  WindSpeedPeak          "Windgeschwindigkeit Peak [%.1f m/s]"	{ http="<[weatherman:120000:JSONPATH($.vars.[17].value)]"} 
String                  WindDirectionStr       "Windrichtung"                        	{ http="<[weatherman:120000:JSONPATH($.vars.[19].value)]"}

best regards

vaillan