嘿,

我创建了一张新卡,如果您使用多次使用具有小差异的多次卡(例如实体),请帮助您将LL Config的内容进行帮助。

访问GitHub.对于安装说明,最新的文档和故障排除指南www.19463331.com

GitHub释放GitHub活动custom_updater.项目维护


整理卡

这张卡是为了leavelace.19463331伟德国际

我们都多次使用相同的配置块在我们的lovelace配置中,我们不希望改变相同的东西在100个地方,每次我们想要修改一些东西。

邓静网卡救援!!此卡允许您在Lovelace配置中多次重复使用相同的配置,以避免重复并支持变量和默认值。

配置

定义你的模板

首先,您需要定义模板。

这些模板定义在你的lovelace配置的根目录中的一个对象中。该对象需要命名Decluttering_templates.

此对象需要包含您的模板声明,每个模板都有一个名称,可以包含变量。需要在双方括号中括起来[[变量名]]。当您实例化使用此模板的卡片时,它将被实际值所取代。如果一个变量是单独的,用单引号括起来:'[[变量名]]'

您还可以为变量定义默认值默认对象。

declutting_templates:默认值:#这是可选的 -  <变量_name>:<变量_value>  -  <变量_name>:<变量_value> [...]卡:##这是您放置卡配置的地方(它可以是卡嵌入的地方其他卡)类型:自定义:My-Super-Card [...]

在你的例子lovelace-ui.yaml.

资源: -  URL:/local/Decluttering-Card.js类型:模块Dectuttering_templates:my_first_template:#这是模板默认的名称: - 图标:消防卡:类型:自定义:按钮卡名称:'[[名称]]'图标:'MDI:[[图标]]'my_second_template:#这是另一个模板卡的名称:类型:自定义:垂直堆栈卡片: - 类型:横叠卡: - 类型:自定义:按钮卡实体:'[[entity_1]]'' - 类型:自定义:按钮卡实体:'[[entity_2]]'

使用卡

名称 类型 要求 描述
类型 细绳 要求 自定义:decluttering-card
模板 目的 要求 要使用的模板Decluttering_templates.
变量 列表 可选的 变量列表及其替换的值模板

引用上一个模板的示例:

- 类型:定制:Calting-Class模板: -  yex-first_template变量: - 名称:测试按钮 - 图标:arrow-up  - 类型:custom:deptuting-card close:my_first_template变量: - 名称:默认图标按钮 - 类型:习惯:习惯 -卡模板:my_second_template变量: -  entity_1:switch.my_switch  -  entity_2:light.my_light
28喜欢

谢谢@romrider.:+1:
这正是我在我没有运气尝试使用之后我正在寻找的事情!包括在Lovelace UI编辑器中。

2喜欢

我肯定会使用这个。

1像

我在我的配置中使用该卡的一个示例(我有8个封面):
图像

每个封面实际上由5个元素组成自定义:垂直堆栈卡

  • 3.自定义:button-card在上面(每个人都有一个按钮卡与之相关的特定模板,这是按钮卡本身的一个特征)
  • 1自定义:slider-entity-row在中间相关联习惯:卡片·莫德
  • 1自定义:button-card在底部

UI-Lovelace.yaml.

Cover_Button:类型:自定义:垂直堆栈卡片: - 类型:水平堆叠卡: - 类型:自定义:按钮卡大小:'[[大小]]'实体:'[[实体]]'模板:cover_up  - 类型:自定义:按钮卡尺寸:'[[大小]]'实体:'[[实体]]'模板:cover_stop  - 类型:自定义:按钮卡大小:'[[size]]'实体:'[[实体]]'模板:cover_down  - 类型:自定义:card-modder extra_styles:> .card-content {padding:0px 0px}卡:类型:实体实体: - 类型:自定义:滑块实体行实体:'[[实体]]''full_row:true hide_state:true  - 类型:自定义:按钮卡名称:'[[name]]'模板:cover_name

使用这样的:

—type:水平堆叠卡:—type:自定义:declutter- card模板:cover_button变量:—size: 80%—entity: cover。cover_1 - name: Window 1 - type: custom: declutter- card template: cover_button variables: - size: 80% - entity: cover。cover_2 - name: Window 2 - type: custom: declutter- card template: cover_button variables: - size: 80% - entity: cover。cover_3 - name:窗口3
2喜欢

在真实理解其目的之前,我必须坐下来真正处理这张卡的影响。主席先生,你是一个神秘。谢谢!

我发现了新的模板系统发现的有趣行为。看起来
自定义:按钮卡(具体color_type:空白卡)嵌套在水平堆栈内部不会呈现。这种情况发生在不使用按钮卡模板上。它只是必须color_type:空白卡

