1) Decluttering Card https://github.com/custom-cards/decluttering-card
2) Mushroom https://github.com/piitaya/lovelace-mushroom
decluttering_templates:
std_room_card: #Decluttering Card 模板
default: #所有变量的默认值
- area_name: none #区域名称,用于灯具判断,灯实体的位置必须对应,隐藏的实体不计入
- area_friendly_name: 默认房间 #区域别称,即卡片标题
- cover_name: 窗帘 #窗帘别称
- cover_entity: none # 窗帘的cover实体
- climate_name: 中央空调 #空调别称
- climate_entity: none #空调的climate实体
- icon: mdi:help #显示图标
- appliance_string: none #设备列表字符串,格式为"switch.xxx,media_player.xxx,fan.xxx"
- script_entity: none #该区域对应的功能(如一键关闭该区域所有设备)脚本,长按卡片执行
- navigation_path: /lovelace/home #导航路径,单击卡片执行
card:
type: custom:mushroom-template-card
primary: '[[zxsq-anti-bbcode-area_friendly_name]]'
secondary: |-
{% set light_list=
expand(states.light)
|selectattr('entity_id', 'in', area_entities('[[zxsq-anti-bbcode-area_name]]'))
|map(attribute='entity_id')
|reject('is_hidden_entity')
|list
%}
{% set lights_ns=namespace(number=0) %} {% for entity in light_list %}
{% if states(entity) not in ['off', 'unknown', 'unavailable', 'None'] %}
{% set lights_ns.number=lights_ns.number+1 %}
{% endif %}
{% endfor %}
{% set appliance_string='[[zxsq-anti-bbcode-appliance_string]]' %}
{% set appliances_ns=namespace(number=0) %} {% for entity in
appliance_string.split(",") %}
{% if states(entity) not in ['off', 'unknown', 'unavailable', 'None', 'standby', 'paused', 'idle', 'not_home'] %}
{% set appliances_ns.number=appliances_ns.number+1 %}
{% endif %}
{% endfor %}
{% set climate=states('[[zxsq-anti-bbcode-climate_entity]]') %} {% if climate not in
['off', 'unknown', 'unavailable', 'None'] %}
{% if climate=='cool' %}{% set climate_status='制冷' %}
{% elif climate=='heat' %}{% set climate_status='制热' %}
{% elif climate=='dry' %}{% set climate_status='除湿' %}
{% elif climate=='fan_only' %}{% set climate_status='送风' %}
{% else %}{% set climate_status='打开' %}
{% endif %}
{% endif %}
{% set curtain=states('[[zxsq-anti-bbcode-cover_entity]]') %} {% if curtain not in
['off', 'unknown', 'unavailable', 'None'] %}
{% if curtain=='open' %}{% set curtain_status='已打开' %}
{% elif curtain=='closed' %}{% set curtain_status='已合上' %}
{% else %}{% set curtain_status='未知' %}
{% endif %}
{% endif %}
{% if lights_ns.number==0 and appliances_ns.number==0 and
(climate_status is not defined) %} {% set all_off=true %} {% else %}{%
set all_off=false %} {% endif %}
{% set script_status=is_state('[[zxsq-anti-bbcode-script_entity]]','on') %}
{% if script_status %}正在关闭中...{% else %}
{{'[[zxsq-anti-bbcode-cover_name]]'+curtain_status if curtain_status is defined}}{% if
all_off %}
已关闭{% else %}{% if lights_ns.number!=0 %}
{{lights_ns.number}}盏灯亮着{% endif %}{% if appliances_ns.number!=0 %}
{{appliances_ns.number}}个设备打开{% endif %}{% endif %}
{{'[[zxsq-anti-bbcode-climate_name]]'+climate_status if climate_status is defined}} {%
endif %}
icon: '[[zxsq-anti-bbcode-icon]]'
icon_color: >-
{% set light_list=
expand(states.light)
|selectattr('entity_id', 'in', area_entities('[[zxsq-anti-bbcode-area_name]]'))
|map(attribute='entity_id')
|reject('is_hidden_entity')
|list
%}
{% set lights_ns=namespace(number=0) %} {% for entity in light_list %}
{% if states(entity) not in ['off', 'unknown', 'unavailable', 'None'] %}
{% set lights_ns.number=lights_ns.number+1 %}
{% endif %}
{% endfor %}
{% set appliance_string='[[zxsq-anti-bbcode-appliance_string]]' %}
{% set appliances_ns=namespace(number=0) %} {% for entity in
appliance_string.split(",") %}
{% if states(entity) not in ['off', 'unknown', 'unavailable', 'None', 'standby', 'paused', 'idle', 'not_home'] %}
{% set appliances_ns.number=appliances_ns.number+1 %}
{% endif %}
{% endfor %}
{% set climate=states('[[zxsq-anti-bbcode-climate_entity]]') %} {% if climate not in
['off', 'unknown', 'unavailable', 'None'] %}
{% if climate=='cool' %}{% set climate_status='制冷' %}
{% elif climate=='heat' %}{% set climate_status='制热' %}
{% elif climate=='dry' %}{% set climate_status='除湿' %}
{% elif climate=='fan_only' %}{% set climate_status='送风' %}
{% else %}{% set climate_status='打开' %}
{% endif %}
{% endif %}
{% set curtain=states('[[zxsq-anti-bbcode-cover_entity]]') %} {% if curtain not in
['off', 'unknown', 'unavailable', 'None'] %}
{% if curtain=='open' %}{% set curtain_status='已打开' %}
{% elif curtain=='closed' %}{% set curtain_status='已合上' %}
{% else %}{% set curtain_status='未知' %}
{% endif %}
{% endif %}
{% if lights_ns.number==0 and appliances_ns.number==0 and
(climate_status is not defined) %} {% set all_off=true %} {% else %}{%
set all_off=false %} {% endif %}
{% set script_status=is_state('[[zxsq-anti-bbcode-script_entity]]','on') %}
{% if script_status %}orange {% elif climate_status is defined %}green
{% elif appliances_ns.number!=0 %}blue {% endif %}
badge_icon: |-
{% set light_list=
expand(states.light)
|selectattr('entity_id', 'in', area_entities('[[zxsq-anti-bbcode-area_name]]'))
|map(attribute='entity_id')
|reject('is_hidden_entity')
|list
%}
{% set lights_ns=namespace(number=0) %} {% for entity in light_list %}
{% if states(entity) not in ['off', 'unknown', 'unavailable', 'None'] %}
{% set lights_ns.number=lights_ns.number+1 %}
{% endif %}
{% endfor %}
{{ 'mdi:ceiling-light-outline' if lights_ns.number>0 }}
badge_color: |-
{% set light_list=
expand(states.light)
|selectattr('entity_id', 'in', area_entities('[[zxsq-anti-bbcode-area_name]]'))
|map(attribute='entity_id')
|reject('is_hidden_entity')
|list
%}
{% set lights_ns=namespace(number=0) %} {% for entity in light_list %}
{% if states(entity) not in ['off', 'unknown', 'unavailable', 'None'] %}
{% set lights_ns.number=lights_ns.number+1 %}
{% endif %}
{% endfor %}
{{ 'orange' if lights_ns.number>0 }}
multiline_secondary: true
fill_container: true
tap_action:
action: navigate
navigation_path: '[[zxsq-anti-bbcode-navigation_path]]'
hold_action:
action: call-service
service: script.turn_on
data: {}
target:
entity_id: '[[zxsq-anti-bbcode-script_entity]]'
double_tap_action:
action: none
layout: horizontal
···
type: custom:decluttering-card
template: std_room_card
variables:
- area_name: secondary_bedroom
- area_friendly_name: 次卧
- icon: mdi:bed-queen-outline
- cover_entity: cover.xxx
- climate_entity: climate.xxx
- appliance_string: fan.xxx
- script_entity: script.xxx
- navigation_path: /lovelace/home
Ari 发表于 2023-7-5 08:54
这个帖子会分享配置吗 小白想抄作业
idook 发表于 2023-7-5 14:06
不同客户端,能设置自动用不同的页面吗
自在 发表于 2023-7-5 22:39
区域可以考虑tab插件,操作起来比较便捷
Sparta 发表于 2023-7-9 17:00
太好用了mushroom
lszjl 发表于 2023-7-10 12:06
兄弟 你这个卡片式什么主题吗,这个房间的显示式怎么做到的
Sparta 发表于 2023-7-10 14:22
https://community.home-assistant.io/t/mushroom-cards-build-a-beautiful-dashboard-easily/388590/236 ...
kkk123 发表于 2023-7-5 18:21
那个根据每个房间分类设备如何做出来的?
Sparta 发表于 2023-7-9 17:00
太好用了mushroom
自在 发表于 2023-7-5 22:39
区域可以考虑tab插件,操作起来比较便捷
Anooki 发表于 2023-8-14 11:17
老哥,tab插件全称是啥
自在 发表于 2023-7-5 22:39
区域可以考虑tab插件,操作起来比较便捷
wz1134 发表于 2023-11-19 10:56
可以抄一下作业么,我按范例改的只显示第一页,后面都不显示了
terran 发表于 2023-12-26 20:38
自动生成cards的耗材管理 请问这个是用什么做的?
欢迎光临 『瀚思彼岸』» 智能家居技术论坛 (https://bbs.hassbian.com/) | Powered by Discuz! X3.5 |