Template Example: Weather Binding

Hey Guys,

I’m a complete noob just getting into OpenHab and I can’t seem to get any part of this widget to work:

My template code is exactly like the post AndyMB made about the newer version of code that handles the NULL values but I’m not sure why mine is still not working.

Does anybody know what’s going on with my setup?

In your items file where is says [your location] you need to replace that by the location that you configured in your weather.cfg file.

For example if you configured the weather.cfg as follows:

location.home.provider=OpenWeatherMap
location.home.language=en
location.home.updateInterval=10
location.home.units=si

then your items file will look like this:

Number   Temperature       "Temperature [%.2f °C]"      {weather="locationId=home, type=temperature, property=current"}
Number   Humidity          "Humidity [%d %%]"           {weather="locationId=home, type=atmosphere, property=humidity"}
Number   Pressure          "Pressure [%.2f mb]"         {weather="locationId=home, type=atmosphere, property=pressure"}

DateTime ObservationTime0  "Observation time [%1$td.%1$tm.%1$tY %1$tH:%1$tM]" 	{weather="locationId=home, forecast=0, type=condition, property=observationTime"}
DateTime ObservationTime1  "Observation time [%1$td.%1$tm.%1$tY %1$tH:%1$tM]"   {weather="locationId=home, forecast=1, type=condition, property=observationTime"}
DateTime ObservationTime2  "Observation time [%1$td.%1$tm.%1$tY %1$tH:%1$tM]"   {weather="locationId=home, forecast=2, type=condition, property=observationTime"}

Number   Temp_Min0         "Temperature min [%.2f °C]"  {weather="locationId=home, forecast=0, type=temperature, property=min"}
Number   Temp_Max0         "Temperature max [%.2f °C]"  {weather="locationId=home, forecast=0, type=temperature, property=max"}
Number   Temp_Min1         "Temperature min [%.2f °C]"  {weather="locationId=home, forecast=1, type=temperature, property=min"}
Number   Temp_Max1         "Temperature max [%.2f °C]"  {weather="locationId=home, forecast=1, type=temperature, property=max"}
Number   Temp_Min2         "Temperature min [%.2f °C]"  {weather="locationId=home, forecast=2, type=temperature, property=min"}
Number   Temp_Max2         "Temperature max [%.2f °C]"  {weather="locationId=home, forecast=2, type=temperature, property=max"}

String   Condition0        "Condition [%s]"    	        {weather="locationId=home, forecast=0, type=condition, property=text"}
String   Condition1        "Condition [%s]"   	        {weather="locationId=home, forecast=1, type=condition, property=text"}
String   Condition2        "Condition [%s]"	        {weather="locationId=home, forecast=2, type=condition, property=text"}

String   Condition_ID0     "Condition id [%s]"          {weather="locationId=home, forecast=0, type=condition, property=id"}
String   Condition_ID1     "Condition id [%s]"          {weather="locationId=home, forecast=1, type=condition, property=id"}
String   Condition_ID2     "Condition id [%s]"          {weather="locationId=home, forecast=2, type=condition, property=id"}

When using openweathermap.org the IDs do not seem to match with the ID list provided in this topic (I do not know for which provider they are). For example, I see ‘heavy intensity rain’ using ID 502, ‘moderate rain’ with ID 501 and ‘light rain’ with ID 500. These IDs are all not in the provided list.
I have not yet done a mapping for these.

Wow thanks for that! Obviously I’m a noob haha. So I changed locationID to match my weather.cfg file but now I’m thinking my weather.cfg file is wrong since I had it commented out (stupid me). I’m using wunderground but I still have the same issue with the widget so can anyone see anything wrong with my weather.cfg file?

Here is my weather.cfg:

I would change the following

location.home.language=en
location.home.updateInterval=5

Not sure if there is a difference between upper- and lowercase language, but in the wiki example it is in lowercase.
The updateInterval is in minutes, so your 300 would be once every 5 hours. Especially during testing it’s nice to see frequent updates.

Check the events.log file. There you should see the actual values that get assigned to the items. If the items receive the correct values then your weather binding is configured correctly.

