Announcing OpenWeatherMap binding for Eclipse SmartHome / openHAB

weather
openweathermap
Tags: #<Tag:0x00007f51e4764e08> #<Tag:0x00007f51e4764cc8>

(john) #223

Lots of good information in the entire posting! Being a noobe, I did figure out how to get OpenWeatherMap installed and setup along with the transform file for the wind direction. I guess since I have a free license I can only get the current weather information. The only other thing I’m looking for is how to change the wind speed from km\h to miles per hour.

Thank you
John Frankforther


(Scott Rushworth) #224

You can get forecasts too. Set forecastHours to 120 (or however many you’d like in increments of 3) and forecastDays to 0. 120 forecastHours gives you 5 days of forecasts. This will require >600 Items, so you may want to check out…


(Christoph Weitkamp) #225

Do it in your Item definition - change this:

Number:Speed localCurrentWindSpeed "Current wind speed [%.1f km/h]" <wind> { channel="openweathermap:weather-and-forecast:api:local:current#wind-speed" }

to

Number:Speed localCurrentWindSpeed "Current wind speed [%.1f mph]" <wind> { channel="openweathermap:weather-and-forecast:api:local:current#wind-speed" }

(john) #226

I just found that in the docs. I’m still new to OH and learning things daily even though I only have 1 switch connected to the system.

Thank you!!

John Frankforther


(john) #227

As I was looking over the sitemap at the weather readings, I noticed a number next to the Current Condition. What does the 800 represent?

John Frankforther


(Scott Rushworth) #228

The ConditionIDs are listed here… https://openweathermap.org/weather-conditions


(john) #229

Thanks Scott! So would you put all those conditions in a transform file like for the wind direction?

John


(Scott Rushworth) #230

No need… the binding does it for you in the Condition Item. The ConditionID does not have much use. It looks like your Condition Item is setup for the ConditionID.


(john) #231

Where would I change that at? In the Items file?


(Scott Rushworth) #232

Yes, if you have one. If not, and you have Simple Mode turned on, turn it off. Then modify the Item in Paper UI.


(Karen Mitchell) #233

I’m using this binding, but I’m having an issue using the temperature in a rule. Can someone please point me in the correct direction?

item file:

Number:Temperature localCurrentTemperature "Current temperature [%.1f %unit%]" 						  <temperature> 	(Weather)	{ channel="openweathermap:weather-and-forecast:c5e7a131:local:current#temperature" }
Number:Temperature localDailyForecastTodayMinTemperature "Minimum temperature for today [%.1f %unit%]" <temperature> 	(Weather)	{ channel="openweathermap:weather-and-forecast:c5e7a131:local:forecastToday#min-temperature" }
Number:Temperature localDailyForecastTodayMaxTemperature "Maximum temperature for today [%.1f %unit%]" <temperature> 	(Weather)	{ channel="openweathermap:weather-and-forecast:c5e7a131:local:forecastToday#max-temperature" }

Rules:

rule "Summertime"
 when
 	Item localCurrentTemperature changed
 	
 then
	val localTemp = localCurrentTemperature.state as DecimalType

 	if(localTemp as Number > 79)  {
 		sendCommand(Summer, ON)
 		logInfo("Summer", "It is hot outside!")
 		}
 	else sendCommand(Summer, OFF)
end

Error log:

2019-02-19 15:53:31.209 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Summertime': Could not cast 85.424 °F to org.eclipse.smarthome.core.library.types.DecimalType; line 736, column 18, length 44

I would really like to use the max daily temp to drive my virtual switch, but my understanding is that those only return on paid accounts.

Thanks in advance!


(Scott Rushworth) #234

(Karen Mitchell) #235

Thank you 5iver! That is just what I needed!


(Scott Rushworth) #237

If you are using an Items file, then forget about about Simple Mode. Your Item is linked to the proper Channel for the currrent condition, so you must have some other Item with the same label that is linked to conditionId.

Oh… you withdrew your post.


(john) #238

I’m not sure what was wrong, when I came back to the screen tonight it was working like it was supposed to and I didn’t change anything.


(john) #239

I’ll have to go back and look in the Paper UI. I just updated the screen and it changed back to 800 again!! Thanks for point me in the right direction!!

John


(john) #240

5iver
Sorry about removing the reply. I thought I found the problem. In digging into this deeper, I started looking into these two lines in the Items file.

String localCurrentCondition "Current condition [%s]" <sun_clouds> { channel="openweathermap:weather-and-forecast:api:local:current#condition" }
Image localCurrentConditionIcon "Icon" { channel="openweathermap:weather-and-forecast:api:local:current#icon" }

The first line that includes the <sun_clouds> always displays the sun_clouds icon no matter what the weather is. It is the second line that displays the current weather icon and is displayed like this with the current weather icon one line below. As I have been checking the Paper UI settings and the Items file, I have seen the current number number change between the current number and the text it represents and back again.

I have checked the variables as you suggested before and double checked the Paper UI settings and didn’t see any duplicate settings there. Any other ideas or suggestions to fix this?

Thanks

John Frankforther


(Scott Rushworth) #241

This is normal. It will be static, but the Icon Item will change. The Icon will take up two rows, but that is a limitation of the Basic and Classic UIs. Look into Habpanel if you want something prettier.

Take a look at the ConditionID Channel in Paper UI> Configuration> Things> your OWM weather and forecast Thing. Check if your localCurrentCondition Item might be linked to that Channel. If not, maybe @cweitkamp would have an explanation how this could be occurring. You’re using OH 2.4 stable?


(john) #242

5iver
Yes, I’m running the current version if OH2.x as I just updated everything yesterday.

I was looking in the things file and tried commenting out the line for the

Thing uvindex local "Local UV Index" [location=long,latit",forecastHours=0, forecastDays=7]

and that seemed to fix the problem with the text not showing up for the current condition.


(Scott Rushworth) #243

The Thing files in the doc are just examples, for those who want to use files. Much easier, IMO, to create/manage Things in Paper UI. It’s good that you have learned how to make unmanaged Things though! I still do my Items this way.

Glad to hear it’s all working now!