home assistant弹出卡片

一、安装

安装步骤:

1、HACS - 集成 - 浏览并下载存储库:搜索 “browser_mod”,下载
在这里插入图片描述

2、重启homeassistant

在这里插入图片描述

3、配置 - 设备与服务 - 添加集成,搜索 “Browser mod”,添加

在这里插入图片描述

4、完成

二、使用

(1)先自定义弹出卡片的内容,把整段代码复制

type: vertical-stack
cards:
  - type: weather-forecast
    entity: weather.su_zhou_ku_dou_wu_lian_ke_ji_you_xian_gong_si
    forecast_type: daily

在这里插入图片描述

(2)点击一个实体,弹出自定义卡片内容

实体如下:

show_name: true
show_icon: true
type: button
tap_action:
  action: toggle
entity: weather.su_zhou_ku_dou_wu_lian_ke_ji_you_xian_gong_si

在这里插入图片描述

需要在弹出的模块的 tap_action里面增加:

tap_action:
	action: fire-dom-event
	browser_mod:
	  service: browser_mod.popup
	  data:
    	title: 弹出卡片标题
   		content: 弹出卡片内容

有时候添加的时候会闪一下然后出现

action: ""

如果出现这个问题就重新操作一次

把前面复制的自定义卡片内容复制进来,并用 Tab键对齐到content的下一层级即可。

show_name: true
show_icon: true
type: button
tap_action:
  action: fire-dom-event
  browser_mod:
    service: browser_mod.popup
    data:
      title: 天气
      content:
        type: vertical-stack
        cards:
          - type: weather-forecast
            entity: weather.su_zhou_ku_dou_wu_lian_ke_ji_you_xian_gong_si
            forecast_type: daily
entity: weather.su_zhou_ku_dou_wu_lian_ke_ji_you_xian_gong_si

当点击实体时,就能弹出自定义的弹窗来了:

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/m0_46613429/article/details/140465786