Australian Bureau of Meteorology integration with OpenHAB

OHHH!

Im not using a Binding. Just the script…

Not sure what you mean about changing the script? Sorry this is like rocket science!!!

The script pulls data from BOM’s forecast service, not it’s current readings.

To get current reading for temperature, condition etc you will need to get that from another source.

I use a combination of my personal weather station and the weather binding using weather-underground as the service.

I just want the icons to work which relates to condition :slight_smile:

Ugh!

Hi Andrew

Am I right in saying you do not use any weather bindings, just the script?

Cheers

It looks like he is using the items as in post 45…

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"}

These are using the Weather binding. It’s pretty easy to setup via paper.ui.
Go to Add-ons and Bindings and find the weather binding. Install it.

Then, config the binding as per https://www.openhab.org/addons/bindings/weather1/#binding-configuration

The services/weather.cfg file needs to be edited. Here is an example:

apikey.ForecastIo=sdf7g69fdgdfg679dfg69sdgkj
location.home.latitude=47.8011
location.home.longitude=13.0448
location.home.provider=ForecastIo

You can use the items from Andrew’s post in a weather.items file and you should be good to go. Just make sure the id of the location in your weather.cfg file matches the one in the items.

ie.
apikey.ForecastIo=sdf7g69fdgdfg679dfg69sdgkj
location.home.latitude=47.8011
location.home.longitude=13.0448
location.home.provider=ForecastIo

the location id is ‘home’. The items then need to be as follows:

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”}

Thanks Mark

Updated and then saw this for Condition:



18:35:44.325 [INFO ] [smarthome.event.ItemStateChangedEvent] - Condition1 changed from NULL to Partly cloudy in the morning.
18:35:44.326 [INFO ] [smarthome.event.ItemStateChangedEvent] - Condition2 changed from NULL to Partly cloudy starting in the afternoon, continuing until evening.
18:35:44.327 [INFO ] [smarthome.event.ItemStateChangedEvent] - Condition0 changed from NULL to Mostly cloudy throughout the day and breezy starting in the afternoon, continuing until evening.

Unfortunately still no graphics.

My widget:

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

