Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias: Send Custom App to Awtrix
- description: Sends an MQTT message to Awtrix3 to create or delete a custom app
- fields:
- topic:
- name: Topic
- description: The Awtrix custom app topic (without prefix)
- required: true
- example: my_custom_app
- text:
- name: Text
- description: Text to display on Awtrix
- default: ""
- example: Hello World
- color:
- name: Color
- description: Text color in hex format
- default: "#FFFFFF"
- example: "#FF0000"
- background:
- name: Background
- description: Background color in hex format
- default: "#000000"
- example: "#0000FF"
- hold:
- name: Hold
- description: Keep app displayed until manually removed
- default: false
- selector:
- boolean: null
- lifetime:
- name: Lifetime
- description: How long the app stays active (seconds)
- default: 3600
- selector:
- number:
- min: 1
- max: 86400
- unit_of_measurement: seconds
- lifetimeMode:
- name: Lifetime Mode
- description: Mode for lifetime behavior
- default: 0
- selector:
- number:
- min: 0
- max: 2
- retain:
- name: Retain
- description: Whether to retain the MQTT message
- default: false
- selector:
- boolean: null
- qos:
- name: QoS
- description: Quality of Service level for MQTT message
- default: "2: Exactly once"
- selector:
- select:
- options:
- - "0: Fire and forget"
- - "1: At least once"
- - "2: Exactly once"
- sequence:
- - variables:
- mqtt_topic: awtrix_52ec44/custom/{{ topic }}
- mqtt_qos: "{{ qos.split(':')[0] | int }}"
- mqtt_retain: "{{ true if text == '' else retain }}"
- - choose:
- - conditions:
- - condition: template
- value_template: "{{ text | length > 0 }}"
- sequence:
- - data:
- topic: "{{ mqtt_topic }}"
- payload: |-
- {
- "text": "{{ text }}",
- "color": "{{ color }}",
- "background": "{{ background }}",
- "hold": {{ hold | lower }},
- "lifetime": {{ lifetime }},
- "lifetimeMode": {{ lifetimeMode }}
- }
- qos: "{{ mqtt_qos }}"
- retain: "{{ mqtt_retain }}"
- action: mqtt.publish
- default:
- - data:
- topic: "{{ mqtt_topic }}"
- payload: ""
- qos: "{{ mqtt_qos }}"
- retain: "{{ mqtt_retain }}"
- action: mqtt.publish
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement