我搜索markdown的时候,搜索到html-templat-card,也能实现,分享下!
type: custom:html-template-card
ignore_line_breaks: true
content: |
<style>
table {
width: 100%;
border-collapse: collapse;
margin: 5px 0;
font-size: 0.9em;
min-width: 400px;
border-radius: 10px;
}
th, td {
padding: 12px 15px;
text-align: center;
border-bottom: 1px solid #dddddd;
}
th {
color: #ffffff;
text-align: center;
}
</style>
<table>
<thead>
<tr>
<th>日期</th>
<th>星期</th>
<th>值班人</th>
<th>状态</th>
</tr>
</thead>
<tbody>
{% set a = state_attr("sensor.works1","works") %} {% for b in a %}
<tr>
<td>{{ b.Date }}</td>
<td>{{ b.Week }}</td>
<td>{{ b.Person }}</td>
<td>{{ b.Content }}</td>
</tr>
{% endfor %}
</tbody>
</table>
|