You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
EspHoMaTriXv2/copy2esphome/EHMTX_easy_state.yaml

203 lines
6.7 KiB

blueprint:
name: |-
ehmtxv2: show state with unit on 8x32 RGB-matrix
description: This blueprint is triggered by a state change. If the state is between certain values, it will be displayed with special colors or no state change will be displayed
domain: automation
input:
ehmtx_device:
name: Which EspHoMaTriX-device to display at?
selector:
device:
integration: esphome
trigger_sensor:
name: Which sensor state to show?
description: This sensor state will be displayed.
selector:
entity:
domain: sensor
multiple: true
default_color:
name: Default text color
description: This is the default text color for values within the low and the high value (90% white)
selector:
color_rgb:
default: [240, 240, 240]
lifetime:
name: How many minutes is this screen kept in the loop?
selector:
number:
min: 1
max: 1440
step: 1
default: 2
screen_time:
name: Minimum display time of this screen per loop in seconds?
selector:
number:
min: 6
max: 120
step: 2
default: 12
icon_name:
name: The icon associated to this state screen?
description: If you use additional icons in your YAML, you have to add them to this blueprint.
selector:
select:
mode: dropdown
options:
["error","home_assistant","temperature","lightbulb","music","phone","car","sleep8x32",]
default: home_assistant
use_friendly:
name: Use the triggers friendly name in display?
description: Add the friendly name of the sensor to the state display.
selector:
boolean:
default: true
default_font:
name: Use the default or set false to use the special font.
selector:
boolean:
default: true
use_colors:
name: Use colors based on state values?
description: If false, the default color will be used.
selector:
boolean:
default: false
low_value:
name: Below this value use "low color".
selector:
number:
mode: box
min: -10000
max: +10000
default: 0
low_color:
name: Low color
description: The color for values below the above limit.
selector:
color_rgb:
default: [40, 240, 40]
high_value:
name: Above this value use the "high Color".
selector:
number:
mode: box
min: -10000
max: +10000
default: 0
high_color:
name: High Color
description: Text color for values above the defined value
selector:
color_rgb:
default: [240, 40, 40]
variables:
display: !input ehmtx_device
bfriendly: !input use_friendly
def_color: !input default_color
lo_color: !input low_color
hi_color: !input high_color
mode: queued
trigger:
- platform: state
entity_id: !input trigger_sensor
action:
- if:
- condition: template
value_template: "{{ not use_colors }}"
then:
- service: |-
esphome.{{ device_attr(display, "name") }}_icon_screen
data:
icon_name: !input icon_name
screen_time: !input screen_time
lifetime: !input lifetime
text: |-
{% if bfriendly %}
{{trigger.to_state.attributes.friendly_name}}: {{trigger.to_state.state}} {{trigger.to_state.attributes.unit_of_measurement}}
{% else %}
{{trigger.to_state.state}} {{trigger.to_state.attributes.unit_of_measurement}}
{% endif %}
default_font: !input default_font
r: |-
{{ def_color[0] }}
g: |-
{{ def_color[1] }}
b: |-
{{ def_color[2] }}
else:
- choose:
- conditions:
- condition: numeric_state
entity_id: !input trigger_sensor
below: !input low_value
sequence:
- service: |-
esphome.{{ device_attr(display, "name") }}_icon_screen
data:
icon_name: !input icon_name
screen_time: !input screen_time
lifetime: !input lifetime
text: |-
{% if bfriendly %}
{{trigger.to_state.attributes.friendly_name}}: {{trigger.to_state.state}} {{trigger.to_state.attributes.unit_of_measurement}}
{% else %}
{{trigger.to_state.state}} {{trigger.to_state.attributes.unit_of_measurement}}
{% endif %}
default_font: !input default_font
r: |-
{{ lo_color[0] }}
g: |-
{{ lo_color[1] }}
b: |-
{{ lo_color[2] }}
- conditions:
- condition: numeric_state
entity_id: !input trigger_sensor
above: !input high_value
sequence:
- service: |-
esphome.{{ device_attr(display, "name") }}_icon_screen
data:
icon_name: !input icon_name
screen_time: !input screen_time
lifetime: !input lifetime
text: |-
{% if bfriendly %}
{{trigger.to_state.attributes.friendly_name}}: {{trigger.to_state.state}} {{trigger.to_state.attributes.unit_of_measurement}}
{% else %}
{{trigger.to_state.state}} {{trigger.to_state.attributes.unit_of_measurement}}
{% endif %}
default_font: !input default_font
r: |-
{{ hi_color[0] }}
g: |-
{{ hi_color[1] }}
b: |-
{{ hi_color[2] }}
default:
- service: |-
esphome.{{ device_attr(display, "name") }}_icon_screen
data:
icon_name: !input icon_name
screen_time: !input screen_time
lifetime: !input lifetime
text: |-
{% if bfriendly %}
{{trigger.to_state.attributes.friendly_name}}: {{trigger.to_state.state}} {{trigger.to_state.attributes.unit_of_measurement}}
{% else %}
{{trigger.to_state.state}} {{trigger.to_state.attributes.unit_of_measurement}}
{% endif %}
default_font: !input default_font
r: |-
{{ def_color[0] }}
g: |-
{{ def_color[1] }}
b: |-
{{ def_color[2] }}