Calted Card(注意左侧和右侧的缺失间距和边界半径。)

非整理卡

这是相应的yaml

按钮卡模板

button_card_templates:垂直分配器 - 灰色:color_type:空白卡样式:卡: - 宽度:3px  - 颜色:'#292929'水平分割器 - 灰色:color_type:空白卡式:卡: - 高度:3px  - 背景 - 背景 - 背景 - 背景 - 背景颜色:'#292929'

地形卡模板

decluttering_templates: #按钮模板用于在浪子custom_dimmer_card_template:类型:自定义:vertical-stack-in-card卡片:-类型:自定义:button-card模板:horizontal-divider-grey -类型:水平叠加卡:-类型:自定义:button-card #模板:vertical-divider-grey color_type:空白卡样式:名片:宽度:3 px -颜色:“# 292929”——类型:自定义:button-card模板:vertical-divider-grey -类型:自定义:button-card模板:dimmer-left-button-settings实体:[[机构]]的名字:“[[名字]]”——类型:自定义:card-modder风格:background - color: # 222222的border - radius: 0 px 10 px 10 px 0 px高度:39 px填充:8 px卡:类型:full_row: true - type: Custom:button-card template: vertical-divider-grey - type: Custom:button-card template: vertical-divider-grey - type: Custom:button-card template: horizontal-divider-grey . full_row: true - type: Custom:button-card template: vertical-divider-grey - type: Custom:button-card template: horizontal-divider-grey

Calted Card申报

- 类型:自定义:Contruting-Card模板:custom_dimmer_card_template变量: - 实体:light.kitchen_dimmer  - 名称:厨房

原始,非陈列化卡声明

- 类型:定制:垂直堆叠卡片: - 类型:自定义:按钮卡模板:卧式 - 分灰灰色 - 类型:水平堆叠卡: - 类型:自定义:按钮卡模板:垂直分压器-GREY  - 类型:自定义:按钮卡模板:垂直分割器 - 灰色 - 类型:自定义:按钮卡模板:DIMMER-左键 - 设置实体:Light.Kitchen_Dimmer名称:厨房 - 类型:自定义:Card Carch-Moder款式:背景颜色:'#222222'边界半径:0px 10px 10px 0px高度:39px填充:8px卡:键入:scient:slider-entity-low实体:light.kitchen_dimmer步骤:2 full_row:true  - 类型:自定义:按钮卡模板:垂直分型灰色 - 类型:自定义:按钮卡模板:垂直分频 - 灰色 - 类型:自定义:纽扣卡模板:横向分压器 - 灰色
3喜欢

我会看一下,但我不明白水平分隔的目的?默认情况下,纸牌之间有4px的边距。

Also I don’t understand how you managed to have the initial render with this config, as the border radius are those from the vertical-stack-in-card but they display around the horizontal-stack embedded inside (that is unexpected), excluding the “spacers” on the left and on the right.

我认为它只是需要一些重构:脸红:

编辑:如果使用Lovelace的刷新按钮(右上角),则布局会更改吗?

我应该澄清的是,为了控制卡片之间的间隔,我将按钮包含在卡片的垂直堆叠中。这就是我如何实现两个按钮看起来像一个按钮的效果。当然,使用垂直的卡片堆叠也意味着我必须明确地创建自己的间隔,因此使用自定义的空白卡片特性的水平和垂直分隔符:按钮卡片。

编辑:否,内置刷新按钮无效。既不清除缓存。

好的,我明白了,这增加了一些复杂性。我在垂直堆叠卡中嵌入了垂直堆栈卡片的问题。
我会尽快看看你提供的东西。

我正在本地存储您的卡。

我是否使用custom_updater跟踪卡片版本和:
https://raw.githubusercontent.com/custom-cards/decluttutting-card/master/package-lock.json.

https://raw.githubusercontent.com/custom-cards/decluttering-card/master/package.json

请指教。

您不必为自定义更新程序添加任何内容。它将是自动的。

1像

哦我的上帝!这对我们是多么大的帮助啊!!
很多谢谢! !:+1:
只有6行而不是60行/按钮!!!

1像

我的Lovelace图片为地板植物这么长。

—type:镜像元素。—type:镜像实体。Sofa_light hold_action: none state_image: 'on': /local/sofa.png?V =1 style: left: 0% top: 0% transform: none tap_action: none- type: image entity: switch.tv_light hold_action: none state_image: 'on': /local/tv.png?v=1 style: left: 0% top: 0% transform: none tap_action: none

和模板

