OpenWeatherMap widget for HABPanel

Hi all, and thanks @bastiaan_van_h for this widget! It is my first attempt at personalization of the HABPanel and so I followed your GitHub instructions to the letter.
So that’s what happened to me: I registered to OWM, got my API key, and registered the binding. It took a while before the binding went online. I then set up the two items properly and the full 4 icons appeared. Yey!
I had the service up and running for the last days and now the forecast in the panel does not update properly. I see in Paper Ui that the info is pulled up properly and regularly, but the panel is stuck with the “1st forecast”.
Here below I paste the screenshots of the Panel and the UI results.


Annotation%202019-09-29%20115501
As you can notice, the service works well, but the widget is not updating.

Thoughts? Suggestions?

Thanks in advance,
Umberto

My bad… For some reason the edits on the ID were not retained in the .items file. This explained why I had some values to start with and they went “expiring”.

Now I fixed the ID but in my panel I still see two “tomorrow” forecasts and this is due to the widget code, showing 3h and 24 hours from latest update. I am going to think about how to select appropriate timestamps for daily forecasts.

Thanks again for the fantastic job, this is helping my learning curve around several aspects of OpenHAB.

Thanks Sebastian, this is the first weather example that I managed to get to work. Really clear explanation in your blog and GitHub readme. Well done …i had it working within a couple of hours from scratch. Previously failed ForecastIo, Dark Sky and the normal weather map binding. You took all the hard work away!

1 Like

Thanks for the hard work to make this widget happen but I do have issues with the days. Not only 2 times the same day but also the other days are not correct. I have downloaded the newest version of the owm.controller.js but that is not solving my problem.

I also still have the same problem, two times the same day showing. and everything clean install

Did you set the correct custom forecast date in the configuration settings of the Local weather and forecast Thing?

A openhab restart fixed the problem

Hi

Its working like charm on my ios 9.5 device. One thing… I have been writing with OWM, and they say that there is a Danish translation ready, is it possible to add this translation to this binding?

Hello,
I am very new in using openhab. I hope somebody can help me with my problem.

My weather widget looks like this in the moment:
53

So I have the problem that I can’t get the Icons for current, 3h and 24h.
I think my owm-widget.items file is okay, but I do not have channels for the
weatherconditionID in paperUI for current, 3h and 24h weather…!?
So I can’t link it…!?

How can I solve this Problem…?

Hi!

First of all thanks for the great widget.

I’m playing with habpanel and found your widget and looks great, but seen issue also reported here - currently (it’s 20:20 at my place) I see two entries for Thursday - so Thursday | Thursday | Friday | Saturday

I did a quick spike and it seems as code does not take the optimal forecast - in my case, as said above it’s 20:20 and my 3h forecast (Weather_OWM_DateTime_h3) is at 01.01.2020 22:00 - which I would expect the widget would take to display.

But

today = new Date();
nextDay = new Date();
nextDay.setDate(today.getDate() + day);
nextDay.setHours(12);
var diffHours = Math.ceil(Math.abs(today.getTime() - nextDay.getTime()) / (1000 * 3600));

will calculate my current diff for today to 8 hours => abs(12:00 - 20:00) = ~8h.
And func getClosest will return 9h as the closest - resulting in taking 9h forecast - which is at 02.01.2020 04:00 - therefore I see two Thursday(s) I guess since the forecast is already for tomorrow.

Does above makes sense?

EDIT: not sure if this is the correct place to discuss this? maybe another thread or github?

Hello,
This widget looks really great and I really want to install it and make it work for me. Unfortunately, I’m not able to configure it for two days now :(. I did two installs of OH2 (2.4 and 2.5), did the exact steps in the Readme from the central repo, but the result is one and the same:


This is the content of my OH html dir:

root@OpenHAB:/usr/local/etc/openhab2/html # tree -L 3
.
|-- index.html
|-- index.html.sample
|-- openweathermap/
| |-- owm.controller.js
| |-- weather-icons-master/
| |-- images/
| | |-- feel.png
| | |-- humidity.png
| | |-- wind.png
|-- readme.txt

In the Paper UI Everything looks great and data displays.
My OH installation is on FreeNAS jail if with openjdk8 if that may be in any problem

have a look here

Hey man, thanks a lot. Now it displays some good data.
Cheers!

hello, has anyone managed to clear this issue with the next day that it is shown two times?
i have the same problem, today its ok, tomorrow and the day after tomorrow have the same name even the temp is different and the names of the next two days are ok.
looking in paper ui right now i see that the OpenWeatherMap Account thing is shown with grey color offline and the Local weather and forecast thing same, grey color but marked as unknown
although the habpannel displays some values
restarted oh several times …
any help please?
thanks
image

Could you please tell us if know your weather is displayed ok? I would also like to display today and the next three days instead of 4. What did you modify in the configuration and how many hours have you set? 72/1?
Thanks!

Hi all
this is a great widget, thanks for this awesome development.
The data visualisation works as a charme. But the widget still doesn’t shows icons

I use a habpanel config with a IPhone Safari browser.
But this is independend, because this issue is also in a PCs Firefox

I created and copied as in the installation guide on github, changed the IT in the items
But I still not see any icon

grafik

Does somebody have an idea?

I had the same problem.
It’s most likely because you downloaded weather-icons-master.zip to your pc and unzipped it there and then copied the folder over to your openhab installation. Instead copy the .zip file into the folder /html/openweathermap/ then use your openhab computer to unzip the folder (not your pc).
Cheers

Thanks, I will try this and will come back

I took a different approach, avoiding messing with Date objects, since we only care about the number hours to the next day at noon. This fixes the duplicate day issue for me.

function loadOwmForecast() {
        console.log("Processing OWM widget forecast");
        try {
                var today = new Date();
                var hoursToNoon = (24 - today.getHours()) + 12;
                for (var day = 0; day < 4; day++) {
                        setForecastItems(day, getClosest(hoursToNoon + (day * 24)));
                }
        } catch (err) {
                console.log("Error during OWM widget: " + err)
        }
}

Created a pull request.

@ewgor use the solution here for both of your issues