『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
楼主: 消逝

[UI界面] HA彩平图UI分享(2024-11-17阶段性更新)-保姆级教程!

  [复制链接]

10

主题

70

帖子

1593

积分

论坛UI达人

积分
1593
金钱
1513
HASS币
28
 楼主| 发表于 2024-8-9 22:41:23 | 显示全部楼层
本帖最后由 消逝 于 2024-8-9 22:43 编辑

18、右边动作调修改对应实体就行了
          - type: image
            info: '************************    右边状态栏    ************************'
          - type: custom:button-card
            styles:
              grid:
                - grid-template-areas: |
                    "bar1" "bar2" "bar3" "bar4" "bar5" "bar6"
                - grid-template-columns: 60px
                - grid-template-rows: 80px 80px 80px 80px 80px 80px
              card:
                - '--mdc-ripple-press-opacity': 0
                - width: 60px
                - height: 480px
            style:
              left: 970px
              top: 460px
            custom_fields:
              bar1:
                card:
                  type: custom:button-card
                  entity: sensor.fullroom_climate_num
                  tap_action:
                    action: more-info
                  show_icon: true
                  show_name: true
                  icon: mdi:air-conditioner
                  name: 空调
                  custom_fields:
                    num: |
                      [[[ return states['sensor.fullroom_climate_num'].state;]]]
                  styles:
                    custom_fields:
                      num:
                        - background: >
                            [[[ var num
                            =states['sensor.fullroom_climate_num'].state;
                                if (num> 0) return 'DeepSkyBlue';
                                if (num==0) return 'transparent';   ]]]
                        - color: >
                            [[[ var num
                            =states['sensor.fullroom_climate_num'].state;
                                if (num> 0) return 'white';
                                if (num==0) return 'transparent';  ]]]
                        - padding: 1px 1px 0 1px
                        - font-size: 12px
                        - font-weight: bold
                        - width: 16px
                        - height: 16px
                        - border-radius: 100%
                        - position: absolute
                        - margin-left: 40px
                        - align-self: start
                    icon:
                      - padding: 5px 0 0 0
                      - color: >
                          [[[ var num
                          =states['sensor.fullroom_climate_num'].state;
                              if (num> 0) return 'DeepSkyBlue';
                              if (num==0) return 'white';  ]]]
                    name:
                      - padding: 0 0 5px 0
                      - font-size: 14px
                      - font-weight: bold
                    card:
                      - '--mdc-ripple-press-opacity': 0.1
                      - padding: 0 0 0 0
                      - width: 60px
                      - height: 65px
                      - border-radius: 10px
                      - background: >-
                          linear-gradient(180deg, transparent 0%,rgba(0,0,0,0.4)
                          50%)
              bar2:
                card:
                  type: custom:button-card
                  entity: sensor.fullroom_humidifier_num
                  tap_action:
                    action: more-info
                  show_icon: true
                  show_name: true
                  icon: mdi:air-humidifier
                  name: 加湿器
                  custom_fields:
                    num: >
                      [[[ return
                      states['sensor.fullroom_humidifier_num'].state;]]]
                  styles:
                    custom_fields:
                      num:
                        - background: >
                            [[[ var num
                            =states['sensor.fullroom_humidifier_num'].state;
                                if (num> 0) return 'DeepSkyBlue';
                                if (num==0) return 'transparent';   ]]]
                        - color: >
                            [[[ var num
                            =states['sensor.fullroom_humidifier_num'].state;
                                if (num> 0) return 'white';
                                if (num==0) return 'transparent';  ]]]
                        - padding: 1px 1px 0 1px
                        - font-size: 12px
                        - font-weight: bold
                        - width: 16px
                        - height: 16px
                        - border-radius: 100%
                        - position: absolute
                        - margin-left: 40px
                        - align-self: start
                    icon:
                      - padding: 5px 0 0 0
                      - color: >
                          [[[ var num
                          =states['sensor.fullroom_humidifier_num'].state;
                              if (num> 0) return 'DeepSkyBlue';
                              if (num==0) return 'white';  ]]]
                    name:
                      - padding: 0 0 5px 0
                      - font-size: 14px
                      - font-weight: bold
                    card:
                      - '--mdc-ripple-press-opacity': 0.1
                      - padding: 0 0 0 0
                      - width: 60px
                      - height: 65px
                      - border-radius: 10px
                      - background: >-
                          linear-gradient(180deg, transparent 0%,rgba(0,0,0,0.4)
                          50%)
              bar3:
                card:
                  type: custom:button-card
                  entity: sensor.fullroom_fan_num
                  tap_action:
                    action: more-info
                  show_icon: true
                  show_name: true
                  icon: mdi:air-purifier
                  name: 净化器
                  custom_fields:
                    num: |
                      [[[ return states['sensor.fullroom_fan_num'].state;]]]
                  styles:
                    custom_fields:
                      num:
                        - background: >
                            [[[ var num
                            =states['sensor.fullroom_fan_num'].state;
                                if (num> 0) return 'LimeGreen';
                                if (num==0) return 'transparent';   ]]]
                        - color: >
                            [[[ var num
                            =states['sensor.fullroom_fan_num'].state;
                                if (num> 0) return 'white';
                                if (num==0) return 'transparent';  ]]]
                        - padding: 1px 1px 0 1px
                        - font-size: 12px
                        - font-weight: bold
                        - width: 16px
                        - height: 16px
                        - border-radius: 100%
                        - position: absolute
                        - margin-left: 40px
                        - align-self: start
                    icon:
                      - padding: 5px 0 0 0
                      - color: |
                          [[[ var num =states['sensor.fullroom_fan_num'].state;
                              if (num> 0) return 'LimeGreen';
                              if (num==0) return 'white';  ]]]
                    name:
                      - padding: 0 0 5px 0
                      - font-size: 14px
                      - font-weight: bold
                    card:
                      - '--mdc-ripple-press-opacity': 0.1
                      - padding: 0 0 0 0
                      - width: 60px
                      - height: 65px
                      - border-radius: 10px
                      - background: >-
                          linear-gradient(180deg, transparent 0%,rgba(0,0,0,0.4)
                          50%)
              bar4:
                card:
                  type: custom:button-card
                  entity: sensor.fullroom_yuba_num
                  tap_action:
                    action: more-info
                  show_icon: true
                  show_name: true
                  icon: mdi:hvac
                  name: 浴霸
                  custom_fields:
                    num: |
                      [[[ return states['sensor.fullroom_yuba_num'].state;]]]
                  styles:
                    custom_fields:
                      num:
                        - background: >
                            [[[ var num
                            =states['sensor.fullroom_yuba_num'].state;
                                if (num> 0) return 'DarkOrange';
                                if (num==0) return 'transparent';   ]]]
                        - color: >
                            [[[ var num
                            =states['sensor.fullroom_yuba_num'].state;
                                if (num> 0) return 'white';
                                if (num==0) return 'transparent';  ]]]
                        - padding: 1px 1px 0 1px
                        - font-size: 12px
                        - font-weight: bold
                        - width: 16px
                        - height: 16px
                        - border-radius: 100%
                        - position: absolute
                        - margin-left: 40px
                        - align-self: start
                    icon:
                      - padding: 5px 0 0 0
                      - color: |
                          [[[ var num =states['sensor.fullroom_yuba_num'].state;
                              if (num> 0) return 'DarkOrange';
                              if (num==0) return 'white';  ]]]
                    name:
                      - padding: 0 0 5px 0
                      - font-size: 14px
                      - font-weight: bold
                    card:
                      - '--mdc-ripple-press-opacity': 0.1
                      - padding: 0 0 0 0
                      - width: 60px
                      - height: 65px
                      - border-radius: 10px
                      - background: >-
                          linear-gradient(180deg, transparent 0%,rgba(0,0,0,0.4)
                          50%)
              bar5:
                card:
                  type: custom:button-card
                  entity: sensor.fullroom_media_num
                  tap_action:
                    action: more-info
                  show_icon: true
                  show_name: true
                  icon: mdi:multimedia
                  name: 媒体
                  custom_fields:
                    num: |
                      [[[ return states['sensor.fullroom_media_num'].state;]]]
                  styles:
                    custom_fields:
                      num:
                        - background: >
                            [[[ var num
                            =states['sensor.fullroom_media_num'].state;
                                if (num> 0) return 'Magenta';
                                if (num==0) return 'transparent';   ]]]
                        - color: >
                            [[[ var num
                            =states['sensor.fullroom_media_num'].state;
                                if (num> 0) return 'white';
                                if (num==0) return 'transparent';  ]]]
                        - padding: 1px 1px 0 1px
                        - font-size: 12px
                        - font-weight: bold
                        - width: 16px
                        - height: 16px
                        - border-radius: 100%
                        - position: absolute
                        - margin-left: 40px
                        - align-self: start
                    icon:
                      - padding: 5px 0 0 0
                      - color: >
                          [[[ var num
                          =states['sensor.fullroom_media_num'].state;
                              if (num> 0) return 'Magenta';
                              if (num==0) return 'white';  ]]]
                    name:
                      - padding: 0 0 5px 0
                      - font-size: 14px
                      - font-weight: bold
                    card:
                      - '--mdc-ripple-press-opacity': 0.1
                      - padding: 0 0 0 0
                      - width: 60px
                      - height: 65px
                      - border-radius: 10px
                      - background: >-
                          linear-gradient(180deg, transparent 0%,rgba(0,0,0,0.4)
                          50%)
              bar6:
                card:
                  type: custom:button-card
                  entity: sensor.fullroom_other_num
                  tap_action:
                    action: more-info
                  show_icon: true
                  show_name: true
                  icon: mdi:tune-variant
                  name: 其他
                  custom_fields:
                    num: |
                      [[[ return states['sensor.fullroom_other_num'].state;]]]
                  styles:
                    custom_fields:
                      num:
                        - background: >
                            [[[ var num
                            =states['sensor.fullroom_other_num'].state;
                                if (num> 0) return 'OrangeRed';
                                if (num==0) return 'transparent';   ]]]
                        - color: >
                            [[[ var num
                            =states['sensor.fullroom_other_num'].state;
                                if (num> 0) return 'white';
                                if (num==0) return 'transparent';  ]]]
                        - padding: 1px 1px 0 1px
                        - font-size: 12px
                        - font-weight: bold
                        - width: 16px
                        - height: 16px
                        - border-radius: 100%
                        - position: absolute
                        - margin-left: 40px
                        - align-self: start
                    icon:
                      - padding: 5px 0 0 0
                      - color: >
                          [[[ var num
                          =states['sensor.fullroom_other_num'].state;
                              if (num> 0) return 'OrangeRed';
                              if (num==0) return 'white';  ]]]
                    name:
                      - padding: 0 0 5px 0
                      - font-size: 14px
                      - font-weight: bold
                    card:
                      - '--mdc-ripple-press-opacity': 0.1
                      - padding: 0 0 0 0
                      - width: 60px
                      - height: 65px
                      - border-radius: 10px
                      - background: >-
                          linear-gradient(180deg, transparent 0%,rgba(0,0,0,0.4)
                          50%)