Thanks for the tips Marcel, it’s still not working but I’m going to now looks through the logs to see if I can find anything.

I’ve created a Python script which outputs the commands that one needs to run to copy the images to the matching numeric Condition_IDn icon names for your weather provider.

Currently it does not support ForecastIO and Wunderground because they don’t seem to use IDs.

#!/usr/bin/python

from xml.dom.minidom import parseString
import xml.dom.minidom
import urllib

'''
<common-id-mappings>
  <common-id-mapping id="thunder">
    <provider name="Yahoo" ids="0,3,4,17,35,38"/>
    <provider name="OpenWeatherMap" ids="200, 201, 202, 210, 211, 212, 221, 230, 231, 232, 906"/>
    <provider name="WorldWeatherOnline" ids="392, 386, 200, 389"/>
    <provider name="Hamweather" ids="A,T"/>
    <provider name="ForecastIO" icons="hail, thunderstorm, tornado"/>
    <provider name="Wunderground" icons="tstorms"/>
    <provider name="MeteoBlue" ids="8"/>
  </common-id-mapping>
'''

opener = urllib.FancyURLopener()
f = opener.open("https://raw.githubusercontent.com/openhab/openhab1-addons/master/bundles/binding/org.openhab.binding.weather/src/main/resources/weather/common-id-mappings.xml")
dom = parseString(f.read())

root = dom.documentElement
commonIdMappings = root.getElementsByTagName("common-id-mapping")

unsupportedProviders = []
weatherProviders = []
for commonIdMapping in commonIdMappings:
    providers = commonIdMapping.getElementsByTagName('provider')
    for provider in providers:
        if provider.hasAttribute("ids"):
            if not provider.getAttribute("name") in weatherProviders:
                weatherProviders.append(provider.getAttribute("name"))
        else:
           if not provider.getAttribute("name") in unsupportedProviders:
                unsupportedProviders.append(provider.getAttribute("name"))

unsupportedProviders.sort()            
weatherProviders.sort()

print "\nThis script makes no changes to your filesystem. It only prints the commands"
print "that you need to run to copy the <weathertype>.png images to <id>.png images"
print "for your weather provider.\n"
print "The following providers are currently not supported:"
for weatherProvider in unsupportedProviders:
    print "*", weatherProvider
print ""

index = 0
for weatherProvider in weatherProviders:
    print "[%s] %s" % (index, weatherProvider)
    index += 1

response = input("Select weather provider: ")
weatherProvider = weatherProviders[response]

print ""
shellCommands = ['sudo cp', 'cp', 'copy']
index = 0
for shellCommand in shellCommands:
    print "[%s] %s" % (index, shellCommand)
    index += 1

response = input("Select shell command to use: ")
shellCommand = shellCommands[response]

for commonIdMapping in commonIdMappings:
    picture = commonIdMapping.getAttribute("id")
    providers = commonIdMapping.getElementsByTagName('provider')
    for provider in providers:
        if provider.hasAttribute("ids"):
            if provider.getAttribute("name") == weatherProvider:
                ids = provider.getAttribute("ids")
                for id in ids.split(','):
                    print "%s %s.png %s.png" % (shellCommand, picture, id.strip())

print "\n\n== Make sure that correct file permissions are assigned to the copied files =="
1 Like

That’s awesome. I’d love to see how you have done it! Do you have a link or post the code here?

1 Like

Awesome instructions… Thank you Andy and rest of guys.

Couple of thing still in my mind…

  1. to all noob like me weather.items need to put of course item folder (near html folder).

  2. I got visualization working buy reading this and Weather binding in OH2

I still have problem in updating that view.
because it load weather data only once and not update it ever.
Last two line in log file say interval is 10 min but visualization not updated.

2017-07-10 08:56:39.916 [INFO ] [ternal.scheduler.WeatherJobScheduler] - Starting and scheduling weatherJob-home-OWM with interval of 10 minutes
2017-07-10 08:56:39.920 [INFO ] [ternal.scheduler.WeatherJobScheduler] - Starting and scheduling weatherJob-home-WUG with interval of 10 minutes

So what I missing/not understand?

