[SOLVED] Demo house - Weather

Hi,

I have used openhab2 configs (sitemap + items) from demo house and have customised it for my needs.
Got it to work already with couple of switches and temperature probes so all good.

On demo house there is Weather section showing Outside temperature such as Todays Maximum , Minimum , Humidity, Humidex and chart period.

Im just wonder how to get it to work. Im assuming this is getting data from external source.

Can I ask for help please?

Thanks in advance.

Start by looking at the Items that are being displayed. What channels are they linked to or what bindings are they bound to? This will tell you where the information is coming from. From there look to see what that binding is configured with and make modifications as necessary.

If the Items are not linked or bound to anything then start by looking at the Weather Underground or Yahoo Weather binding.

Hi Rich,

Thanks for your response.

It looks like its using yahoo weather binding. I have installed it on my system, need to get my head around what`s need changing.

Below is the weather section from demo house which I need to review.

Group Weather_Chart													(Weather)
Number Weather_Temperature 		"Outside Temperature [%.1f °C]"	<temperature> (Weather_Chart) { http="<[http://weather.yahooapis.com/forecastrss?w=638242&u=c:60000:XSLT(yahoo_weather_temperature.xsl)]" }
Number Weather_Humidity 		"Outside Humidity [%.1f %%]"	<temperature> (Weather) { http="<[http://weather.yahooapis.com/forecastrss?w=638242&u=c:60000:XSLT(yahoo_weather_humidity.xsl)]" }
Number Weather_Humidex			"Humidex [SCALE(humidex.scale):%s]" 			(Weather)
Number Weather_Temp_Max 		"Todays Maximum [%.1f °C]"	<temperature> (Weather_Chart)
Number Weather_Temp_Min 		"Todays Minimum [%.1f °C]"	<temperature> (Weather_Chart)
Number Weather_Chart_Period		"Chart Period"
DateTime Weather_LastUpdate		"Last Update [%1$ta %1$tR]"	<clock>

/* NTP binding demo item */
DateTime		Date			"Date [%1$tA, %1$td.%1$tm.%1$tY]"	<calendar>	{ ntp="Europe/London:en_GB" }

There is also map location, I hope I can figure this out.

Not the Yahoo Weather binding but the HTTP binding. Those Items are configured to pull the data straight from Yahoo! using HTTP.

However, the Yahoo! Weather binding might be easier to use. Follow the instructions on the Yahoo! Weather binding readme to set up the binding and link the Items to the channels. You might also want to go through the Beginner’s Tutorial.

Hi,

I will try to use HTTP binding, just removed Yahoo binding.

I have configured http.cfg under services, added the following information. What else do I need to setup - still no data on OH.

Any other add ons are required?

configuration of the first cache item

#.url=
#.updateInterval=
weatherCache.url=http://weather.yahooapis.com/forecastrss?w=638242&u=c
weatherCache.updateInterval=60000

That is not how those particular Items are configured to work with the HTTP binding. As the README explains, there is a caching configuration and a direct inbound configuration. Those Items you pasted in above use the direct method meaning that what you have done will not accomplish anything.

What happens when you put that URL into the browser?

Do you see any errors in the log?

Finally, I recommend once again “However, the Yahoo! Weather binding might be easier to use. Follow the instructions on the Yahoo! Weather binding readme to set up the binding and link the Items to the channels.”

Hi Rich,

Thanks again.
When I put this URL http://weather.yahooapis.com/forecastrss?w=638242&u=c into the browser I can see error from my broadband provider:

“Sorry, we could not find weather.yahooapis.com.”

So can`t access it.

I was only hoping that if this is demo weather it should be functional.

I`m very new to openhab so will have to learn a lot quickly.

Could you please point me to this README please.

Maybe the yahoo has change this link in the past and demo weather needs updating?

Kind regards

I will try to setup yahoo weather binding now, lets see if this works.

That’s the same as your date problem
Set-up the yahhoweather binding
Enter the info needed (API key…)
Link the things to your items

Thanks again Vincent. I got some data now.
Will share some screenshots below for others.

I was only able to link temperature (to outside temperature) and humidity (to outside humidity). I don’t have pressure item at the moment.
In terms of Todays Maximum and Todays Minimum currently both items are reading the same value - is this correct ? For the test purpose I have changed location so that’s why you see temperature increasing from 9 to 18C.

Capture%2022

Capture%2023

I believe the demo has a Rule that populates the maximum and minimum temp Items as the outside temp Item changes.

Thanks. On the graph is only displaying BLUE pen which is Today`s Minimum.

