UI Widget: Weather

Which building are this ? Mixed “strange” cities :wink: ?

Haha, it’s the Cologne cathedral, a transmission tower, some old castle tower and a newer building complex called “Kranhäuser” (crane houses) - not necessarily beautiful, but local (for someone). :slight_smile:

1 Like

Hello, some I could identify, but I think the "transmission towser seems to be the one from “Düsseldorf”…:wink:

Hello Rainer,

i’m from Cologne too and love these images. Could you send me the pictures you got there?
Want that my widget looks exactly like that!!
Would appreciate that very much!!

And i have a question: Is it possible to connect the items on to an equipment, so the modellist is not that full (but not create each one manually)? … I’m an openhab-beginner…

The widget is amazing!!
Thank you :slight_smile:

If you look at the post above:

You would just need to add Semantic Tagging to the localCurrent_Weather group defintion at the start of the list, such that all other items will be shown as points under this.

The easiest way, is probably to remove the items and then define them through the UI by creating Equipment from Thing and link all channels which will automatically tag each item as a point and should use the Item Name for the Equipment as a prefix.

1 Like

Not sure where I saw it, but the Station Name isn’t provided by the One Call API and hence you get that by using the regular ‘Weather and Forecast API’

1 Like

Hey @BreeZeShutteR and welcome to the community!

The vector-graphic of the cologne cathedral is a licensed one, so I’m not allowed to share this, sry. You could buy it e.g. here or use some of the free ones you might find with the search engine of your choice. :slight_smile:

The background silhouette graphics might not fit that well anymore due to changes in code (which follows a more general approch now) - but it should work okay with these:
cologne_complete-night cologne_complete-day

See @Sunny’s answer for this (or have a look in this tutorial, where it’s also described)

1 Like

Was anybody able to adjust some of widgets presented here to Weather Company binding?

Hi,

first of all, thanks for this great widget!

While trying to adapt the widget to my needs I run into a problem, that I can not solve myself. I am using an other name scheme, that I do not want to change, so I have to replace the items in the widget.

Strangely this works as expected with some days, but not all. I tried to make the example as small as possible. So I changed the line containing the max temperature for the next days (line 401):

Original:

text: "=Math.round(items[((!props.itemPrefix) ? '' : props.itemPrefix) + ((loop.days === 1) ? 'ForecastTomorrow' : 'ForecastDay' + (loop.days_idx+1)) + '_Maxtemperature'].state.split(' ')[0]) + '°'"

When I replace this with

text: "=items.Temp_Max_Day0_OWM.state"

It works as expected and the value of this item is displayed (“5.27 °C”)

When I replace it with

text: "=items.Temp_Max_Day1_OWM.state"

Only a “-” is shown, although the item state is valid:

The definition for these items:

Number:Temperature    Temp_Min_Day0_OWM   "OWM 0d - Temperatur min. [%.1f %unit%]"                <temperature>       (gWeatherOWM, gSemWeatherDataOWM)       ["Measurement", "Temperature"]      { channel="openweathermap:onecall:api:local:forecastToday#min-temperature" }

Number:Temperature    Temp_Min_Day1_OWM   "OWM 1d - Temperatur min. [%.1f %unit%]"                <temperature>       (gWeatherOWM, gSemWeatherDataOWM)       ["Measurement", "Temperature"]      { channel="openweathermap:onecall:api:local:forecastTomorrow#min-temperature" }

The same happens with the values for wind, humidity and precipitation probability. In all cases the values for day 1 are not shown, days 0, 2 and 3 work as expected.

Probably I do not see the woods for the trees, but I can not figure out, what is happening… I would be glad for every hint I would get!

Juelicher

Hey @juelicher

I could try to help if you’d like to post your customized YAML - it might have different reasons why it’s not working on your site and it’s much easier to find small errors in the code than in snippets :slight_smile:

Hi @RGroll,

thanks a lot for the offer! I have to admit, that I am kind of learning on the way how widgets are created, this is completely new to me. A week ago I have not even heard of Framework 7… Maybe it would be easier to just change my item names to the name scheme of the widget.

I have attached the current widget definition and a screenshot of the widget. I excluded the location name for privacy reasons, but it is displayed correctly!

Juelicher

weatherPopup.txt (29.7 KB)

I just decided on a compromise: I will change the forecast items according to your name scheme and keep only the names of the items for the current conditions. I habe persisted those in Influx and Postgresql und do not want to change all the table names.

I will test this tomorrow and post a feedback.

1 Like

Hi,

first of all: Great work! I really like the looks of your work and am eager to use as well! :slight_smile:
Instructions are fine (I setup following your instructions, had to wait some time for the items to be created but “select all” did the trick in the end) - hardest things so far were prefix (i missed the _) and finding where to add custom widgets (its not in settings but developer tools).

Anyways, now im stuck because i cant get icons to show up (the icons I added to /etc/openhab/files/weather_img/ work just fine).

Currently looks like this:
weather-noicons

Icon shows up on item though (e.g. prefix_Current_Icon is cloudy).
What am I missing?

Hey @modzero

The icons for the widget from your screenshot don’t need any external files, as it uses the integrated framework7-iconset - so it should work out of the box.