Very good work! Any chance to have the HTML code?

Thanks

quick question for a minor issue:

When using the original code for the weather template widget I get an error in the developers console of Chrome (F12):

selected parts of the code:

{{'%.1f' | sprintf:itemValue('WU_Temp')}}
{{'%d' | sprintf:itemValue('WU_Humid')}} %
{{'%.0f' | sprintf:itemValue('WU_Press')}} mbar
{{'%d' | sprintf:itemValue('WU_Prec')}} %

The result looks good but with errors:

If I switch all lines to %s (string) the error goes away but the result doesn’t look good (with .00) :slight_smile:

How should I write the sprintf lines to format the output as a number (and not get those type errors)?

My item states are:

openhab> items list |grep -i WU
WU_Temp (Type=NumberItem, State=27.00, Label=Temperature, Category=temperature, Groups=[gWeather, gInflux])
WU_Humid (Type=NumberItem, State=61.00, Label=Humidity, Category=humidity, Groups=[gWeather])
WU_Press (Type=NumberItem, State=1013.00, Label=Pressure, Category=humidity, Groups=[gWeather])
WU_Prec (Type=NumberItem, State=10.00, Label=Precip Probability, Category=water, Groups=[gWeather])

I am still playing around with https://en.wikipedia.org/wiki/Printf_format_string myself and maybe I will find it, but I am always open to ideas :slight_smile:

Hi @Dim,

Interesting, I confirm I have the same symptoms (mental note F12 your code Andy). My guess would be that the function ‘itemValue()’ is consistently returning a string, rather than taking account of the ‘data type’ specified in the item. Perhaps @ysc could confirm? Or you could dig through the HABpanel source to check.

I’ll take a look at this one when I have some time, but at the end of the day it does feel like a classic case of ‘if it ain’t broke don’t fix it’! It’s throwing an error but then performing an implicit conversion any way, so stress not… :smiley:

If I’m perfectly honest, looking into this will be pretty low on my list as I’m knee deep in finishing off a new binding for TiVo devices. After that I want to come up with tidied up version of the HTML (better CSS, DIV and Bootstrap ‘grid’ use) for this widget. Been on the list for months :frowning: now where is that time compression software again…

If you do work out a better way, do share. But as always, bear in mind effort/overhead versus reward.

Andy

1 Like

Indeed, because the rest/items endpoint of the API always sends strings.

1 Like

Hi I’m using the WeatherUndergroud Binding to receive my weather information.
In this case i don’t have a “weather.items” to configure the needed elements…
how i have to configure the wideget-code?

Hi @idznak,

You will need to amend the source HTML and replace the calls to the items that I have used with the ones you have created for use with the WeatherUndergroud binding. Each time you see Item data retrieved with itemValue('Temperature'), you will need to replace the item name with the one you have setup.

For example:

  1. itemValue('ObservationTime0') with itemValue('ObservationTime').
  2. itemValue('Condition0') with itemValue('ForecastCondition')
  3. itemValue('Condition1') with an item bound to the conditions channel with the forecastTomorrow parameter **
  4. itemValue('Condition2') with an item bound to the conditions channel with the forecastDay2 parameter **
  5. itemValue('ObservationTime1') with an item bound to the forecastTime channel with the forecastTomorrow parameter **
  6. itemValue('ObservationTime2') with an item bound to the forecastTime channel with the forecastDay2 parameter **
  7. itemValue('Temp_Max0') with itemValue('ForecastTempMax')
  8. itemValue('Temp_Max1') with an item bound to the maxTemperature channel with the forecastTomorrow parameter **
  9. itemValue('Temp_Max2')with an item bound to the maxTemperature channel with the forecastDay2 parameter **
  10. itemValue('Temp_Min0') with itemValue('ForecastTempMin')
  11. itemValue('Temp_Min1')with an item bound to the maxTemperature channel with the forecastTomorrow parameter **
  12. itemValue('Temp_Min2')with an item bound to the maxTemperature channel with the forecastDay2 parameter **

