OH3-Widget für Regenvorhersage Openweathermap

Für welche Projekte verwendet Ihr OpenHAB? Was habt Ihr automatisiert? Stellt eure Projekte hier vor.

Moderatoren: Cyrelian, seppy

Antworten
Benutzeravatar
guinnes
Beiträge: 146
Registriert: 21. Apr 2020 19:46

OH3-Widget für Regenvorhersage Openweathermap

Beitrag von guinnes »

Hallo
Hat jemand Interesse an meinem Widget zur Anzeige der Regenvorhersage mit der One-Call-Api von Openweathermap :
Bild
Bild
Bild
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Glückauf
guinnes

Benutzeravatar
peter-pan
Beiträge: 2564
Registriert: 28. Nov 2018 12:03
Answers: 25
Wohnort: Schwäbisch Gmünd

Re: OH3-Widget für Regenvorhersage Openweathermap

Beitrag von peter-pan »

...stell's doch einfach mal rein (YAML). Evtl. mit ein paar Infos zum SetUp.
Leider hat OWM in meiner Region eine "gewisse Unschärfe". Das ist aber, soweit ich mich noch erinnern kann, mit der fehlenden Anzahl von Messstationen verbunden.

Ich habe momentan ein Custom-Widget (weathercard) von RGroll (internationales Forum) im Einsatz:
owm.jpg
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Pi5/8GB(PiOS Lite 64-bit(bookworm)/SSD 120GB - OH4.1.1 openhabian

Benutzeravatar
guinnes
Beiträge: 146
Registriert: 21. Apr 2020 19:46

Re: OH3-Widget für Regenvorhersage Openweathermap

Beitrag von guinnes »

Na, denn :
Voraussetzungen :
OpenWaetherMap One-Call-Api
die 60 Items für die Regenvorhersage
Eine Gruppe, in der alle Vorhersagewerte drin sind, mit der Aggregatfunktion MAX
Die Namen der Items müßen so aufgebaut sein : 1. Ein einheitliches Prefix am Anfang ( bei mir OC_FCMin ), die jeweilige Minute 2-stellig und jeweils ein Suffix für den Vorhersage-Wert ( bei mir _Precipitation ) und für die Vorhersage-Zeit ( bei mir _Timestamp ).
Es gibt 5 Anzeigebereiche : 0..2 mm, 0..5 mm, 0..10 mm, 0..20 mm und 0..50 mm zwischen denen umgeschaltet wird

Code: Alles auswählen

uid: guinnes_Rain_Forecast
tags: []
props:
  parameters:
    - default: OC_FCMin
      description: One Call Minute Prefix
      label: Prefix
      name: OC_Prefix
      required: false
      type: TEXT
    - default: _Precipitation
      description: One Call Minute Suffix for Precipitation
      label: Suffix for Precipitation
      name: OC_Prec_Suffix
      required: false
      type: TEXT
    - default: _Timestamp
      description: One Call Minute Suffix for Timestamp
      label: Suffix for Timestamp
      name: OC_Time_Suffix
      required: false
      type: TEXT
    - context: item
      description: Max Precipitation group
      label: Max Precipitation group
      name: Max_Group
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Jul 31, 2022, 8:51:00 PM
component: f7-card
config:
  expandable: false
  style:
    background-color: rgba(180, 180, 180, 0.5)
    border-radius: 20px
slots:
  default:
    - component: f7-card-content
      config:
        style:
          padding-left: .75rem
          width: 100%
      slots:
        default:
          - component: f7-col
            config:
              style:
                align-items: center
                flex-direction: row
                font-size: 14px
                margin-left: 10px
                margin-top: -10px
                width: calc(100% - 45px)
            slots:
              default:
                - component: Label
                  config:
                    style:
                      color: black
                      text-align: center
                    text: Regenvorhersage für die nächste Stunde ( mm/m² )
          - component: f7-block
            config:
              style:
                display: flex
                justify-content: space-between
                margin-bottom: 0px
                margin-left: 25px
                margin-top: 5px
                padding-top: 0px
                text-align: center
                width: calc(100% - 38px)
            slots:
              default:
                - component: Label
                  config:
                    text: 0
                - component: Label
                  config:
                    text: >
                      =((Number.parseFloat(items[props.Max_Group].state) > 10) ? "4"  : (Number.parseFloat(items[props.Max_Group].state) > 5) ? "2" : (Number.parseFloat(items[props.Max_Group].state) > 2) ? "1" : "0.4")
                - component: Label
                  config:
                    text: >
                      =((Number.parseFloat(items[props.Max_Group].state) > 10) ? "8"  : (Number.parseFloat(items[props.Max_Group].state) > 5) ? "4" : (Number.parseFloat(items[props.Max_Group].state) > 2) ? "2" : "0.8")
                - component: Label
                  config:
                    text: >
                      =((Number.parseFloat(items[props.Max_Group].state) > 10) ? "12"  : (Number.parseFloat(items[props.Max_Group].state) > 5) ? "6" : (Number.parseFloat(items[props.Max_Group].state) > 2) ? "3" : "1.2")
                - component: Label
                  config:
                    text: >
                      =((Number.parseFloat(items[props.Max_Group].state) > 10) ? "16"  : (Number.parseFloat(items[props.Max_Group].state) > 5) ? "8" : (Number.parseFloat(items[props.Max_Group].state) > 2) ? "4" : "1.6")
                - component: Label
                  config:
                    text: >
                      =((Number.parseFloat(items[props.Max_Group].state) > 10) ? "20"  : (Number.parseFloat(items[props.Max_Group].state) > 5) ? "10" : (Number.parseFloat(items[props.Max_Group].state) > 2) ? "5" : "2.0")
          - component: f7-col
            config:
              style:
                align-items: left
                display: flex
                flex-direction: row
                width: 100%
            slots:
              default:
                - component: f7-col
                  config:
                    style:
                      //border-style: solid
                      margin-left: -15px
                      width: 55px
                  slots:
                    default:
                      - component: f7-block
                        config:
                          style:
                            height: 23%
                            margin-top: -6px
                            text-align: right
                        slots:
                          default:
                            - component: Label
                              config:
                                text: =items[props.OC_Prefix + '01' + props.OC_Time_Suffix].displayState.substring(11,16)
                      - component: f7-block
                        config:
                          style:
                            height: 25%
                            text-align: right
                        slots:
                          default:
                            - component: Label
                              config:
                                text: =items[props.OC_Prefix + '15' + props.OC_Time_Suffix].displayState.substring(11,16)
                      - component: f7-block
                        config:
                          style:
                            height: 25%
                            text-align: right
                        slots:
                          default:
                            - component: Label
                              config:
                                text: =items[props.OC_Prefix + '30' + props.OC_Time_Suffix].displayState.substring(11,16)
                      - component: f7-block
                        config:
                          style:
                            height: 25%
                            text-align: right
                        slots:
                          default:
                            - component: Label
                              config:
                                style:
                                  text-align: right
                                text: =items[props.OC_Prefix + '45' + props.OC_Time_Suffix].displayState.substring(11,16)
                      - component: Label
                        config:
                          style:
                            padding-right: 2px
                            text-align: right
                          text: =items[props.OC_Prefix + '60' + props.OC_Time_Suffix].displayState.substring(11,16)
                - component: f7-row
                  config:
                    style:
                      align-items: left
                      display: flex
                      flex-direction: col
                      width: 100%
                  slots:
                    default:
                      - component: f7-list
                        config:
                          style:
                            margin-bottom: 1px
                            margin-top: 1px
                            width: calc(100% - 38px)
                        slots:
                          default:
                            - component: oh-repeater
                              config:
                                for: Minute
                                rangeStart: 1
                                rangeStep: 1
                                rangeStop: 60
                                sourceType: range
                              slots:
                                default:
                                  - component: f7-col
                                    config:
                                      style:
                                        align-items: center
                                        display: flex
                                        flex-direction: row
                                        margin-left: 0px
                                        width: 100%
                                    slots:
                                      default:
                                        - component: f7-row
                                          config:
                                            style:
                                              width: 100%
                                          slots:
                                            default:
                                              - component: f7-progressbar
                                                config:
                                                  bgColor: white
                                                  color: >
                                                    = ((Number.parseFloat(items[props.OC_Prefix + loop.Minute.toString().padStart(2,'0') + props.OC_Prec_Suffix].state) > 10) ? "pink" 
                                                       : (Number.parseFloat(items[props.OC_Prefix + loop.Minute.toString().padStart(2,'0') + props.OC_Prec_Suffix].state) > 5) ? "red"
                                                       : (Number.parseFloat(items[props.OC_Prefix + loop.Minute.toString().padStart(2,'0') + props.OC_Prec_Suffix].state) > 2) ? "yellow" : "green") 
                                                  progress: >
                                                    = Number.parseFloat(items[props.OC_Prefix + loop.Minute.toString().padStart(2,'0') + props.OC_Prec_Suffix].state) *
                                                         ((Number.parseFloat(items[props.Max_Group].state) > 10) ? 5 
                                                        : (Number.parseFloat(items[props.Max_Group].state) > 5) ? 10
                                                        : (Number.parseFloat(items[props.Max_Group].state) > 2) ? 20 : 50)
                                                  style:
                                                    border-style: none
Es wird sicherlich einfacher und vor allem schneller gehen, aber ich habe keine Möglichkeit gefunden, Java-Variablen zu definieren und zu füllen und zu benutzen
@peter-pan : Das Widget benutze ich auch, etwas erweitert
Glückauf
guinnes

Benutzeravatar
peter-pan
Beiträge: 2564
Registriert: 28. Nov 2018 12:03
Answers: 25
Wohnort: Schwäbisch Gmünd

Re: OH3-Widget für Regenvorhersage Openweathermap

Beitrag von peter-pan »

Leider habe ich die OWM-Version nicht mit "Minuten" installiert. Das kann ich zwar machen, aber dann müsste ich die fehlenden Items auch noch anlegen.

Wäre es evtl. möglich, wenn du diese in Text-Form vorliegen hast, auch noch zur Verfügung zu stellen ? Das mit den "Prefixen, Suffixen und Timestamps" hab ich auch noch nicht so ganz kapiert. Bin gerade auch etwas faul! Das Wetter.....😎😎😎😴 😴 😴 ;)
Pi5/8GB(PiOS Lite 64-bit(bookworm)/SSD 120GB - OH4.1.1 openhabian

Benutzeravatar
guinnes
Beiträge: 146
Registriert: 21. Apr 2020 19:46

Re: OH3-Widget für Regenvorhersage Openweathermap

Beitrag von guinnes »

peter-pan hat geschrieben: 16. Aug 2022 13:46 Leider habe ich die OWM-Version nicht mit "Minuten" installiert.
Das sollte ja wohl Ruck-Zuck zu machen sein
Das kann ich zwar machen, aber dann müsste ich die fehlenden Items auch noch anlegen.
Wäre es evtl. möglich, wenn du diese in Text-Form vorliegen hast, auch noch zur Verfügung zu stellen ?
Kein Problem
Glücklicherweise kann ich zwischen JSON-DB und Text-Darstellung hin und her kopieren :
Die Things :

Code: Alles auswählen

Bridge openweathermap:weather-api:api "OpenWeatherMap Konto" [apikey= xxxxxxxxxxxxxxxxxxxxxxxxxx, language= de, refreshInterval= 5]{
  Thing onecall OneCall "One Call API - Lokales Wetter und Wettervorhersage" [forecastDays= 7, forecastHours= 12, forecastMinutes= 60, location= xxxxxxxxxxxxxxxxxx,xxxxxxxxxxxxxxxxxxx, numberOfAlerts= 3]
und die Items :

Code: Alles auswählen

Group:Number:MAX    gDynRainForecastMax         "Maximaler erwarteter Niederschlag"
Number              OC_FCMin01_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes01#precipitation"}
DateTime            OC_FCMin01_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes01#time-stamp"}
Number              OC_FCMin02_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes02#precipitation"}
DateTime            OC_FCMin02_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes02#time-stamp"}
Number              OC_FCMin03_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes03#precipitation"}
DateTime            OC_FCMin03_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes03#time-stamp"}
Number              OC_FCMin04_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes04#precipitation"}
DateTime            OC_FCMin04_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes04#time-stamp"}
Number              OC_FCMin05_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes05#precipitation"}
DateTime            OC_FCMin05_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes05#time-stamp"}
Number              OC_FCMin06_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes06#precipitation"}
DateTime            OC_FCMin06_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes06#time-stamp"}
Number              OC_FCMin07_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes07#precipitation"}
DateTime            OC_FCMin07_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes07#time-stamp"}
Number              OC_FCMin08_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes08#precipitation"}
DateTime            OC_FCMin08_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes08#time-stamp"}
Number              OC_FCMin09_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes09#precipitation"}
DateTime            OC_FCMin09_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes09#time-stamp"}
Number              OC_FCMin10_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes10#precipitation"}
DateTime            OC_FCMin10_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes10#time-stamp"}
Number              OC_FCMin11_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes11#precipitation"}
DateTime            OC_FCMin11_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes11#time-stamp"}
Number              OC_FCMin12_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes12#precipitation"}
DateTime            OC_FCMin12_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes12#time-stamp"}
Number              OC_FCMin13_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes13#precipitation"}
DateTime            OC_FCMin13_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes13#time-stamp"}
Number              OC_FCMin14_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes14#precipitation"}
DateTime            OC_FCMin14_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes14#time-stamp"}
Number              OC_FCMin15_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes15#precipitation"}
DateTime            OC_FCMin15_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes15#time-stamp"}
Number              OC_FCMin16_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes16#precipitation"}
DateTime            OC_FCMin16_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes16#time-stamp"}
Number              OC_FCMin17_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes17#precipitation"}
DateTime            OC_FCMin17_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes17#time-stamp"}
Number              OC_FCMin18_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes18#precipitation"}
DateTime            OC_FCMin18_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes18#time-stamp"}
Number              OC_FCMin19_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes19#precipitation"}
DateTime            OC_FCMin19_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes19#time-stamp"}
Number              OC_FCMin20_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes20#precipitation"}
DateTime            OC_FCMin20_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes20#time-stamp"}
Number              OC_FCMin21_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes21#precipitation"}
DateTime            OC_FCMin21_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes21#time-stamp"}
Number              OC_FCMin22_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes22#precipitation"}
DateTime            OC_FCMin22_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes22#time-stamp"}
Number              OC_FCMin23_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes23#precipitation"}
DateTime            OC_FCMin23_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes23#time-stamp"}
Number              OC_FCMin24_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes24#precipitation"}
DateTime            OC_FCMin24_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes24#time-stamp"}
Number              OC_FCMin25_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes25#precipitation"}
DateTime            OC_FCMin25_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes25#time-stamp"}
Number              OC_FCMin26_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes26#precipitation"}
DateTime            OC_FCMin26_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes26#time-stamp"}
Number              OC_FCMin27_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes27#precipitation"}
DateTime            OC_FCMin27_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes27#time-stamp"}
Number              OC_FCMin28_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes28#precipitation"}
DateTime            OC_FCMin28_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes28#time-stamp"}
Number              OC_FCMin29_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes29#precipitation"}
DateTime            OC_FCMin29_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes29#time-stamp"}
Number              OC_FCMin30_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes30#precipitation"}
DateTime            OC_FCMin30_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes30#time-stamp"}
Number              OC_FCMin31_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes31#precipitation"}
DateTime            OC_FCMin31_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes31#time-stamp"}
Number              OC_FCMin32_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes32#precipitation"}
DateTime            OC_FCMin32_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes32#time-stamp"}
Number              OC_FCMin33_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes33#precipitation"}
DateTime            OC_FCMin33_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes33#time-stamp"}
Number              OC_FCMin34_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes34#precipitation"}
DateTime            OC_FCMin34_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes34#time-stamp"}
Number              OC_FCMin35_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes35#precipitation"}
DateTime            OC_FCMin35_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes35#time-stamp"}
Number              OC_FCMin36_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes36#precipitation"}
DateTime            OC_FCMin36_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes36#time-stamp"}
Number              OC_FCMin37_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes37#precipitation"}
DateTime            OC_FCMin37_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes37#time-stamp"}
Number              OC_FCMin38_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes38#precipitation"}
DateTime            OC_FCMin38_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes38#time-stamp"}
Number              OC_FCMin39_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes39#precipitation"}
DateTime            OC_FCMin39_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes39#time-stamp"}
Number              OC_FCMin40_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes40#precipitation"}
DateTime            OC_FCMin40_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes40#time-stamp"}
Number              OC_FCMin41_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes41#precipitation"}
DateTime            OC_FCMin41_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes41#time-stamp"}
Number              OC_FCMin42_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes42#precipitation"}
DateTime            OC_FCMin42_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes42#time-stamp"}
Number              OC_FCMin43_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes43#precipitation"}
DateTime            OC_FCMin43_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes43#time-stamp"}
Number              OC_FCMin44_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes44#precipitation"}
DateTime            OC_FCMin44_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes44#time-stamp"}
Number              OC_FCMin45_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes45#precipitation"}
DateTime            OC_FCMin45_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes45#time-stamp"}
Number              OC_FCMin46_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes46#precipitation"}
DateTime            OC_FCMin46_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes46#time-stamp"}
Number              OC_FCMin47_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes47#precipitation"}
DateTime            OC_FCMin47_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes47#time-stamp"}
Number              OC_FCMin48_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes48#precipitation"}
DateTime            OC_FCMin48_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes48#time-stamp"}
Number              OC_FCMin49_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes49#precipitation"}
DateTime            OC_FCMin49_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes49#time-stamp"}
Number              OC_FCMin50_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes50#precipitation"}
DateTime            OC_FCMin50_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes50#time-stamp"}
Number              OC_FCMin51_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes51#precipitation"}
DateTime            OC_FCMin51_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes51#time-stamp"}
Number              OC_FCMin52_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes52#precipitation"}
DateTime            OC_FCMin52_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes52#time-stamp"}
Number              OC_FCMin53_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes53#precipitation"}
DateTime            OC_FCMin53_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes53#time-stamp"}
Number              OC_FCMin54_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes54#precipitation"}
DateTime            OC_FCMin54_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes54#time-stamp"}
Number              OC_FCMin55_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes55#precipitation"}
DateTime            OC_FCMin55_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes55#time-stamp"}
Number              OC_FCMin56_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes56#precipitation"}
DateTime            OC_FCMin56_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes56#time-stamp"}
Number              OC_FCMin57_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes57#precipitation"}
DateTime            OC_FCMin57_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes57#time-stamp"}
Number              OC_FCMin58_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes58#precipitation"}
DateTime            OC_FCMin58_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes58#time-stamp"}
Number              OC_FCMin59_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes59#precipitation"}
DateTime            OC_FCMin59_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes59#time-stamp"}
Number              OC_FCMin60_Precipitation    "Niederschlag"                              (eq_OC_FCRain,gDynRainForecastMax)  [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes60#precipitation"}
DateTime            OC_FCMin60_Timestamp        "Letzte Messung"                            (eq_OC_FCRain)                      [Point]     {channel="openweathermap:onecall:OneCall:forecastMinutes60#time-stamp"}
Das mit den "Prefixen, Suffixen und Timestamps" hab ich auch noch nicht so ganz kapiert.
Zum Prefix :
Alle Items fangen mit dem Prifix an :
OC_FCMin01_Precipitation
OC_FCMin01_Timestamp
OC_FCMin02_Precipitation
OC_FCMin02_Timestamp
usw.
Und hörem mit dem Wert-Suffix auf :
OC_FCMin01_Precipitation
OC_FCMin02_Precipitation
bzw mit dem Timestanp-Suffix :
OC_FCMin01_Timestamp
OC_FCMin02_Timestamp

Somit ist nur die Minuten-Angabe variabel und du kannst locker drüber iterieren
Glückauf
guinnes

Benutzeravatar
peter-pan
Beiträge: 2564
Registriert: 28. Nov 2018 12:03
Answers: 25
Wohnort: Schwäbisch Gmünd

Re: OH3-Widget für Regenvorhersage Openweathermap

Beitrag von peter-pan »

...
guinnes hat geschrieben: 16. Aug 2022 18:38 Das sollte ja wohl Ruck-Zuck zu machen sein
so ist es. Das war wirklich das kleinste Problem.

Danke für die Items. Waren aber, wie ich mir fast gedacht hatte, nicht 60 sondern 120 Items. Gut ich hätte sie mir auch mit VSC generieren lassen können, aber dann ich doch noch etwas Hand anlegen müssen...Puhhh, du weißt ja, ...diese Hitze. ;) . War schon schwer genug die Regentropfen in das Widget zu bringen. :lol: :lol: :lol:

Das Ergebnis:
guinnes.jpg
Wie meinst du das ?:
guinnes hat geschrieben: 16. Aug 2022 18:38 Kein Problem
Glücklicherweise kann ich zwischen JSON-DB und Text-Darstellung hin und her kopieren :
Hast du da ein Tool dafür oder einen speziellen Trick ?
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Pi5/8GB(PiOS Lite 64-bit(bookworm)/SSD 120GB - OH4.1.1 openhabian

Benutzeravatar
guinnes
Beiträge: 146
Registriert: 21. Apr 2020 19:46

Re: OH3-Widget für Regenvorhersage Openweathermap

Beitrag von guinnes »

peter-pan hat geschrieben: 17. Aug 2022 15:47 Das Ergebnis:
Das passiert, wenn der Messbereich überschritten wird und das nicht in der Gruppe bemerkt worden ist. ( Ist wohl ne Eigenheit der f7-progressbar )
Hast du da ein Tool dafür oder einen speziellen Trick ?
Ein selbstgeschriebenes Tool. Ich habe die letzten 20 Jahre meines Berufslebens als Programmierer gearbeitet und schreibe mir immer wieder spezielle Tools, die mir gerade helfen können, das gehört dazu. Es kann :
Things aus der JSON-DB auslesen
Items aus der JSON-DB auslesen
Things als Text abspeichern
Items als Text abspeichern
Das Model per Drag & Drop anlegen ( ich bin schon 68, wenn ich das Model mit den Bordmitteln erzeugt hätte, wäre ich eher unterm Torf, eh daß ich fertig wäre )
Ist aber ne frühe Beta
Glückauf
guinnes

Benutzeravatar
peter-pan
Beiträge: 2564
Registriert: 28. Nov 2018 12:03
Answers: 25
Wohnort: Schwäbisch Gmünd

Re: OH3-Widget für Regenvorhersage Openweathermap

Beitrag von peter-pan »

guinnes hat geschrieben: 17. Aug 2022 22:15 ich bin schon 68
:lol: :lol: :lol: :lol: willkommen im Club. Ich bin auch Jahrgang '54. Leider hab ich mit Programmierung nichts bzw. sehr wenig zu tun gehabt.(Steuern/Bilanzen/Buchhaltung)

Aber halt Spass mit OH. In OH2 hab ich mich auch mal ein bisschen mit Python/Jython befasst. Das hab ich aber so leider nicht nach OH3 retten können. Aber meine Affinität zu Textkonfigurationen habe ich beibehalten. Ich finde die halt einfach übersichtlicher und flexibler. Aber das ist halt Geschmackssache.
Pi5/8GB(PiOS Lite 64-bit(bookworm)/SSD 120GB - OH4.1.1 openhabian

Benutzeravatar
guinnes
Beiträge: 146
Registriert: 21. Apr 2020 19:46

Re: OH3-Widget für Regenvorhersage Openweathermap

Beitrag von guinnes »

Hallo
Es gibt eine neue Version :
Bild

Code: Alles auswählen

uid: guinnes_Rain_Forecast
tags: []
props:
  parameters:
    - default: OC_FCMin
      description: One Call Minute Prefix
      label: Prefix
      name: OC_Prefix
      required: false
      type: TEXT
    - default: _Precipitation
      description: One Call Minute Suffix for Precipitation
      label: Suffix for Precipitation
      name: OC_Prec_Suffix
      required: false
      type: TEXT
    - default: _Timestamp
      description: One Call Minute Suffix for Timestamp
      label: Suffix for Timestamp
      name: OC_Time_Suffix
      required: false
      type: TEXT
    - context: item
      default: gDynRainForecastMax
      description: Max Precipitation group
      label: Max Precipitation group
      name: Max_Group
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Sep 27, 2022, 6:57:49 PM
component: f7-card
config:
  expandable: false
  style:
    background-color: rgba(180, 180, 180, 0.5)
    border-radius: 20px
slots:
  default:
    - component: f7-card-content
      config:
        style:
          padding-left: .75rem
          width: 100%
      slots:
        default:
          - component: f7-col
            config:
              style:
                align-items: center
                flex-direction: row
                font-size: 14px
                margin-left: 10px
                margin-top: -10px
                width: calc(100% - 45px)
            slots:
              default:
                - component: Label
                  config:
                    style:
                      color: black
                      text-align: center
                    text: Regenvorhersage für die nächste Stunde ( mm/m² )
          - component: f7-block
            config:
              style:
                display: flex
                justify-content: space-between
                margin-bottom: 0px
                margin-left: 25px
                margin-top: 5px
                padding-top: 0px
                text-align: center
                width: calc(100% - 38px)
            slots:
              default:
                - component: Label
                  config:
                    text: 0
                - component: Label
                  config:
                    text: >
                      =((Number.parseFloat(items[props.Max_Group].state) >= 10) ? "4"  :    (Number.parseFloat(items[props.Max_Group].state) >= 5) ? "2" :    (Number.parseFloat(items[props.Max_Group].state) >= 2) ? "1" : "0.4")
                - component: Label
                  config:
                    text: >
                      =((Number.parseFloat(items[props.Max_Group].state) >= 10) ? "8"  :    (Number.parseFloat(items[props.Max_Group].state) >= 5) ? "4" :    (Number.parseFloat(items[props.Max_Group].state) >= 2) ? "2" : "0.8")
                - component: Label
                  config:
                    text: >
                      =((Number.parseFloat(items[props.Max_Group].state) >= 10) ? "12"  :    (Number.parseFloat(items[props.Max_Group].state) >= 5) ? "6" :   (Number.parseFloat(items[props.Max_Group].state) >= 2) ? "3" : "1.2")
                - component: Label
                  config:
                    text: >
                      =((Number.parseFloat(items[props.Max_Group].state) >= 10) ? "16"  :    (Number.parseFloat(items[props.Max_Group].state) >= 5) ? "8" :    (Number.parseFloat(items[props.Max_Group].state) >= 2) ? "4" : "1.6")
                - component: Label
                  config:
                    text: >
                      =((Number.parseFloat(items[props.Max_Group].state) >= 10) ? "20"  :    (Number.parseFloat(items[props.Max_Group].state) >= 5) ? "10" :    (Number.parseFloat(items[props.Max_Group].state) >= 2) ? "5" : "2.0")
          - component: f7-col
            config:
              style:
                align-items: left
                display: flex
                flex-direction: row
                width: 100%
            slots:
              default:
                - component: f7-col
                  config:
                    style:
                      //border-style: solid
                      margin-left: -15px
                      width: 55px
                  slots:
                    default:
                      - component: f7-block
                        config:
                          style:
                            height: 23%
                            margin-top: -6px
                            text-align: right
                        slots:
                          default:
                            - component: Label
                              config:
                                text: =items[props.OC_Prefix + '01' + props.OC_Time_Suffix].displayState.substring(11,16)
                      - component: f7-block
                        config:
                          style:
                            height: 25%
                            text-align: right
                        slots:
                          default:
                            - component: Label
                              config:
                                text: =items[props.OC_Prefix + '15' + props.OC_Time_Suffix].displayState.substring(11,16)
                      - component: f7-block
                        config:
                          style:
                            height: 25%
                            text-align: right
                        slots:
                          default:
                            - component: Label
                              config:
                                text: =items[props.OC_Prefix + '30' + props.OC_Time_Suffix].displayState.substring(11,16)
                      - component: f7-block
                        config:
                          style:
                            height: 25%
                            text-align: right
                        slots:
                          default:
                            - component: Label
                              config:
                                style:
                                  text-align: right
                                text: =items[props.OC_Prefix + '45' + props.OC_Time_Suffix].displayState.substring(11,16)
                      - component: Label
                        config:
                          style:
                            padding-right: 2px
                            text-align: right
                          text: =items[props.OC_Prefix + '60' + props.OC_Time_Suffix].displayState.substring(11,16)
                - component: f7-row
                  config:
                    style:
                      align-items: left
                      display: flex
                      flex-direction: col
                      width: 100%
                  slots:
                    default:
                      - component: f7-list
                        config:
                          style:
                            background: >
                              =items[props.Max_Group].state >= 10 ? "linear-gradient(to right, green , yellow 10%, red 25%, blue 40%, pink 70%)"  :  items[props.Max_Group].state >= 5 ? "linear-gradient(to right, green , yellow 20%, red 40% , blue 60% )" :  items[props.Max_Group].state >= 2 ? "linear-gradient(to right, green , yellow 40%, red 80%)" :  "linear-gradient(to right, green , yellow)"
                            margin-bottom: 1px
                            margin-top: 1px
                            width: calc(100% - 38px)
                        slots:
                          default:
                            - component: oh-repeater
                              config:
                                for: Minute
                                rangeStart: 1
                                rangeStep: 1
                                rangeStop: 60
                                sourceType: range
                              slots:
                                default:
                                  - component: f7-col
                                    config:
                                      style:
                                        align-items: center
                                        display: flex
                                        flex-direction: row
                                        margin-left: 0px
                                        width: 100%
                                    slots:
                                      default:
                                        - component: f7-block
                                          config:
                                            style:
                                              background: white
                                              border-color: white
                                              border-style: solid
                                              height: 6px
                                              left: >
                                                =Number.parseFloat(items[props.OC_Prefix + loop.Minute.toString().padStart(2,'0') + props.OC_Prec_Suffix].state) * ((Number.parseFloat(items[props.Max_Group].state) >= 10) ? 5 :  (Number.parseFloat(items[props.Max_Group].state) >= 5) ? 10 :  (Number.parseFloat(items[props.Max_Group].state) >= 2) ? 20 : 50) + '%'
                                              margin-bottom: 0px
                                              margin-top: 0px
                                              padding-top: 0px
                                              width: >
                                                =100 - Math.min(Number.parseFloat(items[props.OC_Prefix + loop.Minute.toString().padStart(2,'0') + props.OC_Prec_Suffix].state) *
                                                 ((Number.parseFloat(items[props.Max_Group].state) >= 10) ? 5 :
                                                 (Number.parseFloat(items[props.Max_Group].state) >= 5) ? 10 :
                                                 (Number.parseFloat(items[props.Max_Group].state) >= 2) ? 20 : 50),100) + '%'
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Glückauf
guinnes

Antworten