Yes, thats right. My esp home code accepts [{prio: <>, name: <>, msg:<>}, ...] to then show this on the two displays I run and on the flex table. To make the flex table work -I needs a MQTT sensor that receives the sent message back. Thats less efficient, compared to the alrt2 UI, of course, but consistent with the esphome display
Template to make the mqtt message
{# prios 4= High, 3=Medium, 2=Low, 1=Task, 0 = Info #}
{%set ns = namespace(payload=[]) %}
{%set items = states| selectattr("domain",'search','alert2')|
selectattr("attributes.ack_required",'search','True')|
selectattr("attributes.is_acked",'search','False')|list%}
{% for i in items%}{% set ns.payload = ns.payload + [{
'name': i.name,
'msg': 'neu',
'prio': 4}]%}
{% endfor %}
{%set items = states| selectattr("domain",'search','alert2')|
selectattr("state",'search','on')|
selectattr("attributes.is_acked",'search','False')|list%}
{% for i in items%}{% set ns.payload = ns.payload + [{
'name': i.name,
'msg': '',
'prio': i.attributes.priority|replace("high",4)|replace("medium",3)|replace("low",2)|int}]%}
{% endfor %}
{%set items = expand(
device_entities('783f72177aeb0ec8601f3a64f8dd99e7'))|
selectattr("state",'search','on')|list%}
{% for i in items%}{% set ns.payload = ns.payload + [{
'name': i.attributes.friendly_name,
'msg': '',
'prio': 1}]%}
{% endfor %}
{% if state_attr('sensor.waste_rest','daysTo')|float(10)<=3 %}
{% set ns.payload = ns.payload + [{'name': states('sensor.waste_rest'),'msg':state_attr('sensor.waste_rest','daysTo')|string+" T",'prio':0}]%}
{% endif %}
{%- set dt = (states('sensor.kamin_temperatur_temp_object_change')|float(0))/4-%}
{% if dt >0 %}{%- set dt =min( dt+0.5 ,3) |round %}{%set dt_a = "+"*dt%}{%- else -%}
{% if dt <0 %}{%- set dt =min(-(dt-0.5),3)|round %}{%set dt_a = "-"*dt%}
{%- else -%} {%set dt_a = "="%}{%- endif -%}{%- endif -%}
{% set ns.payload = ns.payload + [{'name': 'Kamin','msg':"dt "+dt_a+" | "+states('sensor.kamin_temperatur_temp_object', with_unit=True) ,'prio':0}]%}
{% if states('sun.sun')=='above_horizon' %}
{% set ns.payload = ns.payload + [{'name': 'Solar','msg':states('sensor.solar_power',with_unit=True),'prio':0}]%}
{% endif %}
{% set ns.payload = ns.payload + [{'name': 'Gas','msg':states('sensor.gasverbrauch_sum_24h',with_unit=True),'prio':0}]%}
{% set ns.payload = ns.payload|sort(attribute='prio',reverse=True) %}
{{ns.payload[:10]|tojson}}
Flex Table Card
type: custom:flex-table-card
entities:
include: sensor.homestatus_data
columns:
- data: data.prio
- data: data.name
- data: data.msg
css:
thead: display:none;
tbody tr:nth-child(even): "background-color: #a2542f6;"
td: "min-height: 20px"
alternatively i played with this flex card, just for the fun
type: custom:auto-entities
filter:
include:
- options: {}
entity_id: alert2.*
state: "on"
attributes:
is_acked: false
- options: {}
entity_id: alert2.*
state: "off"
attributes:
is_acked: false
ack_required: true
show_empty: true
card:
type: custom:flex-table-card
sort_by:
- is_acked-
- priority-
columns:
- data: priority
hidden: true
modify: if(x=="low"){"2"}else{if(x=="medium"){"3"}else{"4"}}
- data: friendly_name
align: right
name: Alert
tap_action:
action: more-info
- data: state
modify: if(x=="on"){"aktiv"}else{"inaktiv"}
- data: is_acked
name: gesehen
align: right
modify: if (x) {"Bestätigt"}else{"unbestätigt"}
hold_action:
action: perform-action
perform_action: alert2.ack
css:
thead: display:none;
tbody tr:nth-child(even): "background-color: #a2542f6;"
td: "min-height: 20px"
MQTT sensor
mqtt:
sensor:
- name: "homestatus_data"
state_topic: "homestatus/display/rawdata"
value_template: '{{value_json|count}}'
json_attributes_topic: "homestatus/display/rawdata"
json_attributes_template: "{{ {'data': value_json} |tojson}}"