Weather for irrigation

and wich values has in wind.scale.map file?

Searching this forum for “wind.scale” gives a few examples.

The procedure is pretty simple.
I extract the 3-hourly FC from OWM and put these to the daily FC depending on the time of the day.I don’t have a things file because I just created the thing in PaperUI.

I’m going off of the add-on docs:

Attention : The daily forecast is only available for paid accounts. The binding tries to request daily forecast data from the OpenWeatherMap API. If the request fails, all daily forecast channel groups will be removed from the thing and further request will be omitted.

And it does say under limit in that screen shot “Daily forecast: unavailable”.

There are a number of Rules and Python libraries similar to what you’ve posted which takes the hourly forecasts and generates one for the next few days. But the binding itself will only give you that information without resorting to Rules if you have a paid account.

Can you share your sitemap frames where this is displayed please.

Hi,

Sorry, I don’t use any sitemaps, just Habpanel.
See here:

Thanks.

What about the icons…Where are they located? I display them fairly large, and these do not scale well.

For anyone who runs across this post and uses sitemaps:

>    Frame label="Weather"{
> 
>         Text    item=W_OWM_Station_Name                                         icon="location"
> 
>         Text    item=W_OWM_Time                                                 icon="time"
> 
>         Image   item=W_OWM_CondIcon
> 
>         Text    item=W_OWM_Temp
> 
>         Text    item=W_OWM_Humidity
> 
>         Text    item=W_OWM_Wind_Speed
> 
>         Text    item=W_OWM_Wind_Dir
> 
>         Text    item=W_OWM_Cond                                                 icon="none"                                     
> 
>         Text    item=W_OWM_Rain
> 
>         
> 
>         Text    item=gW_OWM_Future                  label="Future Forcast"      icon="weather"{
> 
>             Frame   label="3 Hr. Forcast" {
> 
>                 Text    item=W_OWM_Cond3                                        icon="weather"
> 
>                 //Text  item=Dummy                      label=""                    icon-"none"
> 
>                 Text    item=W_OWM_Cloud3
> 
>                 Text    item=W_OWM_Rain3
> 
>                 Text    item=W_OWM_Temp3
> 
>             }
> 
>             Frame   label="6 Hr. Forcast" {
> 
>                 Text    item=W_OWM_Cond6                
> 
>                 Text    item=W_OWM_Cloud6               
> 
>                 Text    item=W_OWM_Rain6
> 
>                 Text    item=W_OWM_Temp6
> 
>             }
> 
>             Frame   label="9 Hr. Forcast" {
> 
>                 Text    item=W_OWM_Cond9                
> 
>                 Text    item=W_OWM_Cloud9
> 
>                 Text    item=W_OWM_Rain9
> 
>                 Text    item=W_OWM_Temp9
> 
>             }   
> 
>             Frame   label="12 Hr. Forcast" {
> 
>                 Text    item=W_OWM_Cond12               
> 
>                 Text    item=W_OWM_Cloud12
> 
>                 Text    item=W_OWM_Rain12
> 
>                 Text    item=W_OWM_Temp12
> 
>             }
> 
>             Frame   label="15 Hr. Forcast" {
> 
>                 Text    item=W_OWM_Cond15               
> 
>                 Text    item=W_OWM_Cloud15
> 
>                 Text    item=W_OWM_Rain15
> 
>                 Text    item=W_OWM_Temp15
> 
>             }
> 
>             Frame   label="18 Hr. Forcast" {
> 
>                 Text    item=W_OWM_Cond18               
> 
>                 Text    item=W_OWM_Cloud18
> 
>                 Text    item=W_OWM_Rain18
> 
>                 Text    item=W_OWM_Temp18
> 
>             }
> 
>             Frame   label="21 Hr. Forcast" {
> 
>                 Text    item=W_OWM_Cond21               
> 
>                 Text    item=W_OWM_Cloud21
> 
>                 Text    item=W_OWM_Rain21
> 
>                 Text    item=W_OWM_Temp21
> 
>             }
> 
>             Frame   label="24 Hr. Forcast" {
> 
>                 Text    item=W_OWM_Cond24               
> 
>                 Text    item=W_OWM_Cloud24
> 
>                 Text    item=W_OWM_Rain24
> 
>                 Text    item=W_OWM_Temp24
> 
>             }
> 
>         }
> 
>                 
> 
>     }