** These items are not available within example demo.items so will need to be added for use with this template.

  • The following items names are the same in demo.items as I used, so you do not need to replace these ones unless you have chosen to use a different item name:
  1. itemValue('Temperature')
  2. itemValue('Humidity')
  3. itemValue(Pressure)
  • You will need to rename the icon file name, so that they match the values supplied by WU. The binding seems to return an image object. I don’t think that you will be able to use this / retrieve it for use in the HTML as the function itemValue() always returns a string (image to string conversion is not going to work :smiley: !!!).

  • There are demo icon sets available here https://www.wunderground.com/weather/api/d/docs?d=resources/icon-sets you could either use these or use them to work out what file names you would need.

Hope this helps. I have no plans to use this binding myself, but let me know how you get on.

HINT! Be very careful on the search and replace actions. Every character is essential! Once you loose a quote’ or a bracket ) the HTML can stop working and it is very hard to spot what has been screwed up. So take your time and after a couple of changes check the HTML is looking OK in HABpanel. That way you have less to debug.

Regards, Andy

Hi Andy,

thanks for your detailed help.
My weather widget works now with the wunderground binding

Best Regards
Idznak

All,

I have been working on building out my dashboards in OpenHAB recently and am pushing through minor detail after minor detail… lol. I have taken a lot of your work and implemented in my environment and made it mine with little to no changes. Your stuff is that good. Thank you for putting this out there for everyone to use.

I have taken your weather widget and made a few modifications to it to suite my needs. Below is a screenshot of my Foyer dashboard (pretty bare right now, but trying to work through the major things first).

*** One note I would like to make is that with the weather binding in PaperUI, it doesn’t show up in the list of installed bindings as it was intended for OpenHAB 1.X. Just modify the file manually (I supplied mine below). It’s at /etc/openhab/services/weather.cfg

Also, I had an issue with it not working at all. The problem was that even though the weather.cfg file was configured correctly, it wasn’t working properly. To fix, stop openhab2 service and delete the following file below:

*If you take a quick look at this file before deleting it, you might notice incorrect text in it.
/var/lib/openhab2/config/org/openhab/weather.config

Restart openhab2 service and the file will get recreated correctly from the weather.cfg file (/etc/openhab2/services/weather.cfg).

I have made a few minor changes to the template code. One required an addition in the example.css file:

smallerfont { 
    font-style: normal;
    font-size: 75%;
    text-transform: uppercase;
}

The current weather widget code I’m using is below. Please take note to the comment lines I added explaining most of my changes.

<div ng-init="ServerPath='http://192.168.X.X:8080/static/weatherdata'; IconSet='colorful'">
<link rel="stylesheet" type="text/css" href="{{ServerPath}}/layouts/example.css" />
</div>

<!--Removed the Observation Time division simple to free up some space.-->

<table id="weather-table">
	<tr>
<!--Changed ".replace(' ','-')" with ".split(' ').join('-')" as the original was giving me problems with loading image files.-->
		<td rowspan="2"><img id="weather-icon" src="{{ServerPath}}/images/{{IconSet}}/{{itemValue('Condition0').split(' ').join('-') | lowercase }}.png"/></td>
<!--Added in a "smallerfont" in the example.css spreadsheet to make the Fahrenheit "F" slightly smaller. 75% to be exact.-->
		<td id="weather-temp">{{'%.0f' | sprintf:itemValue('Temperature_F')}} <smallerfont>°F</smallerfont></td>
	</tr>
	<tr>
		<td colspan="2">
			<table id="weather-table-details">
				<tr>
<!--Added &nbsp for some spacing to match the pressure below.-->
					<td>Humidity:&nbsp</td>
<!--Added %.0f to get rid of the decimals on the humidity value.-->
					<td>{{'%.0f' | sprintf:itemValue('Humidity')}} %</td>
				</tr>
				<tr>
<!--Added &nbsp for some spacing after the colon due to the extra characters in the pressure from changing it to inches of mercury.-->
					<td>Pressure:&nbsp</td>
<!--Changed the following line to give me pressure in inches of mercury. Also modified it to %.2f to add the common 2 decimal places in this value.-->
					<td>{{'%.2f' | sprintf:itemValue('Pressure_Inches')}} Hg</td>
        </tr>
			</table>