<table id="weather-forecast-table" border=0 width="100%" style="table-layout: fixed">
	<tr>
    <td width=25% colspan=2 style="font-weight:bold;">Current Conditions</td>
		<td rowspan=11 width=3%>&nbsp; </td>
		<td>&nbsp; </td>
		<td style="font-weight:bold;">Today</td>
		<td style="font-weight:bold;">{{itemValue('BOM_Date_1') | date:'EEEE'}}</td>
		<td style="font-weight:bold;">{{itemValue('BOM_Date_2') | date:'EEEE'}}</td>
    <td style="font-weight:bold;">{{itemValue('BOM_Date_3') | date:'EEEE'}}</td>
    <td style="font-weight:bold;">{{itemValue('BOM_Date_4') | date:'EEEE'}}</td>
    <td style="font-weight:bold;">{{itemValue('BOM_Date_5') | date:'EEEE'}}</td>
	</tr>
  <tr><td>&nbsp; </td></tr>
	<tr>
    <td align="center" colspan=2><img width="100" src="{{ServerPath}}/{{IconSet}}/{{itemValue('CommonId').replace(' ','-') | lowercase }}.png"/>
			<p style="font-weight:bold;">{{itemValue('BOM_Precis_0')}}</p></td>
		<td>&nbsp; </td>
    <td>
      <img width="100" src="{{ServerPath}}/{{IconSet}}/{{itemValue('CommonId').replace(' ','-') | lowercase }}.png"/>
			<p style="font-weight:bold;">{{itemValue('BOM_Precis_0')}}</p>
		</td>
		<td>
			<img width="100" src="{{ServerPath}}/{{IconSet}}/{{itemValue('CommonId_1').replace(' ','-') | lowercase }}.png"/>
			<p style="font-weight:bold;">{{itemValue('BOM_Precis_1')}}</p>
		</td>
		<td>
			<img width="100" src="{{ServerPath}}/{{IconSet}}/{{itemValue('CommonId_2').replace(' ','-') | lowercase }}.png"/>
			<p style="font-weight:bold;">{{itemValue('BOM_Precis_2')}}</p>
		</td>
    <td>
			<img width="100" src="{{ServerPath}}/{{IconSet}}/{{itemValue('CommonId_3').replace(' ','-')  | lowercase }}.png"/>
			<p style="font-weight:bold;">{{itemValue('BOM_Precis_3')}}</p>
		</td>
    <td>
			<img width="100" src="{{ServerPath}}/{{IconSet}}/{{itemValue('CommonId_3').replace(' ','-')  | lowercase }}.png"/>
			<p style="font-weight:bold;">{{itemValue('BOM_Precis_4')}}</p>
		</td>
       <td>
			<img width="100" src="{{ServerPath}}/{{IconSet}}/{{itemValue('CommonId_3').replace(' ','-')  | lowercase }}.png"/>
			<p style="font-weight:bold;">{{itemValue('BOM_Precis_5')}}</p>
		</td>
  </tr>
  
	<tr>
    <td align=right width=7%>Outside Temp:&nbsp; </td><td align=left>&nbsp; {{'%.1f' | sprintf:itemValue('gOutsideTemp')}} °C</td>
		<td style="text-align:right;color:#fff">Maximum&nbsp; </td>
		<td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Max_0')}} °C</td>
		<td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Max_1')}} °C</td>
		<td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Max_2')}} °C</td>
    <td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Max_3')}} °C</td>
    <td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Max_4')}} °C</td>
    <td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Max_5')}} °C</td>
	</tr>
	<tr>
		<td align=right>Attic Humidity:&nbsp; </td><td align=left>&nbsp; {{'%.0f' | sprintf:itemValue('AtticHumidity')}} %</td>
		<td style="text-align:right;color:#fff">Minimum&nbsp; </td>
		<td class="col-xs-4" style="color:#fff"></td>
		<td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Min_1')}} °C</td>
		<td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Min_2')}} °C</td>
    <td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Min_3')}} °C</td>
    <td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Min_4')}} °C</td>
    <td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Min_5')}} °C</td>
	</tr>
  	<tr>
		<td align=right>Attic Temp:&nbsp; </td><td align=left>&nbsp; {{'%.0f' | sprintf:itemValue('AtticTemp')}} %</td>
		<td style="text-align:right;color:#fff">Minimum&nbsp; </td>
		<td class="col-xs-4" style="color:#fff"></td>
		<td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Min_1')}} °C</td>
		<td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Min_2')}} °C</td>
    <td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Min_3')}} °C</td>
    <td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Min_4')}} °C</td>
    <td class="col-xs-4" style="color:#fff">{{'%.0f' | sprintf:itemValue('BOM_Temp_Min_5')}} °C</td>
	</tr>
	<tr>
		<td align=right>Wind:&nbsp; </td><td align=left>&nbsp; {{itemValue('WS2355_WindSpd')}} km/h {{itemValue('WS2355_WindDir')}}</td>
		<td style="text-align:right">Pollen levels&nbsp; </td>
		<td class="col-xs-4" style="color:#fff">{{itemValue('MelbPollen_today')}}</td>
		<td class="col-xs-4" style="color:#fff">{{itemValue('MelbPollen_tomorrow')}}</td>
		<td class="col-xs-4" style="color:#fff">{{itemValue('MelbPollen_f2')}}</td>
    <td class="col-xs-4" style="color:#fff">{{itemValue('MelbPollen_f3')}}</td>
	</tr>
	<tr>
		<td align=right>UV Index:&nbsp; </td><td align=left>&nbsp; {{'%.2f' | sprintf:itemValue('openuv_uvreport_local_UVIndex')}} ({{itemValue('UV_Range')}})</td>
		<td style="text-align:right">Sunrise&nbsp; </td>
		<td class="col-xs-4" style="color:#fff">{{itemValue('vSunrise_Time') | date:'HH:mm'}}</td>
		<td class="col-xs-4" style="color:#fff"></td>
		<td class="col-xs-4" style="color:#fff"></td>
    <td class="col-xs-4" style="color:#fff"></td>
	</tr>
	
	<tr>
		<td align=right></td><td align=left></td>
		<td style="text-align:right">Sunset&nbsp; </td>
		<td class="col-xs-4" style="color:#fff">{{itemValue('vSunset_Time') | date:'HH:mm'}}</td>
		<td class="col-xs-4" style="color:#fff"></td>
		<td class="col-xs-4" style="color:#fff"></td>
    <td class="col-xs-4" style="color:#fff"></td>
	</tr>
