I wanted to be able to display a short string on the Velbus OLED panels that gave a description of the weather.
(I’m sure that Cédric will add the Edge Lit Oled panels to the Velbus binding when his schedule permits.)
I’ve managed to use a simple rule to copy “Now playing” information from music systems to the OLEDs of Velbus panels, but the weather is more of an issue because the BBC RSS feed can be longer than the 64 character limit of a Velbus panel.
(Also it takes too long to scroll across)
The only things I needed to add to openHAB2 were the RSS Feed binding and a Thing that polled the BBC RSS weather feed for my location.
The Virtual Switch called “OLED_Weather” is only there so that I can switch on or off the RSS feed on the OLED panels
I’ve created this rule that seems to do the trick.
I’ll confess that yet again I don’t really know what I’m doing, so the weather0 value isn’t used, but i don’t know how to achieve what I want without setting it up. - (Turns out that it is totally redundant)
Any suggestions for how to tidy this up would be most welcome.
// BBC RSS weather Title
// Obtained from "https://weather-broker-cdn.api.bbci.co.uk/en/forecast/rss/3day/2633697" where 2633697 is the location code
// See this webpage for more information - https://www.bbc.co.uk/weather/about/17543675
// Obtain your location code by searching in this page - https://www.bbc.co.uk/weather and copy the code from the resulting URL
// Example "Latest Title" text = Today: Light Cloud, Minimum Temperature: 7°C (45°F) Maximum Temperature: 12°C (53°F)
//
// Needs to be split down to less than 64 characters for OLED Velbus panels
//
// For example - "Weather = Light Cloud, Min = 7°C Max = 12°C"
rule "BBC Weather RSS to Velbus Memo text"
when
Item BBCWeatherRSS_LatestTitle received update or Item OLED_Weather changed
then
// logInfo("BBC Weather Info", "BBC weather RSS update = "+BBCWeatherRSS_LatestTitle.state)
val weather0 = BBCWeatherRSS_LatestTitle.state.toString.split(',').get(0)
val weather1 = BBCWeatherRSS_LatestTitle.state.toString.split(':').get(1)
val weather2 = BBCWeatherRSS_LatestTitle.state.toString.split(':').get(2)
val weather3 = BBCWeatherRSS_LatestTitle.state.toString.split(':').get(3)
val condition = weather1.toString.split(',').get(0)
val minT = weather2.toString.split('°').get(0)
val maxT = weather3.toString.split('°').get(0)
if (OLED_Weather.state == ON){
TVRoomGPO_OledDisplay_Memo.sendCommand("Weather = "+condition+" , Min = "+minT+"°C , Max = "+maxT+"°C")
BackBedroomGPO_OledDisplay_Memo.sendCommand("Weather = "+condition+" , Min = "+minT+"°C , Max = "+maxT+"°C")
Cabin_Memo_Text.sendCommand("Weather = "+condition+" , Min = "+minT+"°C , Max = "+maxT+"°C")
LoungeGPO_OledDisplay_Memo.sendCommand("Weather = "+condition+" , Min = "+minT+"°C , Max = "+maxT+"°C")
logInfo("OLED MEMO","Weather string sent to OLEDs")
}
if (OLED_Weather.state == OFF){
TVRoomGPO_OledDisplay_Memo.sendCommand("")
BackBedroomGPO_OledDisplay_Memo.sendCommand("")
Cabin_Memo_Text.sendCommand("")
LoungeGPO_OledDisplay_Memo.sendCommand("")
logInfo("OLED MEMO","Blank Msg sent to OLEDs")
}
logInfo("OLED MEMO weather","Weather = "+condition+" , Min = "+minT+"°C , Max = "+maxT+"°C")
end
useful links :
See this webpage for more information - https://www.bbc.co.uk/weather/about/17543675
Obtain your location code by searching in this page - https://www.bbc.co.uk/weather and copy the code from the resulting URL