零.前期准备

一.HACS安装相关插件

image.png

  • card-mod
  • lovelace-layout-card
  • hui-element
  • button-card
  • mushroom
  • config-template-card
  • FontAwesome (in HACS integrations, not frontend) (在HACS安装完以后, 你需要去把它加入集成)
  • custom-ui
  • tabbed-card (only if using my NodeRed version)

修改config目录下的configuration.yaml

不同的部署方式参考原项目:thomasloven/lovelace-card-mod
在configuration.yaml最下方添加引入card-mod.js,下面我的配置(以docker方式部署的ha)

1
2
3
frontend:
extra_module_url:
- /local/community/lovelace-card-mod/card-mod.js

二.上传资源文件

下载资源文件:静态媒体文件
也可以去群文件下载
解压后将两个文件夹上传到config目录
image.png

三.编辑仪表盘

1.选择管理仪表盘

image.png

2.新增仪表盘

image.png
image.png

3.编辑仪表盘

点击角落的编辑,选择原始配置编辑器
image.png

4.下面是我的配置文件,供大家参考

想要自定义的可以参考,此项目,或自行修改:Bambulab Home Assistant Dashboards (wolfwithsword.com)
如果你是A1的机器将配置文件中,a1_实体id全部替换为你真实的设备id格式为a1_123456789.
其中温湿度展示这里使用的是米家的温湿度传感器,如果你也有这个传感器 可以自行修改,这里的实体id分别为:sensor.miaomiaoce_t2_94b1_relative_humidity,sensor.miaomiaoce_t2_94b1_temperature_humidity_sensor

以下为我的页面配置文件

