Seite 1 von 1

Widget "Post ist da"

Verfasst: 21. Mär 2026 19:38
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

Re: Widget "Post ist da"

Verfasst: 21. Mär 2026 21:08
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"'

Re: Widget "Post ist da"

Verfasst: 21. Mär 2026 22:10
von atk69
Vielen Dank Harka.
allerdings funktioniert es nicht.
Code sieht nun so aus:

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, 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.IR_Sensor1_IR_Item].state === "true") ? "blink-active" : ""'
        icon: '=(items[props.IR_Sensor1_IR_Item].state === "false") ?
          "f7:exclamationmark_triangle_fill" : "f7:house"'
        size: 80
        style:
          color: '=(items[props.IR_Sensor1_IR_Item].state === "true") ? "green" : "red"'
          margin-left: 20px
        actionItem: =(props.IR_Sensor1_IR_Item)
        actionCommand: "false"
        action: command
    - component: Label
      config:
        style:
          font-weight: bold
          margin-left: 20px
        text: '=(items[props.IR_Sensor1_IR_Item].state === "true") ? "Post da" : "Keine Post"'
sollte doch so korrekt sein ? :roll:
Hat sich nichts verändert. Er zeigt immer noch nur kurz an.

Re: Widget "Post ist da"

Verfasst: 21. Mär 2026 22:47
von Harka
Hast Du auf der Seite im Edit-Modus für das Feld unter Configure_Cell das Item ausgewählt? Kommt im Log der Befehl false an?