[SOLVED] What is the status on the Weather binding?

I migrated from v1 to v2.
Have weather1 in addons.cfg
However, the documentation https://www.openhab.org/addons/bindings/weather1/ says: This does not work for OpenHAB2 and this page needs an update for how to use this on OH2.
“This” is referring to embedding the weather HTML page into the sitemap.

The OHv2 weather binding seems to have only three channels… which seems pretty useless, when comparing it to the v1 binding.

What do need to explore to get something similar to this v1 web view:
image

Also, out of interest. where does the weather.zip file contents has to go on a v2 system.
Or, where is the jetty folder where these files need to go?

@Max_G

This is also possible in OH2! (I use ‘weather’ in OH2 on a Windows system!)

Your weather configuration goes to (if you are on Windows, if not, see at the bottom):

 \conf\services\weather.cfg

The weather.zip you have to devide up:

the folder “images” (and all subfolders) goes to:

\conf\html\weather-data\images

the folder “layouts” goes to:

\conf\html\weather-data\layouts

move the example.html from

\conf\html\weather-data\layouts
to
\userdata\webapps\weather-data\layouts

Edit the example.html

first change all “paths” inside (after the word “static”):

 <link rel="stylesheet" type="text/css" href="static/weather-data/layouts/example.css" />
 <script type="text/javascript" src="static/weather-data/layouts/example.js"></script>

 <td rowspan="2"><img id="weather-icon" src="static/weather-data/images/${param:iconset}/${weather:condition.commonId}.png"/></td>

        <td><img src="static/weather-data/images/${param:iconset}/${forecast(0):condition.commonId}.png"/></td>
		<td><img src="static/weather-data/images/${param:iconset}/${forecast(1):condition.commonId}.png"/></td>
		<td><img src="static/weather-data/images/${param:iconset}/${forecast(2):condition.commonId}.png"/></td>
		<td><img src="static/weather-data/images/${param:iconset}/${forecast(3):condition.commonId}.png"/></td>