<!--Added in the following 2 breaks for vertical spacing.-->
      <br></br>
      <br></br>
		</td>
    </tr>
    <tr>
<!--Removed <td/> column for horizontal spacing.-->
        <td>Today</td>
        <td>{{itemValue('ObservationTime1') | date:'EEEE'}}</td>
        <td>{{itemValue('ObservationTime2') | date:'EEEE'}}</td>
    </tr>
    <tr>
<!--Removed <td/> column for horizontal spacing.-->
        <td>
            <img id="weather-icon" src="{{ServerPath}}/images/{{IconSet}}/{{itemValue('Condition0').split(' ').join('-') | lowercase }}.png"/>
            <p>{{itemValue('Condition0')}}</p>
        </td>
        <td>
            <img id="weather-icon" src="{{ServerPath}}/images/{{IconSet}}/{{itemValue('Condition1').split(' ').join('-') | lowercase }}.png"/>
            <p>{{itemValue('Condition1')}}</p>
        </td>
        <td>
            <img id="weather-icon" src="{{ServerPath}}/images/{{IconSet}}/{{itemValue('Condition2').split(' ').join('-') | lowercase }}.png"/>
            <p>{{itemValue('Condition2')}}</p>
        </td>
    </tr>
    <tr>
<!--Removed Max text. This also removed a column from the bottom.-->
        <td class="col-xs-4" style="color:red">{{'%.0f' | sprintf:itemValue('Temp_Max0')}} °F</td>
        <td class="col-xs-4" style="color:red">{{'%.0f' | sprintf:itemValue('Temp_Max1')}} °F</td>
        <td class="col-xs-4" style="color:red">{{'%.0f' | sprintf:itemValue('Temp_Max2')}} °F</td>
    </tr>
    <tr>
<!--Removed Min text. This also removed a column from the bottom.-->
        <td class="col-xs-4" style="color:#0db9f0">{{'%.0f' | sprintf:itemValue('Temp_Min0')}} °F</td>
        <td class="col-xs-4" style="color:#0db9f0">{{'%.0f' | sprintf:itemValue('Temp_Min1')}} °F</td>
        <td class="col-xs-4" style="color:#0db9f0">{{'%.0f' | sprintf:itemValue('Temp_Min2')}} °F</td>
    </tr>
</table>
<p/>

Almost forgot my items file. I commented out the items I’m not currently using.

// atmosphere
Number   Humidity         "Humidity [%d %%]"      {weather="locationId=home, type=atmosphere, property=humidity"}
//Number   Visibility       "Visibility [%.2f km]"  {weather="locationId=home, type=atmosphere, property=visibility"}
Number   Visibility_Mph   "Visibility [%.2f mi]"  {weather="locationId=home, type=atmosphere, property=visibility, unit=mph"}
//Number   Pressure         "Pressure [%.2f mb]"    {weather="locationId=home, type=atmosphere, property=pressure"}
Number   Pressure_Inches  "Pressure [%.2f in]"    {weather="locationId=home, type=atmosphere, property=pressure, unit=inches"}
String   Pressure_Trend   "Pressuretrend [%s]"    {weather="locationId=home, type=atmosphere, property=pressureTrend"}
Number   Ozone            "Ozone [%d ppm]"        {weather="locationId=home, type=atmosphere, property=ozone"}
Number   UV_Index         "UV Index"              {weather="locationId=home, type=atmosphere, property=uvIndex, scale=0"}

// clouds
Number   Clouds   "Clouds [%.0f %%]"   {weather="locationId=home, type=clouds, property=percent"}