If all three are the same then the last one graphed, in this case the Minimum, will be the only one that appears. The other two were overwritten by the Minimum.

Thanks Rich. You are probably correct,

I have one question. Currently outside temperature is showing 10 C - you can see it on the graph below (RED line). However Todays Maximum is showing 9C - should I expect this to be at 10 C ?

I would expect it to be so, but like I said, this is handled by a Rule. You will have to make sure the Rule is running correctly and how it is running. It might be that it runs periodically rather than based on changes to the outside temp or there is a bug or something. Look at openhab.log for errors.

Afternoon All,

I used the following rules straight from demo setup.

import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*

var Number counter = 1
var Timer timer = null


 rule "Initialize Location"
	when 
		System started
	then
		DemoLocation.postUpdate(new PointType ("52.5200066,13.4049540"))
end


rule "Update max and min temperatures"
when
	Item Weather_Temperature changed or
	Time cron "0 0 0 * * ?" or
	System started
then	
	postUpdate(Weather_Temp_Max, Weather_Temperature.maximumSince(now.toDateMidnight).state)
	postUpdate(Weather_Temp_Min, Weather_Temperature.minimumSince(now.toDateMidnight).state)
	logInfo("Weather", "Temperature evolved of " + Weather_Temperature.deltaSince(now.minusMinutes(2)) + " degrees.")
end

/** shows how to use sensor values from the past */
rule "Persistence Demo"
when
	Time cron "0 * * * * ?"
then	
	if(Weather_Temperature.changedSince(now.minusMinutes(1))) {
		logInfo("PersistenceDemo", "2 minutes ago, the temperature was " + Weather_Temperature.historicState(now.minusMinutes(2)) + " degrees.")
	}
end


// Creates an item that stores the last update time of this item
rule "Records last weather update time"
when
  Item Weather_Temperature received update
then
  postUpdate(Weather_LastUpdate, new DateTimeType())
end



// This rule will be used to test Scale transformation service
rule "Compute humidex"
when
        Item Weather_Temperature changed or
	Item Weather_Humidity changed
then
	var Number T = Weather_Temperature.state as DecimalType
	var Number H = Weather_Humidity.state as DecimalType	
	var Number x = 7.5 * T/(237.7 + T)
	var Number e = 6.112 * Math::pow(10, x.doubleValue) * H/100
	var Number humidex = T + (new Double(5) / new Double(9)) * (e - 10)
	postUpdate(Weather_Humidex, humidex)
end

At the moment is only showing me outside temperature which is 10 C . Today Maximum and Minimum has the same value so something isn`t correct here.

Capture55

The spike on the graph is when I changed location so ignore it please.

I have also copied the following add ons from demo house.

Capture57

And additionally copied persistence as well from demo house.

Capture58

You are running OH 2 and you chose the Demo package when first bringing up the web page?

That is the OH 1.8 demo and I’m pretty sure the OH 2 demo has been significantly updated since then.

Hi Rich,

You are correct I`m running OH 2 and have copied rules for weather from OH 1.8.3 Demo. Is there demo house available for OH 2 ?
Today the temperature is sitting at the same level (10 C) that’s for outside , todays minimum and maximum. Are the rules above correct?

Not for OH 2.x.

I’m not sure how to install the OH 2 demo but I think the easiest at this point will be to edit services/addons.cfg and change the package to “demo”. This will install the needed add-ons and download the necessary config files.

Hi,

Just wonder if anyone is in the possession of rules for OH2 demo ? I got most part of my system ready to go so dont want to loose anything. l still having issue with Todays Min and Max temperatures - still only showing Outside Temperature.
Somewhere of the forum I have seen demo rules which perhaps were OH2, and there are seems to be identical what I`m using right now.