.
.sitemap: change “locationId” (if you are useing it) to your corresponding “locationId” from weather.cfg and “layout” =example (the name comes from example.html (without .html)

   Webview url="/weather?locationId=home&layout=example&iconset=colorful" height=15

.
The rest should be the same like in OH1.

EDIT: (default file locations)

System			         Linux				            Linux				        Windows
===========================================================================================================
File Location		     Repository Installation		Manual Installation		
openHAB application	     /usr/share/openhab2		    /opt/openhab2			    C:\openHAB2\runtime
Additional add-on files	 /usr/share/openhab2/addons	    /opt/openhab2/addons		C:\openHAB2\addons
Site configuration	     /etc/openhab2			        /opt/openhab2/conf		    C:\openHAB2\conf	
Log files		         /var/log/openhab2		        /opt/openhab2/userdata/logs	C:\openHAB2\userdata\logs
Userdata like rrd4j db 	 /var/lib/openhab2	            /opt/openhab2/userdata		C:\openHAB2\userdata
Backups folder		     /var/lib/openhab2/backups	    /opt/openhab2/backups		(not preconfigured)
Service configuration	 /etc/default/openhab2		    (not preconfigured)		    C:\openHAB2\userdata\etc

.
.
Mine looks like:
.
image

1 Like

Thanks for the detailed reply… Yesterday, I decided to give up on Yahoo weather, due to the information I had at hand. But seeing that it can work, I will have another go at it.

I see your table of paths…
However, where is ‘conf’ on a Linux system?

A find will produce this:

sudo find / -name conf
/proc/sys/net/ipv4/conf
/proc/sys/net/ipv6/conf
find: ‘/proc/20143’: No such file or directory
/var/lib/apache2/conf

I see a html folder here:

# [2018-12-30 09:10] maxg@rpi3ohv2 /etc/openhab2 $
ls -la
total 256
drwxr-xr-x 14 openhab openhab   4096 Dec 26 10:01 .
drwxr-xr-x 94 root    root      4096 Dec 26 16:49 ..
drwxrwxrwx  2 openhab openhab   4096 Dec 30 09:02 helpers
drwxr-xr-x  2 openhab openhab   4096 Dec 26 16:44 html
drwxr-xr-x  3 openhab openhab   4096 Nov 13 21:06 icons
drwxr-xr-x  2 openhab openhab   4096 Dec 29 09:58 items
drwxr-xr-x  2 openhab openhab   4096 Dec 26 16:44 persistence
drwxr-xr-x  2 openhab openhab   4096 Dec 28 14:16 rules
drwxr-xr-x  2 openhab openhab   4096 Dec 26 16:44 scripts
drwxr-xr-x  2 openhab openhab   4096 Dec 28 12:04 services
drwxr-xr-x  2 openhab openhab   4096 Dec 26 16:44 sitemaps
drwxr-xr-x  2 openhab openhab   4096 Dec 26 16:44 sounds
drwxr-xr-x  2 openhab openhab   4096 Dec 26 16:44 things
drwxr-xr-x  2 openhab openhab   4096 Dec 29 09:50 transform

just checked, this html folder is what is visible under localhost:8080.

Also, I have done a standard apt-get install, and all my config is in /etc/openhab2 (as shown above).

To translate then, all files go into /etc/openhab2/:

services/weather.cfg
html/weather-data/images
html/weather-data/layouts
html/example.html

Leaves ‘static’ to the resource pointers. In OHv1 this was a directory under webapps/. What is the path under OH2?

/var/lib/openhab2/webapps/

But you don’t need a folder ‘static’ there. Just change the path in the example.html like in my instructions.

And move the example.html to

 /var/lib/openhab/webapps/weather-data/layouts/

Keep in mind that the current yahoo weather api is going end of life January 3rd.

2 Likes

@namraccr

Thank you very much, for this information.

Yahoo will switch to an other API service, but then useing OAuth…
and you also need

"App ID", "Client ID (Consumer Key)", and "Client Secret (Consumer Secret)" for future use.

.
Are you or respectively @kai aware of it, what about the “yahooweather” binding?

Which of the other free services could you recommend for useing it with weather1 binding?

ForecastIo
OpenWeatherMap
WorldWeatherOnline
Wunderground
Hamweather
Meteoblue

Btw, Wunderground will stop it’s API, too. See here. It will stop after 31th of December 2018 !

Hi,

OpenWeatherMap or darksky.net (former ForecastIO) seem to be sufficient and stable (for me, in Germany), at least on OH2.3. But I’m still testing and have no final opinion at the moment. It’s a lot of trouble… :frowning:

Cheers,
Marianne

1 Like

Yes, Kai is quite aware. There are two PRs for removing the yahoo support from OH1 and OH2/ESH.

I like the meteoblue service, but I haven’t tried the others.

1 Like

Thank you! I took a look at all services! Then I’ve switched to darksky.net (former ForecatIO) 15 min ago.

And, it is running well!
.
.

image
.
.

And the weather forecast seems to deliver better weather there! :grinning::grinning::grinning:

FYI

.
.

So I changed my providers:

for OH1 binding ‘weather1’:

from provider Yahoo to darksky.net (former ForecastIO)
.
.
from OH2 binding ‘yahooweather

to OH2 binding openweathermap

1 Like

I am still trying to figure out how this is supposed to work… in particular the path names… namely “conf”… which I do not have.

I have a standard OHv2 install, which sets these environment variables:

OPENHAB_BACKUPS=/var/lib/openhab2/backups
OPENHAB_CONF=/etc/openhab2
OPENHAB_GROUP=openhab
OPENHAB_HOME=/usr/share/openhab2
OPENHAB_HTTP_PORT=8080
OPENHAB_HTTPS_PORT=8443
OPENHAB_LOGDIR=/var/log/openhab2
OPENHAB_RUNTIME=/usr/share/openhab2/runtime
OPENHAB_USER=openhab
OPENHAB_USERDATA=/var/lib/openhab2

Also, there is no webapps folder.
Why are the relevant files spread over so many directories?

And to make matters worse, the runtime/bin/oh2_dir_layout file point conf to:

if [ -z ${OPENHAB_CONF} ]; then
    export OPENHAB_CONF="${OPENHAB_HOME}/conf"
fi

with

OPENHAB_HOME=/usr/share/openhab2

–> /usr/share/openhab2/conf

Sorry, I am really lost, and want to set this up properly. :frowning:

Care to share your config? (Please?)

I dealt with Yahoo weather once, when I installed it four years ago.
Hence, if I can avoid it, I wouldn’t want to learn to set this up; just copy and be done with it. :slight_smile:

@Max_G

Ok, I try to translate the windows paths to your linux paths:

/etc/openhab2/services/weather.cfg

/etc/openhab2/html/weather-data/images/
/etc/openhab2/html/weather-data/layouts/

/var/lib/openhab2/webapps/weather-data/layouts/example.html

EDIT the example.html and change the following:

<link rel="stylesheet" type="text/css" href="static/weather-data/layouts/example.css" />
<script type="text/javascript" src="static/weather-data/layouts/example.js"></script>

<td rowspan="2"><img id="weather-icon" src="static/weather-data/images/${param:iconset}/${weather:condition.commonId}.png"/></td>


        <td><img src="static/weather-data/images/${param:iconset}/${forecast(0):condition.commonId}.png"/></td>
		<td><img src="static/weather-data/images/${param:iconset}/${forecast(1):condition.commonId}.png"/></td>
		<td><img src="static/weather-data/images/${param:iconset}/${forecast(2):condition.commonId}.png"/></td>
		<td><img src="static/weather-data/images/${param:iconset}/${forecast(3):condition.commonId}.png"/></td>

.
.
If you had setup the weather.cfg (e.g. with Yahoo) then it should run until tomorrow! Then you have to change the provider in weather.cfg, e.g. DarkSky = ForecastIo !

here is mine:

# The apikey for the different weather providers, at least one must be specified
# Note: Hamweather requires two apikeys: client_id=apikey, client_secret=apikey2
apikey.ForecastIo=jfjsfsfasnkjwrnwngojgwgflkgfslkgsa
#apikey.OpenWeatherMap=
#apikey.WorldWeatherOnline=
#apikey.Wunderground=
#apikey.Hamweather=
#apikey2.Hamweather=
#apikey.Meteoblue=

# location configuration, you can specify multiple locations
location.home.name=Brisbane
location.home.latitude=-27.4145
location.home.longitude=153.0004
#location.home.woeid=
location.home.provider=ForecastIo
location.home.language=de
location.home.updateInterval=120

#location.<locationId2>.name=
#location.<locationId2>.latitude=   (not required for Yahoo provider)
#location.<locationId2>.longitude=  (not required for Yahoo provider)
#location.<locationId2>.woeid=      (required for Yahoo provider)
#location.<locationId2>.provider=
#location.<locationId2>.language=
#location.<locationId2>.updateInterval=
1 Like

Thanks for bearing with me.

This was the key bit of info… use the weather1 binding, and change it to ForecastIo using a DarkSky API key.

Thanks, will give it a go…

Huh, are you a Brisbanite?! I am a 100km out west… :slight_smile:

NO, I’m not. But I saw in your profile that you are living in Queensland. So I used coordinates of Brisbane to make it easier for you. :slight_smile:

Was anyone able to get this to work? I am struggling as well using openhab2 on a Raspberry PI. The weather applet is trying to look for files on the webapps directory and that directory doesn’t exist. Trying to follow threads like this but nothing seems to pan out.

I haven’t started yet; done too much migrating the last few days :slight_smile:

But, I have done the ot-recorder today, and used the /etc/openhab2/html directory to place my location web file into it and it worked by calling it with http://192.168.1.5:8080/static/geolocMap.html in the sitemap, and this works.
Hence, I will place the weather html file there too.

Happy to report back when I finished it off (most likely Friday).

Wonderful, thank you, looking forward to your findings.