Re: Neue Blockly-Blöcke
Verfasst: 17. Dez 2023 16:55
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.
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
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