EinkAnalog/blueprint/ead_update.yaml

67 lines
1.9 KiB
YAML
Raw Normal View History

2024-03-01 00:50:32 +01:00
blueprint:
name: E-Paper Analog Display Updater
description: Update the E-Paper Analog Display value over MQTT
domain: automation
input:
sensor:
name: Sensor
description: The sensor to read the value from
selector:
entity:
domain: sensor
topic_name:
name: Topic Name
description: The name of the MQTT topic to publish to, needs to be unique
selector:
text:
display_name:
name: Display Name
description: The name of the value on the display, keep limited to about 16 characters
selector:
text:
display_value_min:
name: Display Value Min
description: The minimum value to display
default: 1
selector:
number:
min: -255
max: 255
display_value_max:
name: Display Value Max
description: The maximum value to display
default: 100
selector:
number:
min: -255
max: 255
display_segments:
name: Amount of segments on face
description: How many values to display between the min and max
default: 10
selector:
number:
min: 2
max: 20
variables:
sensor: !input sensor
topic_name: !input topic_name
display_name: !input display_name
display_value_min: !input display_value_min
display_value_max: !input display_value_max
display_unit: "{{ state_attr(sensor, 'unit_of_measurement') }}"
display_segments: !input display_segments
trigger:
- platform: state
entity_id: !input sensor
action:
- service: mqtt.publish
data:
topic_template: "{{ 'homeassistant/ead/' ~ topic_name }}"
qos: "0"
retain: false
payload_template: '{{ ''{ "name":"'' ~ display_name ~ ''", "val":"'' ~ states(sensor) ~ ''", "unit":"'' ~ display_unit ~ ''", "min":"'' ~ display_value_min ~ ''", "max":"'' ~ display_value_max ~ ''", "segm":"'' ~ display_segments ~ ''"}'' }}'