Neue Blockly-Blöcke

Einrichtung der openHAB Umgebung und allgemeine Konfigurationsthemen.

Moderatoren: seppy, udo1toni

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

Re: Neue Blockly-Blöcke

Beitrag von Harka »

FeuchteForum.png
hab Dir mal 3 Wege aufgezeigt. Beim Schreiben mit Einheit ist wegen eines bekannten Fehlers (soll ab OH 4.1 gelöst sein) noch ein Umweg via String nötig.
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.

hoerbp
Beiträge: 3
Registriert: 17. Dez 2023 09:02
Answers: 0

Re: Neue Blockly-Blöcke

Beitrag von hoerbp »

Vielen Dank!!!!
Funktioniert super : )

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

Re: Neue Blockly-Blöcke

Beitrag von Harka »

Hier noch eine rudimentäre Einbindung der Semantic-Eigenschaften von Items. Z.B kann semantic_item_location zum Ermitteln des Raums genutzt werden. Der Name beginnt immer mit dem Typ des zurückgegebenen Wertes, wobei b_ für boolean und s_ für string steht.
https://openhab.github.io/openhab-js/it ... ntics.html
semanticBlock.png

Code: Alles auswählen

uid: Semantics
tags: []
props:
  parameters: []
  parameterGroups: []
timestamp: May 30, 2024, 1:44:26 PM
component: BlockLibrary
config:
  name: Semantics
slots:
  blocks:
    - component: BlockType
      config:
        args0:
          - name: optSemantic
            options:
              - - item_equipment
                - equipment
              - - s_equipmentType
                - equipmentType
              - - b_isEquipment
                - isEquipment
              - - b_isLocation
                - isLocation
              - - b_isPoint
                - isPoint
              - - item_location
                - location
              - - s_locationType
                - locationType
              - - s_pointType
                - pointType
              - - s_propertyType
                - propertyType
              - - s_semanticType
                - semanticType
            type: field_dropdown
          - align: right
            name: semanticItem
            type: input_value
        colour: 10
        helpUrl: https://openhab.github.io/openhab-js/items.ItemSemantics.html
        message0: semantic %1 of item %2
        output: ""
        tooltip: bei Variablen ggf. get_name_of_item nutzen
        type: block1
      slots:
        code:
          - component: BlockCodeTemplate
            config:
              template: items.getItem({{input:semanticItem}}).semantics.{{field:optSemantic}}
        toolbox:
          - component: PresetInput
            config:
              name: semanticItem
              shadow: true
              type: oh_item
E: die Blöcke für Semantic und Luftfeuchte werden hier NICHT mehr weiter gepflegt. Ich habe für die ein offizielle Bibliothek erstellt -> Semantic features and air humidity
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.
Zuletzt geändert von Harka am 4. Jun 2025 19:53, insgesamt 1-mal geändert.

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

Re: Neue Blockly-Blöcke

Beitrag von Harka »

Moin,
ich bin wegen der beeinflussbaren Benachrichtigungstöne auf den Pushover-Zug aufgesprungen. Gerade diese werden aber leider von Pushover Actions nicht unterstützt. Ich habe daher eine abgewandelte Lösung, die eher meinen Bedürfnissen entspricht, gebastelt. Diese besteht aus 3 Blöcken. Mittel, Groß und Klein. Letztere unterstützt auch HTML-Text. Im Gegensatz zur Version von Confectrician wird kein Nashorn mehr unterstützt!
Pushover25.png

Code: Alles auswählen

uid: Pushover_25
tags: []
props:
  parameters: []
  parameterGroups: []
timestamp: Apr 9, 2025, 6:47:43 PM
component: BlockLibrary
config:
  name: Pushover Block
slots:
  blocks:
    - component: BlockType
      config:
        args0:
          - name: ACCOUNT
            type: input_value
            align: right
          - name: MESSAGE
            type: input_value
            align: right
          - name: TITLE
            text: openHAB
            type: input_value
            align: right
          - name: PRIO
            options:
              - - emergency
                - "2"
              - - high
                - "1"
              - - normal
                - "0"
              - - low
                - "-1"
              - - lowest
                - "-2"
            type: field_dropdown
          - align: right
            name: SOUND
            type: input_value
          - name: EXPIRY
            type: field_dropdown
            options:
              - - "null"
                - "null"
              - - 1min
                - time.Duration.ofSeconds(60)
              - - 30min
                - time.Duration.ofMinutes(30)
              - - 2h
                - time.Duration.ofHours(2)
              - - 12h
                - time.Duration.ofHours(12)
        colour: "40"
        helpUrl: https://www.openhab.org/addons/bindings/pushover/#thing-actions
        inputsInline: false
        lastDummyAlign0: right
        message0: To Pushover %1 send Message %2 expiry %6 with title %3 Prio %4 u.
          Sound %5
        nextStatement: ""
        previousStatement: ""
        tooltip: "Beispiele für Sound: hellsbells, kaffee_fertig, palimpalim"
        type: sendSoundMessage
      slots:
        code:
          - component: BlockCodeTemplate
            config:
              template: >
                actions.thingActions('pushover',{{input:ACCOUNT}})
                    .sendMessage({{input:MESSAGE}},{{utility:fTestNull}}({{input:TITLE}}),{{utility:fTestNull}}({{input:SOUND}}),null,
                    null, null, null, {{field:PRIO}},null, {{field:EXPIRY}});
        toolbox:
          - component: PresetInput
            config:
              fields:
                TEXT: What's up?
              name: MESSAGE
              shadow: true
              type: text
          - component: PresetInput
            config:
              name: ACCOUNT
              shadow: true
              type: oh_thing
          - component: PresetInput
            config:
              fields:
                TEXT: openHAB
              name: TITLE
              shadow: true
              type: text
          - component: PresetInput
            config:
              fields:
                TEXT: Bike
              name: SOUND
              shadow: true
              type: text
          - component: PresetField
            config:
              name: PRIO
              value: 0
    - component: BlockType
      config:
        args0:
          - name: ACCOUNT
            type: input_value
            align: right
          - name: MESSAGE
            type: input_value
            align: right
          - name: TITLE
            text: openHAB
            type: input_value
            align: right
          - name: PRIO
            options:
              - - emergency
                - "2"
              - - high
                - "1"
              - - normal
                - "0"
              - - low
                - "-1"
              - - lowest
                - "-2"
            type: field_dropdown
          - align: right
            name: SOUND
            type: input_value
          - name: EXPIRY
            type: field_dropdown
            options:
              - - "null"
                - "null"
              - - 1min
                - time.Duration.ofSeconds(60)
              - - 30min
                - time.Duration.ofMinutes(30)
              - - 2h
                - time.Duration.ofHours(2)
              - - 12h
                - time.Duration.ofHours(12)
          - name: CONTENT_TYPE
            options:
              - - "null"
                - "null"
              - - image/jpeg
                - image/jpeg
              - - image/png
                - image/png
              - - image/gif
                - image/gif
              - - audio/mpeg
                - audio/mpeg
              - - text/xml
                - text/xml
              - - text/html
                - text/html
              - - text/plain
                - text/plain
            type: field_dropdown
          - name: ATTACHMENT
            type: input_value
            align: right
          - name: DEVICE
            text: "null"
            type: field_input
          - name: URL
            type: input_value
            align: right
        colour: "40"
        helpUrl: https://www.openhab.org/addons/bindings/pushover/
        inputsInline: false
        lastDummyAlign0: right
        message0: To Pushover %1 send Message %2 expiry %6 with title %3 Prio %4 u.
          Sound %5 Typ %7 as Attachment %8 DeviceID %9 URL %10
        nextStatement: ""
        previousStatement: ""
        tooltip: ""
        type: sendAllMessage
      slots:
        code:
          - component: BlockCodeTemplate
            config:
              template: >
                actions.thingActions('pushover',{{input:ACCOUNT}})
                    .sendMessage({{input:MESSAGE}},{{utility:fTestNull}}({{input:TITLE}}),{{utility:fTestNull}}({{input:SOUND}}),{{utility:fTestNull}}({{input:URL}}),
                    null, {{utility:fTestNull}}({{input:ATTACHMENT}}), {{field:CONTENT_TYPE}}, {{field:PRIO}},'{{field:DEVICE}}', {{field:EXPIRY}});
        toolbox:
          - component: PresetInput
            config:
              fields:
                TEXT: What's up?
              name: MESSAGE
              shadow: true
              type: text
          - component: PresetInput
            config:
              name: ACCOUNT
              shadow: true
              type: oh_thing
          - component: PresetInput
            config:
              fields:
                TEXT: openHAB
              name: TITLE
              shadow: true
              type: text
          - component: PresetInput
            config:
              fields:
                TEXT: Bike
              name: SOUND
              shadow: true
              type: text
          - component: PresetField
            config:
              name: PRIO
              value: 0
    - component: BlockType
      config:
        args0:
          - name: ACCOUNT
            type: input_value
            align: right
          - name: MESSAGE
            type: input_value
            align: right
          - name: TITLE
            type: input_value
            align: right
          - name: EXPIRY
            type: field_dropdown
            options:
              - - "null"
                - "null"
              - - 1min
                - time.Duration.ofSeconds(60)
              - - 30min
                - time.Duration.ofMinutes(30)
              - - 2h
                - time.Duration.ofHours(2)
              - - 12h
                - time.Duration.ofHours(12)
        colour: "40"
        helpUrl: https://www.openhab.org/addons/bindings/pushover/
        inputsInline: false
        lastDummyAlign0: right
        message0: To Pushover %1 send HTML Message %2 expiry %4 with title %3
        nextStatement: ""
        previousStatement: ""
        tooltip: HTML-Formatierung innerhalb der App-Ansicht möglich <b>bold</b>
        type: sendHtmlMessage
      slots:
        code:
          - component: BlockCodeTemplate
            config:
              template: >
                actions.thingActions('pushover',{{input:ACCOUNT}})
                  .sendHtmlMessage({{input:MESSAGE}}, {{utility:fTestNull}}({{input:TITLE}}), {{field:EXPIRY}});
        toolbox:
          - component: PresetInput
            config:
              fields:
                TEXT: What's up?
              name: MESSAGE
              shadow: true
              type: text
          - component: PresetInput
            config:
              name: ACCOUNT
              shadow: true
              type: oh_thing
          - component: PresetInput
            config:
              fields:
                TEXT: openHAB
              name: TITLE
              shadow: true
              type: text
  utilities:
    - component: UtilityFunction
      config:
        code: "function {{name}}(arg) {return arg == undefined ? null : arg;}"
        name: fTestNull
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.

Antworten