Widget "Post ist da"

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

Moderatoren: Cyrelian, seppy

atk69
Beiträge: 103
Registriert: 15. Jan 2019 19:07
Answers: 1
Wohnort: Weil am Rhein

Re: Widget "Post ist da"

Beitrag von atk69 »

Hallo peter-pan

hat geklappt :D
kleiner Korrekturen im Code und in meinem Kopf waren nötig ;)
läuft einwandfrei.
Bei Gelegenheit schaue ich mal, ob ich das blinken noch hinbekomme.

Vielen Dank
Gruss
Andreas
and IT works ;)

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

Re: Widget "Post ist da"

Beitrag von peter-pan »

Super.
Hier noch mal etwas modifizierter Widget-Code; zum "Spielen", wegen der Grössenverhältnisse, Texte, Formatierung, Hintergrundfarben, etc..

Code: Alles auswählen

uid: Post_da2
tags: []
props:
  parameters:
    - context: item
      label: Dummy Item
      name: dummy
      required: true
      type: TEXT
    - label: Titel
      name: title
      required: false
  parameterGroups: []
timestamp: Mar 24, 2026, 3:21:01 PM
component: f7-card
config:
  style:
    background: '=(items[props.dummy].state === "ON") ? "linear-gradient(to top
      right,#FA8072 30%,#00FFFF 60%)" : "linear-gradient(to bottom
      right,darkcyan 0%,turquoise 60%"'
    --f7-card-header-padding-horizontal: 150px
    --f7-card-header-font-size: 25px
    --f7-card-font-size: 20px
    --f7-card-height: 80px
  stylesheet: |
    .blink-active {
      animation: blinker 1s linear infinite;
    }
    @keyframes blinker {
      50% 
        { opacity: 0;
        }
    } 
  title: =props.title
slots:
  default:
    - component: oh-icon
      config:
        action: command
        actionCommand: "false"
        actionItem: =(props.dummy)
        class: '=(items[props.dummy].state === "ON") ? "blink-active" : ""'
        icon: '=(items[props.dummy].state === "OFF") ?
          "f7:exclamationmark_triangle_fill" : "f7:house"'
        height: 80
        style:
          color: '=(items[props.dummy].state === "ON") ? "green" : "red"'
          margin-left: 150px
    - component: Label
      config:
        style:
          font-weight: bold
          margin-left: 150px
        text: '=(items[props.dummy].state === "ON") ? "Post da" : "Keine Post"'
    - component: f7-col
      config: {}
      slots:
        default:
          - component: oh-toggle
            config:
              color: blue
              item: =(props.dummy)
              style:
                margin-left: 170px
Das sieht dann so aus:
widget.jpg
Das mit dem Blinken erschliesst sich mir noch nicht so richtig. Aber wenn du was findest, kannst du ja kurz Bescheid geben.

Gruss - Peter
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Pi5/8GB(PiOS Lite 64-bit(trixie)/SSD 120GB - OH5.1.3 openhabian
(Test openHAB 5.2.0 Build #5140 - snapshot)

Antworten