下载地址:配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
views:
- title: Home
icon: mdi:printer-3d-nozzle
type: custom:layout-card
layout_type: custom:horizontal-layout
layout:
max_cols: 3
cards:
- type: vertical-stack
cards:
- type: picture-elements
elements:
- type: custom:config-template-card
entities:
- light.ap_ams_1tong_dao_hao_cai_zhi_shi_deng
element:
type: state-icon
entity: light.ap_ams_1tong_dao_hao_cai_zhi_shi_deng
style:
top: 46%
left: 22.4%
text-align: center
font-size: 69em
background-color: var(--tray_1_color)
opacity: 90%
box-shadow: 0 0 3px 3px rgba(0,155,0,0.3)
border-radius: 2px
width: 8%
height: 40%
- type: custom:config-template-card
entities:
- sensor.ap_ams_1tong_dao_zhuang_tai
element:
type: state-icon
entity: sensor.ap_ams_1tong_dao_zhuang_tai
icon: mdi:numeric-1-circle
style:
top: 48%
left: 22.4%
'--paper-item-icon-color': white
background-color: rgba(0,0,0,0.5)
box-shadow: 1 1 1px 1px var(--tray_1_bg)
border-radius: 50px
'--mdc-icon-size': 2em
pointer-events: none
- type: state-label
entity: sensor.ap_ams_2tong_dao_zhuang_tai
tap_action:
action: none
style:
top: 10%
left: 22.5%
text-align: center
font-size: 0.6em
background-color: rgba(0,0,0,0.4)
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.4)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: state-label
entity: text.ap_ams_1tong_dao_hao_cai_lei_xing
tap_action:
action: none
style:
top: 80%
left: 22%
text-align: center
font-size: 1em
background-color: rgba(0,0,0,0.4)
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: state-label
entity: text.ap_ams_1tong_dao_hao_cai_wen_du
tap_action:
action: none
style:
top: 86%
left: 22%
text-align: center
font-size: 0.8em
background-color: rgba(0,0,0,0.1)
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: custom:config-template-card
entities:
- light.ap_ams_2tong_dao_hao_cai_zhi_shi_deng
element:
type: state-icon
entity: light.ap_ams_2tong_dao_hao_cai_zhi_shi_deng
style:
top: 46%
left: 40.1%
text-align: center
font-size: 69em
background-color: var(--tray_2_color)
opacity: 90%
box-shadow: 0 0 3px 3px rgba(0,155,0,0.3)
border-radius: 2px
width: 8%
height: 40%
- type: custom:config-template-card
entities:
- sensor.ap_ams_2tong_dao_ben_ji_tong_dao
element:
type: state-icon
entity: sensor.ap_ams_2tong_dao_ben_ji_tong_dao
icon: mdi:numeric-2-circle
style:
top: 48%
left: 40.1%
'--paper-item-icon-color': white
background-color: rgba(0,0,0,0.5)
box-shadow: 1 1 1px 1px var(--tray_1_bg)
border-radius: 50px
'--mdc-icon-size': 2em
pointer-events: none
- type: state-label
entity: sensor.ap_ams_2tong_dao_zhuang_tai
tap_action:
action: none
style:
top: 10%
left: 40.5%
text-align: center
font-size: 0.6em
background-color: rgba(0,0,0,0.4)
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.4)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: state-label
entity: text.ap_ams_2tong_dao_hao_cai_lei_xing
tap_action:
action: none
style:
top: 80%
left: 40%
text-align: center
font-size: 1em
background-color: rgba(0,0,0,0.4)
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: state-label
entity: text.ap_ams_2tong_dao_hao_cai_wen_du
tap_action:
action: none
style:
top: 86%
left: 40%
text-align: center
font-size: 0.8em
background-color: rgba(0,0,0,0.1)
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: custom:config-template-card
entities:
- light.ap_ams_3tong_dao_hao_cai_zhi_shi_deng
element:
type: state-icon
entity: light.ap_ams_3tong_dao_hao_cai_zhi_shi_deng
style:
top: 46%
left: 57.9%
text-align: center
font-size: 69em
background-color: var(--tray_3_color)
opacity: 90%
box-shadow: 0 0 3px 3px rgba(0,155,0,0.3)
border-radius: 2px
width: 8%
height: 40%
- type: custom:config-template-card
entities:
- sensor.ap_ams_3tong_dao_ben_ji_tong_dao
element:
type: state-icon
entity: sensor.ap_ams_3tong_dao_ben_ji_tong_dao
icon: mdi:numeric-3-circle
style:
top: 48%
left: 58.1%
'--paper-item-icon-color': white
background-color: rgba(0,0,0,0.5)
box-shadow: 1 1 1px 1px var(--tray_1_bg)
border-radius: 50px
'--mdc-icon-size': 2em
pointer-events: none
- type: state-label
entity: sensor.ap_ams_3tong_dao_zhuang_tai
tap_action:
action: none
style:
top: 10%
left: 58%
text-align: center
font-size: 0.6em
background-color: rgba(0,0,0,0.4)
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.4)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: state-label
entity: text.ap_ams_3tong_dao_hao_cai_lei_xing
tap_action:
action: none
style:
top: 80%
left: 58%
text-align: center
font-size: 1em
background-color: rgba(0,0,0,0.4)
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: state-label
entity: text.ap_ams_3tong_dao_hao_cai_wen_du
tap_action:
action: none
style:
top: 86%
left: 58%
text-align: center
font-size: 0.8em
background-color: rgba(0,0,0,0.1)
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: custom:config-template-card
entities:
- light.ap_ams_4tong_dao_hao_cai_zhi_shi_deng
element:
type: state-icon
entity: light.ap_ams_4tong_dao_hao_cai_zhi_shi_deng
style:
top: 46%
left: 75.7%
text-align: center
font-size: 69em
background-color: var(--tray_4_color)
opacity: 90%
box-shadow: 0 0 3px 3px rgba(0,155,0,0.3)
border-radius: 2px
width: 8%
height: 40%
- type: custom:config-template-card
entities:
- sensor.ap_ams_4tong_dao_ben_ji_tong_dao
element:
type: state-icon
entity: sensor.ap_ams_4tong_dao_ben_ji_tong_dao
icon: mdi:numeric-3-circle
style:
top: 48%
left: 75.5%
'--paper-item-icon-color': white
background-color: rgba(0,0,0,0.5)
box-shadow: 1 1 1px 1px var(--tray_1_bg)
border-radius: 50px
'--mdc-icon-size': 2em
pointer-events: none
- type: state-label
entity: sensor.ap_ams_4tong_dao_zhuang_tai
tap_action:
action: none
style:
top: 10%
left: 75.5%
text-align: center
font-size: 0.6em
background-color: rgba(0,0,0,0.4)
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.4)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: state-label
entity: text.ap_ams_4tong_dao_hao_cai_lei_xing
tap_action:
action: none
style:
top: 80%
left: 75.5%
text-align: center
font-size: 1em
background-color: rgba(0,0,0,0.4)
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.4)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: state-label
entity: text.ap_ams_4tong_dao_hao_cai_wen_du
tap_action:
action: none
style:
top: 86%
left: 75.5%
text-align: center
font-size: 0.8em
background-color: rgba(0,0,0,0.1)
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0)
border-radius: 50px
pointer-events: none
color: '#FFFFFF'
- type: conditional
conditions:
- entity: sensor.miaomiaoce_t2_94b1_temperature_humidity_sensor
state_not: offline
elements:
- type: conditional
conditions:
- entity: sensor.miaomiaoce_t2_94b1_temperature_humidity_sensor
state_not:
- unavailable
- unknown
elements:
- entity: sensor.miaomiaoce_t2_94b1_temperature_humidity_sensor
attribute: temperature-2-1
type: state-badge
style:
top: 50.75%
left: 8%
font-size: 0.75em
color: rgba(0,0,0,0)
- type: custom:config-template-card
entities:
- sensor.miaomiaoce_t2_94b1_relative_humidity
element:
type: state-icon
entity: sensor.miaomiaoce_t2_94b1_relative_humidity
icon: |-
${'fapro:humidity-level-dark-' + (function() {
var humidity = states['sensor.miaomiaoce_t2_94b1_relative_humidity'].attributes['relative_humidity-2-2'];
if (humidity >= 10 && humidity < 20) {
return 1;
} else if (humidity >= 20 && humidity < 30) {
return 2;
} else if (humidity >= 30 && humidity < 40) {
return 3;
} else if (humidity >= 40 && humidity < 50) {
return 4;
} else {
return 5;
}
})() + '#fullcolor'}
style:
top: 38.5%
left: 92.5%
background-color: '#1c1c1c'
border-radius: 50px
border: 0.12em solid var(--humidity-border-color)
'--mdc-icon-size': 2.05em
image: /local/media/bambuprinter/AP_AMS.png
card_mod:
style: |
ha-card {
background: none !important;
border: none !important;
box-shadow: none !important;sensor.miaomiaoce_t2_94b1_relative_humidity;
--tray_1_color: {% if is_state_attr('light.ap_ams_1tong_dao_hao_cai_zhi_shi_deng', 'rgb_color', [0, 0, 0]) %} rgb(255, 255, 255); {% else %} rgb({{ state_attr('light.ap_ams_1tong_dao_hao_cai_zhi_shi_deng', 'rgb_color')[0] }}, {{ state_attr('light.ap_ams_1tong_dao_hao_cai_zhi_shi_deng', 'rgb_color')[1] }}, {{ state_attr('light.ap_ams_1tong_dao_hao_cai_zhi_shi_deng', 'rgb_color')[2] }});{% endif %}
--tray_2_color: {% if is_state_attr('light.ap_ams_2tong_dao_hao_cai_zhi_shi_deng', 'rgb_color', [0, 0, 0]) %} rgb(255, 255, 255); {% else %} rgb({{ state_attr('light.ap_ams_2tong_dao_hao_cai_zhi_shi_deng', 'rgb_color')[0] }}, {{ state_attr('light.ap_ams_2tong_dao_hao_cai_zhi_shi_deng', 'rgb_color')[1] }}, {{ state_attr('light.ap_ams_2tong_dao_hao_cai_zhi_shi_deng', 'rgb_color')[2] }});{% endif %}
--tray_3_color: {% if is_state_attr('light.ap_ams_3tong_dao_hao_cai_zhi_shi_deng', 'rgb_color', [0, 0, 0]) %} rgb(255, 255, 255); {% else %} rgb({{ state_attr('light.ap_ams_3tong_dao_hao_cai_zhi_shi_deng', 'rgb_color')[0] }}, {{ state_attr('light.ap_ams_3tong_dao_hao_cai_zhi_shi_deng', 'rgb_color')[1] }}, {{ state_attr('light.ap_ams_3tong_dao_hao_cai_zhi_shi_deng', 'rgb_color')[2] }});{% endif %}
--tray_4_color:
--tray_1_bg: rgba(255,255,0,0.5);
--tray_2_bg: {% if is_state_attr('sensor.ap_ams_tray_2', 'active', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
--tray_3_bg: {% if is_state_attr('sensor.ap_ams_tray_3', 'active', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
--tray_4_bg: {% if is_state_attr('sensor.ap_ams_tray_4', 'active', true) %} rgba(255, 255, 126, 0.5); {% else %} rgba(0,0,0,0.5); {% endif %}
}
- type: picture-elements
elements:
- type: conditional
conditions:
- entity: sensor.a1_实体id_print_status
state_not: offline
elements:
- entity: light.a1_实体id_chamber_light
type: state-icon
style:
top: 45%
left: 89%
'--mdc-icon-size': 2.6em
tap_action:
action: toggle
- entity: sensor.a1_实体id_print_status
type: state-label
style:
top: 82.5%
left: 78.8%
font-size: 0.75em
color: '#FFFFFF'
- type: conditional
conditions:
- entity: sensor.a1_实体id_print_status
state:
- running
- pause
elements:
- type: conditional
conditions:
- entity: image.a1_实体id_cover_image
state_not: unavailable
elements:
- type: custom:hui-element
card_type: picture-entity
show_name: false
show_state: false
entity: image.a1_实体id_cover_image
style:
top: 61.5%
left: 47%
transform: translate(-45%, -40%) scale(75%, 75%)
'--ha-card-border-width': 0px
'--ha-card-background': none
- entity: sensor.a1_实体id_print_progress
type: state-badge
tap_action:
action: none
style:
top: 18.5%
left: 74%
font-size: 1em
color: rgba(0,0,0,0)
'--label-badge-red': '#11739D'
- entity: sensor.a1_实体id_nozzle_temperature
type: state-badge
style:
top: 35%
left: 46.5%
font-size: 0.8em
color: rgba(0,0,0,0)
- entity: sensor.a1_实体id_bed_temperature
type: state-badge
style:
top: 95%
left: 46.5%
font-size: 0.8em
color: rgba(0,0,0,0)
card_mod:
style: |
ha-card {
background: none !important;
border: none !important;
box-shadow: none !important;
}
image: /local/media/bambuprinter/a1_lightoff.png
entity: light.a1_实体id_chamber_light
state_image:
unavailable: /local/media/bambuprinter/a1_lightoff.png
'on': /local/media/bambuprinter/a1_lighton.png
'off': /local/media/bambuprinter/a1_lightoff.png
- type: vertical-stack
cards:
- type: custom:button-card
entity: switch.detail
name: Detail
icon: mdi:printer-3d
show_icon: true
show_state: false
layout: icon_name
tap_action:
action: |
[[[
if (entity) return 'toggle';
else return 'none';
]]]
confirmation:
text: Toggle Printer Power?
state:
- value: 'on'
icon: mdi:power
color: green
- value: 'off'
icon: mdi:power
color: grey
styles:
grid:
- grid-template-columns: |
[[[
if (entity) return '20% 1fr 20%';
else return '20% 1fr 20%';
]]]
icon:
- width: |
[[[
if (entity) return '65px';
else return '0px';
]]]
- padding-left: 20px
name:
- text-wrap: balance
- font-size: 1.4em
card_mod:
style: |
ha-card {
background: rgba(0,0,0,0);
border: none;
box-shadow: none !important;
}
- type: custom:gap-card
height: 5
- type: custom:hui-element
card_type: horizontal-stack
cards:
- type: custom:hui-element
card_type: button
entity: select.a1_实体id_printing_speed
name: 安静
icon: mdi:speedometer-slow
tap_action:
action: call-service
service: select.select_option
data:
option: silent
target:
entity_id: select.a1_实体id_printing_speed
card_mod:
style: |
ha-card {
box-shadow: none !important;
background-color: rgba(0,0,0,0);
border: none;
--pbs-button-color: {% if is_state('select.a1_实体id_printing_speed', 'Silent') or is_state('select.a1_实体id_printing_speed', 'silent') %} yellow; {% else %} grey; {% endif %}
--paper-item-icon-color: {% if is_state('select.a1_实体id_printing_speed', 'Silent') or is_state('select.a1_实体id_printing_speed', 'silent') %} yellow; {% else %} grey; {% endif %}
}
- type: custom:hui-element
card_type: button
entity: select.a1_实体id_printing_speed
name: 标准
icon: mdi:speedometer-medium
tap_action:
action: call-service
service: select.select_option
data:
option: standard
target:
entity_id: select.a1_实体id_printing_speed
card_mod:
style: |
ha-card {
box-shadow: none !important;
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('select.a1_实体id_printing_speed', 'Standard') or is_state('select.a1_实体id_printing_speed', 'standard') %} yellow; {% else %} grey; {% endif %}
}
- type: custom:hui-element
card_type: button
entity: select.a1_实体id_printing_speed
name: 运动
icon: mdi:speedometer
tap_action:
action: call-service
service: select.select_option
data:
option: sport
target:
entity_id: select.a1_实体id_printing_speed
card_mod:
style: |
ha-card {
box-shadow: none !important;
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('select.a1_实体id_printing_speed', 'Sport') or is_state('select.a1_实体id_printing_speed', 'sport') %} yellow; {% else %} grey; {% endif %}
}
- type: custom:hui-element
card_type: button
entity: select.a1_实体id_printing_speed
name: 狂暴
icon: mdi:speedometer
tap_action:
action: call-service
service: select.select_option
data:
option: ludicrous
target:
entity_id: select.a1_实体id_printing_speed
card_mod:
style: |
ha-card {
box-shadow: none !important;
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('select.a1_实体id_printing_speed', 'Ludicrous') or is_state('select.a1_实体id_printing_speed', 'ludicrous') %} yellow; {% else %} grey; {% endif %}
}
- type: vertical-stack
cards:
- type: custom:mushroom-title-card
title: ''
subtitle: Print Details
alignment: center
- type: custom:mushroom-entity-card
entity: sensor.a1_实体id_task_name
name: Task
icon: mdi:clipboard-text
- type: horizontal-stack
cards:
- type: custom:mushroom-entity-card
entity: sensor.a1_实体id_print_progress
name: Progress
icon: mdi:progress-helper
- type: custom:mushroom-template-card
primary: Layer
icon_color: var(--rgb-state-entity)
secondary: >-
{{states('sensor.a1_实体id_current_layer')}} /
{{states('sensor.a1_实体id_total_layer_count')}}
icon: mdi:layers
- type: custom:tabbed-card
options: {}
tabs:
- card:
type: vertical-stack
cards:
- type: entities
entities:
- entity: sensor.a1_实体id_current_stage
name: Stage
- entity: binary_sensor.a1_实体id_hms_errors
name: HMS Notifications
- entity: sensor.a1_实体id_start_time
name: Start Time
secondary_info: last-changed
- entity: sensor.a1_实体id_end_time
name: End Time
- entity: sensor.a1_实体id_remaining_time
name: Remaining Time
- entity: binary_sensor.a1_实体id_firmware_update
name: Firmware
attributes:
label: Details
- type: custom:gap-card
height: 5
- type: custom:hui-element
card_type: vertical-stack
cards:
- type: custom:button-card
variables:
pause_entity: button.a1_实体id_pause_printing
start_entity: button.a1_实体id_resume_printing
entity: sensor.a1_实体id_print_status
name: >
[[[ if (entity.state.toUpperCase() == 'RUNNING') return
"Pause";
else if (entity.state.toUpperCase() == 'PAUSE') return "Resume";
else return ''; ]]]
state:
- value: RUNNING
icon: mdi:pause
color: orange
- value: running
icon: mdi:pause
color: orange
- value: PAUSE
icon: mdi:play
color: orange
- value: pause
icon: mdi:play
color: orange
- value: OFFLINE
icon: mdi:void
color: grey
- value: offline
icon: mdi:void
color: grey
- value: IDLE
icon: mdi:void
color: grey
- value: idle
icon: mdi:void
color: grey
- value: FAILED
icon: mdi:void
color: grey
- value: failed
icon: mdi:void
color: grey
- value: FINISH
icon: mdi:void
color: grey
- value: finish
icon: mdi:void
color: grey
- value: PREPARE
icon: mdi:void
color: grey
- value: prepare
icon: mdi:void
color: grey
tap_action:
action: >
[[[ if (entity.state.toUpperCase() == 'RUNNING' ||
entity.state.toUpperCase() == 'PAUSE') return
"call-service";

else return "none";

]]]
service: button.press
service_data:
entity_id: >
[[[ if
(states['sensor.a1_实体id_print_status'].state.toUpperCase()
== 'RUNNING')
return variables.pause_entity;
if (states['sensor.a1_实体id_print_status'].state.toUpperCase() == 'PAUSE')
return variables.start_entity;
else return "";
]]]
card_mod:
style: |
ha-card {
box-shadow: none !important;
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('sensor.a1_实体id_print_status', 'RUNNING') or is_state('sensor.a1_实体id_print_status', 'PAUSE') or is_state('sensor.a1_实体id_print_status', 'running') or is_state('sensor.a1_实体id_print_status', 'pause') %} orange; {% else %} grey; {% endif %}
}
- type: custom:gap-card
- type: custom:button-card
entity: sensor.a1_实体id_print_status
name: >
[[[ if (entity.state.toUpperCase() == 'RUNNING') return
"Cancel";
else if (entity.state.toUpperCase() =='PAUSE') return "Cancel";
else return ''; ]]]
confirmation:
text: Cancel Print?
state:
- value: RUNNING
icon: mdi:cancel
color: red
- value: running
icon: mdi:cancel
color: red
- value: PAUSE
icon: mdi:cancel
color: red
- value: pause
icon: mdi:cancel
color: red
- value: OFFLINE
icon: mdi:void
color: grey
- value: offline
icon: mdi:void
color: grey
- value: IDLE
icon: mdi:void
color: grey
- value: idle
icon: mdi:void
color: grey
- value: FAILED
icon: mdi:void
color: grey
- value: failed
icon: mdi:void
color: grey
- value: FINISH
icon: mdi:void
color: grey
- value: finish
icon: mdi:void
color: grey
- value: PREPARE
icon: mdi:void
color: grey
- value: prepare
icon: mdi:void
color: grey
tap_action:
action: >
[[[ if (entity.state.toUpperCase() == 'RUNNING' ||
entity.state.toUpperCase() == 'PAUSE') return
"call-service"; else return "none"; ]]]
service: button.press
service_data:
entity_id: button.a1_实体id_stop_printing
card_mod:
style: |
ha-card {
box-shadow: none !important;
background-color: rgba(0,0,0,0);
border: none;
--paper-item-icon-color: {% if is_state('sensor.a1_实体id_print_status', 'RUNNING') or is_state('sensor.a1_实体id_print_status', 'PAUSE') or is_state('sensor.a1_实体id_print_status', 'running') or is_state('sensor.a1_实体id_print_status', 'pause') %} red; {% else %} grey; {% endif %}
}