Widget "Post ist da"

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

Moderatoren: Cyrelian, seppy

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

Widget "Post ist da"

Beitrag von atk69 »

Hallo zusammen,
irgendwie stelle ich mich mal wieder etwas dumm an ;) :
Ich brauche ein Widget, dass mir den Briefkastenstatus anzeigt.
Dazu habe ich einen IR-Sensor (MQTT) im Briefkasten, der das auch wunderbar macht.
Allerdings soll er sich nicht selbst zurückstellen, sonder per Button resettet werden.
Den Code für die Anzeige des Sensors habe ich schon, es fehlt "einfach" nur , dass der Status bis zum reset bleibt.
Bringt ja nix, wenn die Anzeige nur ein paar Sekunden da ist.

Code: Alles auswählen

uid: Post_da
tags: []
props:
  parameters:
    - context: item
      label: IR_Sensor1_IR Item
      name: IR_Sensor1_IR Item
      required: true
      type: TEXT
    - label: Titel
      name: title
      required: false
  parameterGroups: []
timestamp: Mar 21, 2026, 7:20:00 PM
component: f7-card
config:
  stylesheet: |
    @keyframes blinker {
      50% { opacity: 0; }
    } .blink-active {
      animation: blinker 1s linear infinite;
    }
  title: =props.title
slots:
  default:
    - component: oh-icon
      config:
        class: '=(items.IR_Sensor1_IR.state === "true") ? "blink-active" : ""'
        icon: '=(items.IR_Sensor1_IR.state === "false") ?
          "f7:exclamationmark_triangle_fill" : "f7:house"'
        size: 80
        style:
          color: '=(items.IR_Sensor1_IR.state === "true") ? "green" : "red"'
          margin-left: 20px
    - component: Label
      config:
        style:
          font-weight: bold
          margin-left: 20px
        text: '=(items.IR_Sensor1_IR.state === "true") ? "Post da" : "Keine Post"'
Gruss
Andreas
and IT works ;)

Harka
Beiträge: 595
Registriert: 30. Apr 2021 13:13
Answers: 19

Re: Widget "Post ist da"

Beitrag von Harka »

Moin,
Du musst dafür noch eine Aktion mit 'actionCommand: "false" 'einbauen. Hier auf den Icon (Achtung - Item ist variabel gemacht)

Code: Alles auswählen

uid: Post_da
tags: []
props:
  parameters:
    - context: item
      label: item
      name: Sensor_Item
      required: true
      type: TEXT
    - label: Titel
      name: title
      required: false
  parameterGroups: []
timestamp: Mar 21, 2026, 9:03:14 PM
component: f7-card
config:
  stylesheet: |
    @keyframes blinker {
      50% { opacity: 0; }
    } .blink-active {
      animation: blinker 1s linear infinite;
    }
  title: =props.title
slots:
  default:
    - component: oh-icon
      config:
        class: '=(items[props.Sensor_Item].state === "true") ? "blink-active" : ""'
        icon: '=(items[props.Sensor_Item].state === "false") ?
          "f7:exclamationmark_triangle_fill" : "f7:house"'
        size: 80
        style:
          color: '=(items[props.Sensor_Item].state === "true") ? "green" : "red"'
          margin-left: 20px
        actionItem: =(props.Sensor_Item)
        actionCommand: "false"
        action: command
    - component: Label
      config:
        style:
          font-weight: bold
          margin-left: 20px
        text: '=(items[props.Sensor_Item].state === "true") ? "Post da" : "Keine Post"'

Antworten