|
发表于 2023-4-1 21:20:45
|
显示全部楼层
本帖最后由 a_dongde 于 2023-4-1 21:40 编辑
第一句应该取origin下面的content 值,不然诗词不完整,但是值里面带了【】和引号,我问了ChatGPT ,它让我在["content"]后后面加[0],正常了,完整代码为:
content: >-
<center><h2> {{ state_attr("sensor.short_part_of_poem", "origin")["content"][0]
}}
</h2> </center> <p align="right"> {{
state_attr("sensor.short_part_of_poem", "origin")["dynasty"] }} {{
state_attr("sensor.short_part_of_poem", "origin")["author"] }} - {{
state_attr("sensor.short_part_of_poem", "origin")["title"] }} </p>
ignore_line_breaks: true
type: custom:html-template-card
|
|