1 Like

I store all my icons in my habpanel folder:
/etc/openhab2/html/habpanel/assets/icons/smarthome-set

If you mean where I got them from - you will find a link in my referred thread above (I don’t know if sitemaps support animated icons though)

I have them working, but as you can see from the post above, they are blurry…

you are right. Daily forecast off-the-shelf are not for free.
It needs a workaround - so my stuff hopefully helps others to safe some time :slight_smile:

Yes, I guess that’s on a tablet with large pixels!?
On the web you will find possible higher-res icons.

No, its on a desktop, but shows the same regardless of the device…just because its an image, rather than an icon. I just can’t find where the images are defined, so I can change them. They are not in my icons folder, or my html folder.

I usually look for icons here:
https://www.flaticon.com/icon-packs/weather%20forecast%20pack

I just found these for free…

Now to find out how to use these instead of the ones that are current.

I am actually getting an error in weather.rules.

Says that ScriptServiceUtil is undefined for every call on it. Any ideas?

W_OWM_CondIcon contains the Icon. It downloads it straight from OWM itself. I have a script that will take the icon from the Item and save it to file so it can be used as an actual icon for the W_OWM_Cond Item.

It only works on Linux though as it uses some Linux command line tools to convert the Base64 to a usable png.

from core.rules import rule
from core.triggers import when
from configuration import weather_icon_path
import subprocess
from javax.imageio import ImageIO
from java.io import File

@rule("Weather Icon",
      description="Copy the current weather conditions icon",
      tags=["weather"])
@when("Item vWeather_Conditions_Icon changed")
@when("System started")
def cond_icon(event):
    """
    Download the weather conditions icon from DarkSky and convert it from gif to
    png.
    """
    # OpenWeatherMap
#    cond_icon.log.info("Fetching weather conditions icon to {} from {}"
#                  .format(weather_icon_path, items["vWeather_Conditions_Icon"]))
#
#    results = subprocess.check_output(['/usr/bin/wget', '-q', '-O',
#                                       weather_icon_path,
#                                       str(items["vWeather_Conditions_Icon"])])
#
#    input_file  = File(weather_icon_path)
#    if not input_file.exists():
#        cond_icon.log.warn("Failed to fetch the weather icon!")
#        return
#
#    output_file = File(weather_icon_path.replace('gif', 'png'))
#    ImageIO.write( ImageIO.read(input_file), 'png', output_file)
#
#    results = subprocess.check_output(['rm', weather_icon_path])

    # DarkSky
    cond_icon.log.info("Fetching the weather conditions icon... {}".format(ir.getItem("vWeather_Conditions_Icon").state))
    dl = subprocess.Popen(['/usr/bin/wget', '-qO-',
                  'http://argus:8080/rest/items/vWeather_Conditions_Icon/state'],
                  stdout=subprocess.PIPE)
    dd = subprocess.Popen(['/bin/dd', 'bs=22', 'skip=1'], stdin=dl.stdout, stdout=subprocess.PIPE)
    dl.wait()
    f = open(weather_icon_path, "w")
    subprocess.call(['/usr/bin/base64', '-d'], stdout=f, stdin=dd.stdout)
    dd.wait()

Note, the DarkSky code is working just fine for OWM. I’ve left the commented out OWM code for reference and to see another way to do it. Instead of using subprocess you would use executeCommandLine and a shell script.

The above takes the contents of the Icon Item, saves it to a file, strips out the first 22 characters and converts the Base64 to binary png in the icons folder. The name of the file is just “weather.png”.

Then the Conditions Item uses <weather> for the icon. It looks like this:

tl;dr - The binding downloads the icons from OWM.

OK, this looks a little outside what I’d like to do. Could I possibly map my own images based on the condition ID?

I did this once and it’s a pain. You will need to get a list of all possible weather conditions that OWM may report and then create a weather-<condition>.png for each of those. It was easier to do with Wunderground back when I did it because they had a way to figure out that mapping. Only if I were very dedicated to having this work would I venture to do so again.

It needs to be imported at the top of the file.

import org.eclipse.smarthome.model.script.ScriptServiceUtil
1 Like