回复

使用道具 举报

10

主题

70

帖子

1593

积分

论坛UI达人

积分
1593
金钱
1513
HASS币
28
 楼主| 发表于 2024-8-9 22:45:28 | 显示全部楼层
本帖最后由 消逝 于 2024-8-9 22:58 编辑

19、全屋空调、加湿器直接使用的ha自带的恒温器和恒湿器
          - type: custom:popup-card
            entity: sensor.fullroom_climate_num
            style: |
              --popup-min-width: 600px;
            card:
              type: horizontal-stack
              cards:
                - type: thermostat
                  entity: climate.kongtiao_keting
                  features:
                    - type: climate-hvac-modes
                    - style: icons
                      type: climate-fan-modes
                    - style: icons
                      type: climate-swing-modes
                - type: thermostat
                  entity: climate.kongtiao_zhuwo
                  features:
                    - type: climate-hvac-modes
                    - style: icons
                      type: climate-fan-modes
                    - style: icons
                      type: climate-swing-modes
20、净化器、浴霸
使用的是button手搓的的模块
除复制代码外,还需要复制模板内device开头的模板
button_card_templates:
    device_xxxx:
    ……
    device_xxxx:
    ……

          - type: custom:popup-card
            entity: sensor.fullroom_fan_num
            style: |
              --popup-min-width: 600px;
            card:
              type: picture-elements
              image: /local/UI/null30_23.png
              elements:
                - type: custom:button-card
                  style:
                    top: 50%
                    left: 25%
                  template: device
                  variables:
                    entity: fan.jinghuaqi_keting #背景环对应的实体
                    button_num: 2  #第一排是2个按钮还是3个按钮
                    name: 客厅净化器  #显示的名字
                    more_entity: fan.jinghuaqi_keting  #右上角更多关联的实体
                    label_entity: fan.jinghuaqi_keting  #文本状态显示的实体
                    wendu_entity: sensor.jinghuaqi_keting_wendu # 下面小写的温度
                    shidu_entity: sensor.jinghuaqi_keting_shidu # 下面小写的湿度
                    state_entity: sensor.jinghuaqi_keting_pm25 # 中间大的数值
                    unit: µg/m³  # 中间的单位
                    a1_entity: fan.jinghuaqi_keting #第1个操作的按钮的实体
                    a2_entity: fan.jinghuaqi_keting #第2个操作的按钮的实体
                    a3_entity: sensor.jinghuaqi_keting_mode #第3个操作的按钮的实体
                    a4_entity: sensor.jinghuaqi_keting_mode #第4个操作的按钮的实体
                    a5_entity: sensor.jinghuaqi_keting_mode #第5个操作的按钮的实体
                    a1_action: call-service #第1个操作的按钮的执行的动作,服务或者点击
                    a2_action: call-service #第2个操作的按钮的执行的动作,服务或者点击
                    a3_action: call-service #第3个操作的按钮的执行的动作,服务或者点击
                    a4_action: call-service #第4个操作的按钮的执行的动作,服务或者点击
                    a5_action: call-service #第5个操作的按钮的执行的动作,服务或者点击
                    a1_service: script.jinghuaqi_keting_mode_on  #第1个操作的按钮链接的服务
                    a2_service: script.jinghuaqi_keting_mode_off  #第2个操作的按钮链接的服务
                    a3_service: script.jinghuaqi_keting_mode_auto  #第3个操作的按钮链接的服务
                    a4_service: script.jinghuaqi_keting_mode_sleep  #第4个操作的按钮链接的服务
                    a5_service: script.jinghuaqi_keting_mode_favorite  #第5个操作的按钮链接的服务
                    a1_state: 'on'  #第1个按钮显示的状态,on显示灰色
                    a2_state: 'off' #第2个按钮显示的状态,off显示灰色
                    a1_mode: 开机  #第1个按钮显示文本或图标
                    a2_mode: 关机  #第2个按钮显示文本或图标
                    a3_mode: 自动  #第3个按钮显示文本或图标
                    a4_mode: 睡眠  #第4个按钮显示文本或图标
                    a5_mode: 最爱  #第5个按钮显示文本或图标