// condition
String   Condition        "Condition [%s]"      {weather="locationId=home, type=condition, property=text"}
String   Condition0        "Condition [%s]"     {weather="locationId=home, forecast=0, type=condition, property=text"}
String   Condition1        "Condition [%s]"     {weather="locationId=home, forecast=1, type=condition, property=text"}
String   Condition2        "Condition [%s]"     {weather="locationId=home, forecast=2, type=condition, property=text"}
String   Condition_ID     "Condition id [%s]"   {weather="locationId=home, type=condition, property=id"}
DateTime ObservationTime  "Observation time [%1$td.%1$tm.%1$tY %1$tH:%1$tM]"   {weather="locationId=home, type=condition, property=observationTime"}
DateTime ObservationTime0  "Observation time [%1$td.%1$tm.%1$tY %1$tH:%1$tM]"   {weather="locationId=home, forecast=0, type=condition, property=observationTime"}
DateTime ObservationTime1  "Observation time [%1$td.%1$tm.%1$tY %1$tH:%1$tM]"   {weather="locationId=home, forecast=1, type=condition, property=observationTime"}
DateTime ObservationTime2  "Observation time [%1$td.%1$tm.%1$tY %1$tH:%1$tM]"   {weather="locationId=home, forecast=2, type=condition, property=observationTime"}
DateTime ObservationTime3  "Observation time [%1$td.%1$tm.%1$tY %1$tH:%1$tM]"   {weather="locationId=home, forecast=2, type=condition, property=observationTime"}
DateTime LastUpdate       "Last update [%1$td.%1$tm.%1$tY %1$tH:%1$tM]"        {weather="locationId=home, type=condition, property=lastUpdate"}
String   CommonId         "Common id [%s]"      {weather="locationId=home, type=condition, property=commonId"}

// precipitation
Number   Rain_Inches   "Rain [%.2f in/h]"   {weather="locationId=home, type=precipitation, property=rain, unit=inches"}
Number   Snow_Inches   "Snow [%.2f in/h]"   {weather="locationId=home, type=precipitation, property=snow, unit=inches"}
Number   Precip_Probability   "Precip probability [%d %%]"   {weather="locationId=home, type=precipitation, property=probability"}
// new total property in 1.8, only Wunderground
Number   Precip_Total_Inches  "Precip total [%d in]"   {weather="locationId=home, type=precipitation, property=total, unit=inches"}

// temperature
Number   Temperature_F    "Temperature [%.2f °F]"       {weather="locationId=home, type=temperature, property=current, unit=fahrenheit"}
Number   Temp_Feel_F      "Temperature feel [%.2f °F]"  {weather="locationId=home, type=temperature, property=feel, unit=fahrenheit"}
Number   Temp_Dewpoint_F  "Dewpoint [%.2f °F]"          {weather="locationId=home, type=temperature, property=dewpoint, unit=fahrenheit"}
// min and max values only available in forecasts
Number   Temp_Min         "Temperature min [%.2f °F]"   {weather="locationId=home, type=temperature, property=min, unit=fahrenheit"}
Number   Temp_Min0         "Temperature min [%.2f °F]"  {weather="locationId=home, forecast=0, type=temperature, property=min, unit=fahrenheit"}
Number   Temp_Min1         "Temperature min [%.2f °F]"  {weather="locationId=home, forecast=1, type=temperature, property=min, unit=fahrenheit"}
Number   Temp_Min2         "Temperature min [%.2f °F]"  {weather="locationId=home, forecast=2, type=temperature, property=min, unit=fahrenheit"}
Number   Temp_Max         "Temperature max [%.2f °F]"   {weather="locationId=home, type=temperature, property=max, unit=fahrenheit"}
Number   Temp_Max0         "Temperature max [%.2f °F]"  {weather="locationId=home, forecast=0, type=temperature, property=max, unit=fahrenheit"}
Number   Temp_Max1         "Temperature max [%.2f °F]"  {weather="locationId=home, forecast=1, type=temperature, property=max, unit=fahrenheit"}
Number   Temp_Max2         "Temperature max [%.2f °F]"  {weather="locationId=home, forecast=2, type=temperature, property=max, unit=fahrenheit"}
Number   Temp_Max_F       "Temperature max [%.2f °F]"   {weather="locationId=home, type=temperature, property=max, unit=fahrenheit"}
String   Temp_MinMax_F    "Min/Max [%s °F]"             {weather="locationId=home, type=temperature, property=minMax, unit=fahrenheit"}

