OH3 Widget/YAML Pseudo IF ELSE

GUI Relevanten, PaperUI, BasicUI, HabPanel ...

Moderatoren: seppy, udo1toni

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

Re: OH3 Widget/YAML Pseudo IF ELSE

Beitrag von peter-pan »

Das sieht hübsch aus. Kannst du auch noch den YAML-Code dazu posten ? Und was du genau steuerst (Hardware) ?

Danke und Gruss - Peter
Pi5/8GB(PiOS Lite 64-bit(bookworm)/SSD 120GB - OH4.1.1 openhabian

Mr. BJ
Beiträge: 83
Registriert: 27. Sep 2017 08:04

Re: OH3 Widget/YAML Pseudo IF ELSE

Beitrag von Mr. BJ »

Klar.
Ich verwende Homematic IP mit einer Fussbodenheizung:
- HmIP-WTH-2 Wandthermostat
- HmIP-SRH Griffsensor

Homematic Thermostat
Update 20.03.21:
- Unter Einstellungen kann man jetzt die Übersetzung für den Fensterstatus eintragen.
- Bei actionAnalyzerItems fehlte noch "props.", jetzt wird das Diagramm korrekt angezeigt.

Code: Alles auswählen

uid: Homematic Thermostat
tags: []
props:
  parameters:
    - description: Thermostat to control.
      label: Description
      name: title
      required: false
      type: TEXT
    - context: item
      description: The item for the actual temperature.
      label: Actual temperature
      name: item_current_temp
      required: true
      type: TEXT
    - context: item
      description: The item for the target temperature.
      label: Target temperature
      name: item_target_temp
      required: true
      type: TEXT
    - context: item
      description: The item for the humidity.
      label: Humidity
      name: item_humidity
      required: true
      type: TEXT
    - description: Optimal humidity min in percent.
      label: Humidity MIN
      name: optimalHumidityMin
      required: true
      type: TEXT
    - description: Optimal humidity max in percent.
      label: Humidity MAX
      name: optimalHumidityMax
      required: true
      type: TEXT
    - description: Title operating mode.
      label: Title
      name: titleOperatingMode
      required: false
      type: TEXT
    - context: item
      description: The item for the operating mode.
      label: Operating mode
      name: item_operating_mode
      required: true
      type: TEXT
    - description: Designation for Auto-Mode.
      label: Auto-Mode
      name: autoMode
      required: true
      type: TEXT
    - description: Designation for Manual-Mode.
      label: Manual-Mode
      name: manualMode
      required: true
      type: TEXT
    - context: item
      description: The item for the current weekly profile.
      label: Weekly profile
      name: item_current_weeklyprofile
      required: true
      type: TEXT
    - context: item
      description: The item for the state of the window.
      label: Window state
      name: item_window_state
      required: false
      type: TEXT
    - description: Translate window is open.
      label: Open
      name: windowStateOpen
      required: false
      type: TEXT
    - description: Translate window is closed.
      label: Closed
      name: windowStateClosed
      required: false
      type: TEXT
    - description: Translate window is tiled.
      label: Tiled
      name: windowStateTiled
      required: false
      type: TEXT
    - description: Title weekly profile.
      label: Title
      name: titleWeeklyProfile
      required: false
      type: TEXT
    - description: Weekly profile 1. (~ unvisible option)
      label: Profile 1
      name: weeklyProfile1
      required: false
      type: TEXT
    - description: Weekly profile 2. (~ unvisible option)
      label: Profile 2
      name: weeklyProfile2
      required: false
      type: TEXT
    - description: Weekly profile 3. (~ unvisible option)
      label: Profile 3
      name: weeklyProfile3
      required: false
      type: TEXT
    - description: Weekly profile 4. (~ unvisible option)
      label: Profile 4
      name: weeklyProfile4
      required: false
      type: TEXT
    - description: Weekly profile 5. (~ unvisible option)
      label: Profile 5
      name: weeklyProfile5
      required: false
      type: TEXT
    - description: Weekly profile 6. (~ unvisible option)
      label: Profile 6
      name: weeklyProfile6
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Mar 19, 2021, 9:19:18 PM
component: f7-card
slots:
  content:
    - component: f7-row
      slots:
        default:
          - component: f7-col
            slots:
              default:
                - component: oh-label-card
                  config:
                    trendItem: =(props.item_current_temp)
                    trendLineColor: gray
                    action: analyzer
                    actionAnalyzerItems: =[props.item_current_temp, props.item_target_temp, props.item_humidity]
                    item: =(props.item_current_temp)
                    title: =(props.title)
                    icon: f7:thermometer
    - component: f7-row
      slots:
        default:
          - component: f7-col
            config:
              class:
                - padding-right: 0
                - padding-left: 0
                - margin-right: 0
                - margin-left: 0
              style:
                text-align: center
            slots:
              default:
                - component: oh-button
                  config:
                    action: popup
                    actionModal: widget:Homematic Operating Mode
                    actionModalConfig:
                      title: =(props.titleOperatingMode)
                      item: =(props.item_operating_mode)
                      autoMode: =(props.autoMode)
                      manualMode: =(props.manualMode)
                    icon-f7: gear
                    icon-size: 28
                    icon-color: "=items[props.item_operating_mode].state === '0' ? 'gray' : 'red'"
                    style:
                      --f7-button-bg-color: transparent
                      --f7-button-hover-bg-color: transparent
                      --f7-button-border-radius: 5px
                      --f7-button-pressed-bg-color: transparent
                      --f7-button-fill-hover-bg-color: transparent
          - component: f7-col
            config:
              class:
                - padding-right: 0
                - padding-left: 0
                - margin-right: 0
                - margin-left: 0
              style:
                text-align: center
            slots:
              default:
                - component: oh-button
                  config:
                    action: popup
                    actionModal: widget:Homematic Weekly Profiler
                    actionModalConfig:
                      title: =(props.titleWeeklyProfile)
                      item: =(props.item_current_weeklyprofile)
                      weeklyProfile1: =(props.weeklyProfile1)
                      weeklyProfile2: =(props.weeklyProfile2)
                      weeklyProfile3: =(props.weeklyProfile3)
                      weeklyProfile4: =(props.weeklyProfile4)
                      weeklyProfile5: =(props.weeklyProfile5)
                      weeklyProfile6: =(props.weeklyProfile6)
                    icon-f7: calendar
                    icon-size: 28
                    icon-color: gray
                    color: gray
                    style:
                      --f7-button-bg-color: transparent
                      --f7-button-hover-bg-color: transparent
                      --f7-button-border-radius: 5px
                      --f7-button-pressed-bg-color: transparent
                      --f7-button-fill-hover-bg-color: transparent
          - component: f7-col
            config:
              class:
                - padding-right: 0
                - padding-left: 0
                - margin-right: 0
                - margin-left: 0
              style:
                text-align: center
            slots:
              default:
                - component: f7-icon
                  config:
                    f7: drop
                    size: 28
                    color: '=(items[props.item_humidity].state <= props.optimalHumidityMin ? "orange" : (items[props.item_humidity].state >= props.optimalHumidityMax ? "red" : "gray"))'
          - component: f7-col
            config:
              visible: =props.item_window_state != null
              class:
                - padding-right: 0
                - padding-left: 0
                - margin-right: 0
                - margin-left: 0
              style:
                text-align: center
            slots:
              default:
                - component: f7-icon
                  config:
                    f7: square
                    size: 28
                    color: gray
    - component: f7-row
      slots:
        default:
          - component: f7-col
            config:
              style:
                text-align: center
            slots:
              default:
                - component: Label
                  config:
                    text: '=items[props.item_operating_mode].state === "0" ? props.autoMode : props.manuelMode'
                    style:
                      font-size: 12px
                      color: gray
          - component: f7-col
            config:
              style:
                text-align: center
            slots:
              default:
                - component: Label
                  config:
                    text: =items[props.item_current_weeklyprofile].state
                    style:
                      font-size: 12px
                      color: gray
          - component: f7-col
            config:
              style:
                text-align: center
            slots:
              default:
                - component: Label
                  config:
                    text: =items[props.item_humidity].state
                    style:
                      font-size: 12px
                      color: gray
          - component: f7-col
            config:
              visible: =props.item_window_state != null
              style:
                text-align: center
            slots:
              default:
                - component: Label
                  config:
                    text: '=items[props.item_window_state].state === "CLOSED" ? props.windowStateClosed : (items[props.item_window_state].state === "TILTED" ? props.windowStateTiled : props.windowStateOpen)'
                    style:
                      font-size: 12px
                      color: gray
    - component: f7-row
      slots:
        default:
          - component: f7-col
            slots:
              default:
                - component: oh-slider-card
                  config:
                    item: =(props.item_target_temp)
                    min: 15
                    scaleSteps: 5
                    max: 25
                    scale: true
                    step: 0.2
                    label: true
                    scaleSubSteps: 5
                    footer: =(items[props.item_target_temp].state)
Homematic Operating Mode

Code: Alles auswählen

uid: Homematic Operating Mode
tags: []
props:
  parameters:
    - description: Der Titel der Betriebsart
      label: Titel
      name: title
      required: true
      type: TEXT
    - context: item
      description: Das Item für das die Betriebsart eingestellt wird
      label: Betriebsart Item
      name: item
      required: true
      type: TEXT
    - description: Designation for Auto-Mode.
      label: Auto-Mode
      name: autoMode
      required: true
      type: TEXT
    - description: Designation for Manual-Mode.
      label: Manual-Mode
      name: manualMode
      required: true
      type: TEXT
  parameterGroups: []
timestamp: Mar 15, 2021, 11:52:25 AM
component: oh-list-card
config:
  title: =props.title
slots:
  default:
    - component: oh-list-item
      config:
        title: =(props.autoMode)
        action: command
        actionItem: =props.item
        actionCommand: "0"
        icon: "=items[props.item].state === '0' ? 'f7:circle_fill' : 'f7:circle'"
        iconColor: red
    - component: oh-list-item
      config:
        title: =(props.manualMode)
        action: command
        actionItem: =props.item
        actionCommand: "1"
        icon: "=items[props.item].state === '1' ? 'f7:circle_fill' : 'f7:circle'"
        iconColor: red
Homematic Weekly Profiler

Code: Alles auswählen

uid: Homematic Weekly Profiler
tags: []
props:
  parameters:
    - description: Der Titel der Betriebsart
      label: Titel
      name: title
      required: true
      type: TEXT
    - context: item
      description: The item for the current weekly profile.
      label: Weekly profile
      name: item
      required: true
      type: TEXT
    - description: Weekly profile 1. (~ unvisible option)
      label: Profile 1
      name: weeklyProfile1
      required: false
      type: TEXT
    - description: Weekly profile 2. (~ unvisible option)
      label: Profile 2
      name: weeklyProfile2
      required: false
      type: TEXT
    - description: Weekly profile 3. (~ unvisible option)
      label: Profile 3
      name: weeklyProfile3
      required: false
      type: TEXT
    - description: Weekly profile 4. (~ unvisible option)
      label: Profile 4
      name: weeklyProfile4
      required: false
      type: TEXT
    - description: Weekly profile 5. (~ unvisible option)
      label: Profile 5
      name: weeklyProfile5
      required: false
      type: TEXT
    - description: Weekly profile 6. (~ unvisible option)
      label: Profile 6
      name: weeklyProfile6
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Mar 15, 2021, 11:31:54 AM
component: oh-list-card
config:
  title: =props.title
slots:
  default:
    - component: oh-list-item
      config:
        visible: =(props.weeklyProfile1) !== "~"
        title: =(props.weeklyProfile1)
        action: command
        actionItem: =props.item
        actionCommand: "1"
        icon: "=items[props.item].state === '1' ? 'f7:circle_fill' : 'f7:circle'"
        iconColor: red
    - component: oh-list-item
      config:
        visible: =(props.weeklyProfile2) !== "~"
        title: =(props.weeklyProfile2)
        action: command
        actionItem: =props.item
        actionCommand: "2"
        icon: "=items[props.item].state === '2' ? 'f7:circle_fill' : 'f7:circle'"
        iconColor: red
    - component: oh-list-item
      config:
        visible: =(props.weeklyProfile3) !== "~"
        title: =(props.weeklyProfile3)
        action: command
        actionItem: =props.item
        actionCommand: "3"
        icon: "=items[props.item].state === '3' ? 'f7:circle_fill' : 'f7:circle'"
        iconColor: red
    - component: oh-list-item
      config:
        visible: =(props.weeklyProfile4) !== "~"
        title: =(props.weeklyProfile4)
        action: command
        actionItem: =props.item
        actionCommand: "4"
        icon: "=items[props.item].state === '4' ? 'f7:circle_fill' : 'f7:circle'"
        iconColor: red
    - component: oh-list-item
      config:
        visible: =(props.weeklyProfile5) !== "~"
        title: =(props.weeklyProfile5)
        action: command
        actionItem: =props.item
        actionCommand: "5"
        icon: "=items[props.item].state === '5' ? 'f7:circle_fill' : 'f7:circle'"
        iconColor: red
    - component: oh-list-item
      config:
        visible: =(props.weeklyProfile6) !== "~"
        title: =(props.weeklyProfile6)
        action: command
        actionItem: =props.item
        actionCommand: "6"
        icon: "=items[props.item].state === '6' ? 'f7:circle_fill' : 'f7:circle'"
        iconColor: red

Homematic Profile Week Card
Hiermit kann man ein Item das neue Wochenprofil zuweisen das dann eine Regel ausführt.

Code: Alles auswählen

uid: Homematic Profile Week Card
tags: []
props:
  parameters:
    - description: Titel
      label: Title
      name: title
      required: false
      type: TEXT
    - context: item
      description: An item to control
      label: Item
      name: item
      required: false
      type: TEXT
    - description: Weekly profile 1. (~ unvisible option)
      label: Profile 1
      name: profile1
      required: false
      type: TEXT
    - description: Weekly profile 2. (~ unvisible option)
      label: Profile 2
      name: profile2
      required: false
      type: TEXT
    - description: Weekly profile 3. (~ unvisible option)
      label: Profile 3
      name: profile3
      required: false
      type: TEXT
    - description: Weekly profile 4. (~ unvisible option)
      label: Profile 4
      name: profile4
      required: false
      type: TEXT
    - description: Weekly profile 5. (~ unvisible option)
      label: Profile 5
      name: profile5
      required: false
      type: TEXT
    - description: Weekly profile 6. (~ unvisible option)
      label: Profile 6
      name: profile6
      required: false
      type: TEXT
  parameterGroups: []
timestamp: Mar 17, 2021, 10:37:01 AM
component: f7-card
slots:
  content:
    - component: f7-row
      config:
        style:
          height: 100%
      slots:
        default:
          - component: f7-col
            slots:
              default:
                - component: oh-list-card
                  config:
                    title: =(props.title)
                    simpleList: true
                    footer: =(items[props.item].state)
                    style:
                      height: 100%
                  slots:
                    default:
                      - component: oh-list-item
                        config:
                          visible: =(props.profile1) !== "~"
                          title: =(props.profile1)
                          action: command
                          actionItem: =props.item
                          actionCommand: 1
                          listButton: true
                          color: gray
                      - component: oh-list-item
                        config:
                          visible: =(props.profile2) !== "~"
                          title: =(props.profile2)
                          action: command
                          actionItem: =props.item
                          actionCommand: 2
                          listButton: true
                          color: gray
                      - component: oh-list-item
                        config:
                          visible: =(props.profile3) !== "~"
                          title: =(props.profile3)
                          action: command
                          actionItem: =props.item
                          actionCommand: 3
                          listButton: true
                          color: gray
                      - component: oh-list-item
                        config:
                          visible: =(props.profile4) !== "~"
                          title: =(props.profile4)
                          action: command
                          actionItem: =props.item
                          actionCommand: 4
                          listButton: true
                          color: gray
                      - component: oh-list-item
                        config:
                          visible: =(props.profile5) !== "~"
                          title: =(props.profile5)
                          action: command
                          actionItem: =props.item
                          actionCommand: 5
                          listButton: true
                          color: gray
                      - component: oh-list-item
                        config:
                          visible: =(props.profile6) !== "~"
                          title: =(props.profile6)
                          action: command
                          actionItem: =props.item
                          actionCommand: 6
                          listButton: true
                          color: gray
Gruß Björn


Pi4 mit debMatic, Docker [openHAB 3.3, Mosquitto];
Philips Hue Bridge; amazon echo; HomeMaticIP

Antworten