回复

使用道具 举报

0

主题

10

帖子

104

积分

注册会员

Rank: 2

积分
104
金钱
94
HASS币
0
发表于 2024-8-9 22:56:42 | 显示全部楼层
专程来看你的贴子
回复

使用道具 举报

4

主题

59

帖子

306

积分

中级会员

Rank: 3Rank: 3

积分
306
金钱
247
HASS币
0
发表于 2024-8-9 23:10:52 | 显示全部楼层
搬张凳子
回复

使用道具 举报

0

主题

1

帖子

34

积分

新手上路

Rank: 1

积分
34
金钱
33
HASS币
0
发表于 2024-8-10 00:07:37 | 显示全部楼层
太牛了,膜拜大佬
回复

使用道具 举报

0

主题

5

帖子

46

积分

新手上路

Rank: 1

积分
46
金钱
41
HASS币
0
发表于 2024-8-10 04:26:30 | 显示全部楼层
这个是我见过最好看的主题,想学习
回复

使用道具 举报

4

主题

104

帖子

560

积分

高级会员

Rank: 4

积分
560
金钱
456
HASS币
0
发表于 2024-8-10 08:42:52 | 显示全部楼层
时间怎么设置成秒的?
这个接口的诗词量蛮少的,就那么几首。不知道有没有其他的接口
同时也提供在线接口:https://v2.jinrishici.com/sentence
回复

使用道具 举报

0

主题

35

帖子

205

积分

中级会员

Rank: 3Rank: 3

积分
205
金钱
170
HASS币
0
发表于 2024-8-10 08:49:12 | 显示全部楼层
感谢分享
回复

使用道具 举报

5

主题

128

帖子

1052

积分

金牌会员

Rank: 6Rank: 6

积分
1052
金钱
924
HASS币
0
发表于 2024-8-10 09:09:55 | 显示全部楼层
感谢楼主无私奉献,有的一番研究了
回复

使用道具 举报

1

主题

15

帖子

106

积分

注册会员

Rank: 2

积分
106
金钱
91
HASS币
0
发表于 2024-8-10 10:18:29 | 显示全部楼层
11112221222222222222222
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-12-22 10:53 , Processed in 0.130058 second(s), 31 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表