Did you also added the *_Iconid items for the amount of days and hours you want to forecast?

Hi Rainer,
I like your widget and therefor I want to use it, but I get some Warning messages, which I don’t quite understand.

2021-02-01 22:04:48.299 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: ForecastTomorrow_IconId
2021-02-01 22:04:48.306 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: OC_WaF_ForecastDay1_IconId
2021-02-01 22:04:48.311 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: ForecastDay2_IconId
2021-02-01 22:04:48.318 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: ForecastDay3_IconId
2021-02-01 22:04:48.324 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: ForecastDay4_IconId
2021-02-01 22:04:48.330 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: ForecastDay5_IconId

I’m using the “Onecall-Thing”.What I can say is that I don’t have a Day1 in my ItemSetUp.
To merge the Widget and my Items, I made some changes in the YAML, which should work (in my opinion), but I’m not very experienced.
The result looks good
grafik

oc_weather_items.txt (49.7 KB) weatherPopup_yml.txt (29.5 KB)

Hope you can give me a hint.
Thx in advance.

Cheers - Peter

Hey @fibu-freak,

I can only advise you to use the suggested item-scheme then. It would just take too much time and work to recheck every bit of the partially very long expressions and searching for errors in a custom item pattern that I don’t know, sry.

If you see still errors then, it would be much easier for me to find them as I know what I’ve to look out for.


But I’m kinda suprised that all of your icons are showing up correctly, as the errors you posted indicates that some of the items, which holds the needed condition informations, can’t be resolved.

Me too :crazy_face:.
I didn’t make any changes in the programming-logic, as this stuff is too hard for me. But I made some changes in the “suffix’s-naming”. I.e. your code was “ForecastToday_Iconid” or better said “Iconid”, I made “IconId” from it, a.s.o.
As Prefix I use “OC_WaF_”, as my naming convention looks like “OC_WaF_ForecastToday_TimeStamp”.

The YAML-Code for my Onecall-Thing is

UID: openweathermap:onecall:api:local
label: One Call API weather and forecast
thingTypeUID: openweathermap:onecall
configuration:
  location: 42.887211,3.4209123
  forecastHours: 0
  forecastDays: 6
  forecastMinutes: 0
bridgeUID: openweathermap:weather-api:api

I do not use any subdivisions into “hours” or “minutes”. So I’m surprised as you, as you, that I’m getting those warnings, even if the items are in my Item-Setup except for the “OC_WaF_ForecastDay1_IconId”-Naming, what a pity :sleepy:.
Thx for your answer. I will have a look on your scheme, if you have no other idea.

Cheers
Peter

Hi,

thx for the fast help. I didnt choose “advanced options” when adding the items via MainUI (since there are so many I didnt notice some where missing).

Works now as intended, thanks a lot!

1 Like

Hi Rainer,
me again, sorry!!!
Now I used your ItemSet and your Original-Widget. The only Difference is in the Thing-Description, as mine use another UID.
Onecall-Thing:

UID: openweathermap:onecall:api:local
label: One Call API weather and forecast
thingTypeUID: openweathermap:onecall
configuration:
  location: xxxx,yyyy
  forecastHours: 13
  forecastDays: 6
  forecastMinutes: 0
bridgeUID: openweathermap:weather-api:api

OWM-Thing:

UID: openweathermap:weather-and-forecast:api:local
label: Lokales Wetter und Wettervorhersage
thingTypeUID: openweathermap:weather-and-forecast
configuration:
  forecastDays: 0
  location: xxxx,yyyy
  forecastHours: 24
bridgeUID: openweathermap:weather-api:api

Bridge:

UID: openweathermap:weather-api:api
label: OpenWeatherMap Konto
thingTypeUID: openweathermap:weather-api
configuration:
  apikey: my key
  refreshInterval: 60
  language: de

Widget-Settings:
grafik
grafik

Widget-Result:
grafik

As you see all looks amazing include the correct location, but still the same boring warnings:

2021-02-02 17:03:03.642 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: ForecastTomorrow_Iconid
2021-02-02 17:03:03.654 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: OneCallAPIweatherandforecast_ForecastDay1_Iconid
2021-02-02 17:03:03.659 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: ForecastDay2_Iconid
2021-02-02 17:03:03.670 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: ForecastDay3_Iconid
2021-02-02 17:03:03.680 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: ForecastDay4_Iconid
2021-02-02 17:03:03.690 [WARN ] [e.internal.SseItemStatesEventBuilder] - Attempting to send a state update of an item which doesn't exist: ForecastDay5_Iconid

Here once again the item-scheme and the YAML-Code:
weatherPopupRG.txt (29.5 KB) oncallRG.items.txt (44.1 KB)

Is it possible that the code was changed ? I used it from here

Cheers,
Peter

Today I renamed all my items according to the name schema suggested by Rainer. It took some time, as I had to change the tables and views in my Postgresl database and some Grafana panels as well, but I guess it will spare me some headache in the long run.

At it was worth the effort, on the first glance the widget now works as expected, great! I will do some more testing tomorrow. I still can not figure out why there was a problem with my first try, even when comparing it to the original version. Must be some subtle difference.

Thanks again for sharing this great widget!