Open Weather API Day Widget

All of my (Kyle Mason) (mediatech15) widgets are free to copy modify and edit how you see fit. You may re-post the variants freely (an inspired by is nice)

This widget is cell look alike widget for use with the OpenWeatherAPI One Call. This allows you to specify the root item and then based on a few parameters you can make dynamic cards.

  • Fully Responsive
  • Supports Day and Hour
  • Dynamic hiding of elements not supported by Time (Days vs Hours items)

Configuration is simple and straight forward.

Screenshots


Screenshot 2022-05-23 203545

Changelog

Version 1.0

  • initial release

Version 1.1

  • Fixed colors in badges (Screenshots will be updated soon)

Version 1.2

  • Updated config settings for simplicity
  • Made published

Version 1.3

  • Fixed small bug where temps aren’t shown for hours

Resources

latest

Gitlab Snippet (widget code raw for karaf)

v1.0

Gitlab Snippet (widget code)

v1.1

Gitlab Snippet (widget code)

v1.2

Gitlab Snippet (widget code)

v1.3

Gitlab Snippet (widget code)

5 Likes

Hi, that’s a cool widget. Which Item do i have to use. I don’t find the item which is shown in your screenshot.

Are you using the one call api? The item is the root Onecall api item. That said if you renamed the thing the root item name will be different.

Here is my thing Configuration, should i find the item under the cannels?

I got the right item. I found it under the “model”. It’s the group item for “open weather map” thing.

Thank you

I will say that the current colors and all for temps are in F vs C but I can make an update or you can adjust in the widget config to your liking.

Cool widget!

May I suggest this for the definition of your props:

props:
  parameters:
    - description: Card Label
      name: label
      required: false
      type: TEXT
      groupName: weather_widget_params
    - description: Time for card. Must be Today, Tomorrow, Day2, Day3, Day4, Day5, Hours01, Hours02, Hours03, Hours04, Hours05, Hours06, Hours07, Hours08, Hours09, Hours10, Hours11, Hours12
      name: day
      required: true
      type: TEXT
      pattern: Today|Tomorrow|Day2|Day3|Day4|Day5|Hours01|Hours02|Hours03|Hours04|Hours05|Hours06|Hours07|Hours08|Hours09|Hours10|Hours11|Hours12
      groupName: weather_widget_params
    - context: item
      description: Show Current Temps
      label: Enable
      name: current
      required: false
      type: BOOLEAN
      groupName: weather_widget_params
    - context: item
      description: One Call API Weather and Forecast Item
      label: Item
      name: api
      required: true
      type: TEXT
      groupName: weather_widget_params
  parameterGroups:
  - name: weather_widget_params
    label: Weather Widget Params
    description: This assumes standard <a class="external text-color-blue" target="_blank" href="https://openweathermap.org/api/one-call-api">One Call API</a> usage with stardard underscore naming.

If you put all your parameters into a group you have a chance to give it a description (basic HTML is allowed) so your explanation would look way better:

image

Also remember to put only a single link to your raw code in your post and add the published tag so folks can install your widget from the openHAB UI.

1 Like

Also this parameter which only accepts certain values could be defined like this:

    - description: Time for card. # Must be Today, Tomorrow, Day2, Day3, Day4, Day5, Hours01, Hours02, Hours03, Hours04, Hours05, Hours06, Hours07, Hours08, Hours09, Hours10, Hours11, Hours12
      name: day
      label: Time for card
      required: true
      type: TEXT
      limitToOptions: true
      defaultValue: Today
      options:
        - label: Today
          value: Today
        - label: Tomorrow
          value: Tomorrow
        - label: Day 2
          value: Day2
        - label: Day 3
          value: Day3
        - label: Day 4
          value: Day4
        - label: Day 5
          value: Day5
        # etc.
      groupName: weather_widget_params
1 Like

I was following the post that says maintainers/admins add the published tags. If that isn’t the case I can add them. Given im using snippets is there a way i can on the forum post have a history? and only the most recent link be consumed by karaf?

You add the published tag yourself, there’s no pre-moderation, if you screw up then hopefully a moderator or someone with rights to edit your post will intervene.

For the widget to be installable you need to provide a link whose URL ends in .yaml, for GitLab this would be this button:
image

which gives you this URL: https://gitlab.com/-/snippets/2330999/raw/main/widget.yaml
and that’s what you should include in your post (presumably this URL will always lead to the latest version in the “main” branch).

If you want to show the history of changes then it’s okay to add a link to the GitLab snippet page as well.

ahh so as long as latest only is the full raw link im ok.

Can I ask that Announcing the Community Marketplace be updated about tags and the template for this category? both state mods adding that tag. I feel alot of posts in this category that dont have the tag would if the users knew.

Where did you get this group? Seems to be different in german, but I don’t have any “root Onecall api item”…

There is a known issue with non-english items. Given the suffixes are appended in english. The root item is the the item that is created from the thing (typically just a group) that all the other (actual items with data) are held under.

Hi @mediatech15 ,

i cannot add the widget from marketplace:

2022-06-18 10:17:24.947 [ERROR] [munity.CommunityUIWidgetAddonHandler] - Unable to parse YAML: Unrecognized field "default" (class org.openhab.core.config.core.dto.ConfigDescriptionParameterDTO), not marked as ignorable (22 known properties: "readOnly", "max", "limitToOptions", "groupName", "name", "stepsize", "context", "defaultValue", "min", "label", "filterCriteria", "verify", "type", "description", "options", "required", "advanced", "unit", "multipleLimit", "pattern", "multiple", "unitLabel"])
 at [Source: (StringReader); line: 10, column: 21] (through reference chain: org.openhab.core.ui.components.RootUIComponent["props"]->org.openhab.core.config.core.dto.ConfigDescriptionDTO["parameters"]->java.util.ArrayList[1]->org.openhab.core.config.core.dto.ConfigDescriptionParameterDTO["default"])
2022-06-18 10:17:24.948 [ERROR] [munity.CommunityUIWidgetAddonHandler] - Widget from marketplace is invalid: Unable to parse YAML

I’m on 3.3M6. Any idea?

br

So the error is caused by a default value but is working for me in M5. I wonder if the default property changed to defaultValue based on error message.

Actually im now running M6 but dont have it installed through marketplace. I also wonder if the marketplace parser is different from the actual app.