</table>

You need the CommonID item for the image:

String CommonId "Common id [%s]" {weather="locationId=home, type=condition, property=commonId"}

The widget is calling that item for the image name…

<td align="center" colspan=2><img width="100" src="{{ServerPath}}/{{IconSet}}/{{itemValue('CommonId').replace(' ','-') | lowercase }}.png"/>

Part success Mark! Mostly sunny is showing Windy lol! I have CommonId for each day, do I need to add CommonId0, CommonId1 etc etc? to have the other graphics show

That’s right just script the bindings use less accurate weather services

I think I lead you astray…

Try this in the widget at top:

<div ng-init="ServerPath='//192.168.1.148:8081/static'; IconSet='underground'; weathermap={'Shower or two':'few showers','Shower or two clearing':'few showers','Possible shower':'showers','Rain at times':'rain','Rain developing':'rain','Clear':'clear night','Showers. Windy':'showers','Possible showers':'showers','Possible late shower':'showers','Showers easing':'showers','Early shower or two':'showers','Showers easing. Wind easing':'showers','Rain easing':'showers','Showers. Possible storm':'storm','Rain periods. Possible storm':'storm','Possible morning storm. Showers':'storm','Rain developing':'rain','Becoming windy. Sunny':'clear','Showers, heavy at times':'rain','Becoming cloudy':'cloudy','Mostly sunny':'sunny','Shower or two. Windy':'showers','Showers increasing. Windy':'showers','Mostly sunny day. Late rain':'showers','Showers. Very windy':'showers','Partly cloudy. Possible shower':'chance-of-rain','Cloud clearing. Possible shower':'mostly sunny','Mostly sunny. Afternoon cool change':'mostly sunny','Possible morning storm':'chance storms','Shower or two developing':'showers','Showers developing':'showers','Showers increasing':'showers','Possible shower later':'showers','Possible morning shower':'showers','Late showers':'showers','Morning shower or two':'showers','Late shower or two':'showers','Partly cloudy':'partly cloudy','Cloud increasing':'cloudy','NULL':'unknown','N/A':'unknown'};">
</div>

And change the img entries to:

<img width="100" src="{{ServerPath}}/images/{{IconSet}}/{{weathermap[itemValue('BOM_Precis_0')].replace(' ','-')  | lowercase }}.png" />

Then replace BOM_Precis_0 with BOM_Precis_1, BOM_Precis_2 and BOM_Precis_3 in correct spots…
This way you shouldn’t need the weather binding. Sorry about that!

Morning Mark!

Much further now! Ive got all working except for partly cloudy!

EDIT: Copied the image and renamed it to partly-cloudy.png!

I can see it in the weather map though!

Fantastic. Are you using the script code I suggested from @Andrew_Pawelski last night? I think that’s a better way to do it: BOM much more accurate for us Aussies than the weather binding sources.

I am!

Im finding that all the icons arent in the pack (https://drive.google.com/file/d/0Bw7zjCgsXYnHQTlGcndMR19DSUk/view?usp=sharing)

Any idea where this style of icon comes? As you can see mostly sunny is just showing as sunny as theres no icon for it…

Is there a mostly-sunny? Or partly-sunny?

You can change the mappings in the ng-init Andrew suggested if your icons are named in a different way.

Theres only Sunny, no mostly or partly :confused: odd partly and mostly everything else…

Maybe use partly-cloudy then?

OK, is anything required to have it shown when copying partly-cloudy to mostly-sunny?? The image loads fine as a direct url

Hi Aussies, wish I find this last week. I just installed open weather maps. I from Brisbane. Will try this out tonight.

Can you pm me about how to use this weather for your functionality of your sprinkler system.

I havent got that far as yet. I’m not using weather with the sprinkler, when I get it running I’ll share it.