找回密码
 立即注册

微信扫码登录

搜索
查看: 190|回复: 5

[求助] 想用auto-entities做一个显示已打开的灯和开关,但总不成功,求大佬帮助

[复制链接]

3

主题

50

回帖

223

积分

中级会员

积分
223
金钱
170
HASS币
0
发表于 4 天前 | 显示全部楼层 |阅读模式
以下是我想用这些实体ID显示那个已经打开,用一个实体没有问题,多个实体就不显示,请大佬帮忙看一下,那里问题
type: custom:auto-entities
card:
  type: grid
  columns: 2
  square: false
  title: 当前开启的设备
card_param: cards
filter:
  include:
    - entity_id:
        - light.ftd_nomain_fe01_light
        - light.hfjh_m100_d754_light
        - light.zm1_b0f8931f2f22_brightness
      state: "on"
      options:
        type: custom:mushroom-light-card
        show_brightness_control: true
        use_light_color: true
    - entity_id:
        - switch.090615_akkw1_2373_switch
        - switch.lumi_acn017_7891_left_switch_service
        - switch.lumi_acn017_7891_right_switch_service
        - switch.lumi_acn017_7589_left_switch_service
        - switch.lumi_acn017_7589_right_switch_service
        - switch.lumi_acn017_e76b_left_switch_service
        - switch.lumi_acn017_e76b_right_switch_service
        - switch.lumi_acn017_e945_left_switch_service
        - switch.lumi_acn017_e945_right_switch_service
        - switch.xiaomi_86v1_1b54_left_switch_service
        - switch.xiaomi_86v1_1b54_middle_switch_service
        - switch.xiaomi_86v1_1b54_right_switch_service
        - switch.xiaomi_86v1_98d7_left_switch_service
        - switch.xiaomi_86v1_98d7_middle_switch_service
        - switch.xiaomi_86v1_98d7_right_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle
show_empty: true


回复

使用道具 举报

hhh. 手机认证

10

主题

353

回帖

3061

积分

论坛UI达人

积分
3061
金钱
2698
HASS币
0
发表于 4 天前 | 显示全部楼层
添加辅助元素,全屋灯光组

这个代码就能获取:
{% set all = expand('light.living_room_lamp')| list -%} 
{% set ND1 = all | selectattr('state','eq','on')|list|count%} 
 {{ND1}}盏  
回复

使用道具 举报

2

主题

18

回帖

181

积分

论坛技术达人

积分
181
金钱
161
HASS币
0
发表于 4 天前 | 显示全部楼层
每个实体单独写一条 include,这样不会有多个实体不显示的问题。

type: custom:auto-entities
card:
  type: grid
  columns: 2
  square: false
  title: 当前开启的设备
card_param: cards
filter:
  include:
    # ✅ 灯
    - entity_id: light.ftd_nomain_fe01_light
      state: "on"
      options:
        type: custom:mushroom-light-card
        show_brightness_control: true
        use_light_color: true

    - entity_id: light.hfjh_m100_d754_light
      state: "on"
      options:
        type: custom:mushroom-light-card
        show_brightness_control: true
        use_light_color: true

    - entity_id: light.zm1_b0f8931f2f22_brightness
      state: "on"
      options:
        type: custom:mushroom-light-card
        show_brightness_control: true
        use_light_color: true

    # ✅ 开关
    - entity_id: switch.090615_akkw1_2373_switch
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.lumi_acn017_7891_left_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.lumi_acn017_7891_right_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.lumi_acn017_7589_left_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.lumi_acn017_7589_right_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.lumi_acn017_e76b_left_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.lumi_acn017_e76b_right_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.lumi_acn017_e945_left_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.lumi_acn017_e945_right_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.xiaomi_86v1_1b54_left_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.xiaomi_86v1_1b54_middle_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.xiaomi_86v1_1b54_right_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.xiaomi_86v1_98d7_left_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.xiaomi_86v1_98d7_middle_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

    - entity_id: switch.xiaomi_86v1_98d7_right_switch_service
      state: "on"
      options:
        type: custom:mushroom-chip-card
        icon: mdi:toggle-switch-outline
        tap_action:
          action: toggle

show_empty: true
回复

使用道具 举报

3

主题

50

回帖

223

积分

中级会员

积分
223
金钱
170
HASS币
0
 楼主| 发表于 4 天前 | 显示全部楼层
hhh. 发表于 2025-9-3 18:47
添加辅助元素,全屋灯光组

这个代码就能获取:

请问以上代码怎么使用,还有auto-entities是不是不能显示多ID,谢谢
回复

使用道具 举报

3

主题

50

回帖

223

积分

中级会员

积分
223
金钱
170
HASS币
0
 楼主| 发表于 4 天前 | 显示全部楼层
liyong763435720 发表于 2025-9-3 20:37
每个实体单独写一条 include,这样不会有多个实体不显示的问题。

我最后也是这样改的,但我的mushroom-chip-card和你的不同,是mushroom-chips-card,如果用mushroom-chips-card会报配置错误。另外,怎么让显示出来的实体显示中文而不是一长串的ID
回复

使用道具 举报

2

主题

18

回帖

181

积分

论坛技术达人

积分
181
金钱
161
HASS币
0
发表于 4 天前 | 显示全部楼层
华夏英雄 发表于 2025-9-3 22:32
我最后也是这样改的,但我的mushroom-chip-card和你的不同,是mushroom-chips-card,如果用mushroom-chip ...

每个 options 下的 name: 就是显示的中文名字
    - entity_id: light.ftd_nomain_fe01_light
      state: "on"
      options:
        type: custom:mushroom-light-card
        name: 客厅主灯
        show_brightness_control: true
        use_light_color: true
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2025-9-7 05:13 , Processed in 0.060656 second(s), 8 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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