// wind
//Number   Wind_Speed           "Windspeed [%.2f km/h]"    {weather="locationId=home, type=wind, property=speed"}
//Number   Wind_Speed_Beaufort  "Windspeed Beaufort [%d]"  {weather="locationId=home, type=wind, property=speed, unit=beaufort"}
//Number   Wind_Speed_Knots     "Windspeed [%.2f kn]"      {weather="locationId=home, type=wind, property=speed, unit=knots"}
//Number   Wind_Speed_Mps       "Windspeed [%.2f mps]"     {weather="locationId=home, type=wind, property=speed, unit=mps"}
Number   Wind_Speed_Mph       "Windspeed [%.2f mph]"     {weather="locationId=home, type=wind, property=speed, unit=mph"}
String   Wind_Direction       "Wind direction [%s]"      {weather="locationId=home, type=wind, property=direction"}
Number   Wind_Degree          "Wind degree [%.0f °]"     {weather="locationId=home, type=wind, property=degree"}
//Number   Wind_Gust            "Wind gust [%.2f km/h]"    {weather="locationId=home, type=wind, property=gust"}
//Number   Wind_Gust_Beaufort   "Wind gust Beaufort [%d]"  {weather="locationId=home, type=wind, property=gust, unit=beaufort"}
//Number   Wind_Gust_Knots      "Wind gust [%.2f kn]"      {weather="locationId=home, type=wind, property=gust, unit=knots"}
//Number   Wind_Gust_Mps        "Wind gust [%.2f mps]"     {weather="locationId=home, type=wind, property=gust, unit=mps"}
Number   Wind_Gust_Mph        "Wind gust [%.2f mph]"     {weather="locationId=home, type=wind, property=gust, unit=mph"}
//Number   Wind_Chill           "Wind chill [%.2f °C]"     {weather="locationId=home, type=wind, property=chill"}
Number   Wind_Chill_F         "Wind chill [%.2f °F]"     {weather="locationId=home, type=wind, property=chill, unit=fahrenheit"}

// weather station (only Wunderground and Hamweather), needs version 1.7 or greater of the binding
String   Station_Name         "Station Name [%s]"        {weather="locationId=home, type=station, property=name"}
String   Station_Id           "Station Id [%s]"          {weather="locationId=home, type=station, property=id"}
Number   Station_Latitude     "Station Latitude [%.6f]"  {weather="locationId=home, type=station, property=latitude, scale=6"}
Number   Station_Longitude    "Station Longitude [%.6f]" {weather="locationId=home, type=station, property=longitude, scale=6"}

This is my weather.cfg for the weather binding:

apikey.Wunderground=XXXXXXXXXXXXXXXX

# location configuration, you can specify multiple locations
location.home.name=home
location.home.latitude=XX.XXXXXX
location.home.longitude=-XX.XXXXXX
location.home.provider=Wunderground
location.home.language=en
location.home.updateInterval=10


2 Likes

Hello to you guys

I am new to the world of openhab
in the meantime I installed openhab2 under windows
to start I try to make a system of weather to learn
I see that it is necessary to configure openhab.cfg but I do not find it
then it is necessary to systematically create a file sitemap, items etc … to create modules
I tried this version of méto but it does not do the same thing that you
1st it does not find icons
2nd it does not show the numbers but rather the codes in each items I want to display

it’s not pretty
thank you

Hi @spaquet,

Welcome to the community. You should start by reading the Weather Binding 1.0 documentation here. It explains how you need to configure the weather.cfg (not openhab.cfg) for use by this HABpanel template. Weather.cfg needs to be located in the \conf\services subdirectory.

The best advice I can give you is to get the weather binding working first with a basic understanding of how to create Items and a sitemap file. As soon as you have mastered this, then you should be able to follow the instructions in these posts.

It’s a bit confusing when you start, but I’m sure you will get there!

Regards, Andy

Thank you andy for the return
I have tried to understand the documentation
I understood that you had to register to have an APIKey what I did

on the other hand I have a concern of layout of my station meteor

moin,
for all who use openweathermap:
Based on the colorful icons I rename the icons to OWM IDs and created some new icons to match the more detailed conditions:


enjoy

1 Like