state_image: 'on': '/local/ " [[name]] " .png?V =1' style: left: 0% top: 0% transform: none tap_action: none type: image

我如何能减少我的爱ace代码?

查看第一篇文章中的示例,模板必须是卡,具有变量,然后在使用卡时,您可以分配变量。
你的模板不是一张卡片,是一种奇怪的东西。

decluttering_templates:image_on类型:图像实体:'[[实体]]'hold_action:none':'上':'/local/[name]].png?v=1'样式:left:0%top:0%变换:无Tap_Action:无

然后你这样用它:

- 类型:图像元素: - 类型:自定义:Depluttering-Card模板:Image_On变量: - 实体:Switch.sofa_light  - 名称:SOFA  - 类型:Custom:Depluting-Card模板:Image_on [...]

我不确定这作品(在图像卡内嵌入了一个整理卡),但值得尝试。:least_smile:

1像

你是个传奇,这太棒了!我一直在寻找这样的东西现在,它似乎是完美的工作到目前为止。:拍:

1像

有谁找到了一种方法来合并标签模板内清理卡?我特别希望使用:

label_template:> var bri =状态[[[实体]]']。属性.Brightness;返回'亮度:'+(bri?bri:'0')+'%';

实体从卡片声明中传递回来。我试着使用:

homekit_dimmer_card: type: custom:button-card template: homekit_dimmer label_template: > var bri = states['[[entity]]'].attributes.亮度;返回'亮度:'+(bri?bri:'0')+'%';

但这并不起。

使用按钮卡模板为此,无需使用此,然后通过按钮卡实体字段中的实体(实体:'[[实体]]')。你也可以使用entity.attributes.brightness代替状态[...]...在按钮卡中,实体是具有实体状态对象的变量:

label_template:> var bri = entity.Attributes.Brightness;返回'亮度:'+(bri?bri:'0')+'%';

把事情简单化:sife_smiling_face:

1像

谢谢!:杯:@romrider.:TADA:我一直在做一个巨大的.yaml.减少,这是:炸弹:时间恰好:Raize_Hands:

1像

你好@romrider.

我发现模板按钮卡的间隔有些奇怪。什么好主意吗?我基本上想让所有的按钮卡左对齐在堆栈中,但他们是均匀的间距与整理卡。

我在垂直堆栈中有多个水平堆栈。
我的标准卡片是这样的:
图像

但是当我用树荫卡重新创建它们时,我得到这个:(底行是标准配置,顶部是整理卡)
图像

配置按钮:

- 卡片: - 类型:'习惯:Decruttering-Card'模板:Light_Button_with_Brightness变量: - 实体:Light.stairwell_lights_81  - 名称:stairwell  - 图标:楼梯 - 类型:'custom:decruting-card'模板:light_button变量: - 实体: - 实体: - 实体:light.hobb_led_153  - 名称:Hobb LED  - 图标:LED-Strip  - 类型:'Custom:Deptuttering-Card'模板:Light_Button变量: - 实体:Light.bench_pendants_236  - 名称:BENCH  - 图标:天花灯 - 类型:'定制:Deptuttering-Card'模板:Light_Button_with_Brightness变量: - 实体:Light.Kitchen_lights_79  - 名称:厨房 - 图标:灯泡类型:横梁堆栈

我的一个模板:

decluttering_templates: light_button_with_亮度:entity: '[entity]]' icon: 'mdi:[[icon]]' name: '[[name]]' type: 'custom:button-card'亮度/ 2.55);返回(bri ?Bri:‘0’)+‘%’;show_name:真实状态:-风格:名片:-不必:0 px 0 px 10 px 3 px var(——paper-item-icon-active-color)图标:-颜色:var(——paper-item-icon-active-color)价值:”的风格:名片:- border - radius: 15 px -高度:76 px -宽度:76 px -保证金:5 px 5 px 0 px 0 px -填充:0 px 0 px -“——paper-card-background-color”:“rgba(40、40、40岁,0.5)的网格:- grid-template-rows: 42 px汽车0 px - grid-template-columns: 42 px汽车图标:宽度:30 px -颜色:白色标签:-字体大小:12 px -粗细:大胆,颜色:白色名称:- justify-self:开始- align-self:结束-填充:9 px 10 px -字体大小:12 px -粗细:大胆,颜色:白色

很像@Petro.他使用的锚,这张卡将使我的生活如此容易,一旦我解决了间距问题。5条YAML每颗纽扣,而不是46条纯金!!考虑到我有大约200个按钮,我的配置已经疯狂了。我会走锚路线,除了我没有使用YAML模式的Lovelace,所以这张卡是完美的。谢谢@romrider.