一个卡片搞定全家智能插座 — Smart Plug Card 上手体验

2026-05-13 10:08:25 2点赞 5收藏 1评论

开关状态、实时功率、用电量,一张卡片全掌握。

---

🔍 你是不是也这样?

智能家居里的插座越来越多,但 HA 默认只能看到一个个独立的实体:

  • 😑 想看空调插座功率,要点进实体详情

  • 😑 想看今天用了多少电,要再点进另一个实体

  • 😑 想对比几个插座的用电,要开好几个窗口

  • 😑 开关状态、功率、电压、电流、用电量,散落在五六个实体里

信息碎片化,一眼看不全。

---

💡 一张卡片,聚合所有关键数据

Smart Plug Card是一个 Home Assistant 自定义卡片,把智能插座的所有关键数据聚合到一张卡片里:

```yaml

type:custom:smart-plug-card

title:客厅插座

switch_entity:switch.living_room_plug

power_entity:sensor.living_room_plug_power

voltage_entity:sensor.living_room_plug_voltage

current_entity:sensor.living_room_plug_current

daily_energy_entity:sensor.living_room_plug_daily

monthly_energy_entity:sensor.living_room_plug_monthly

```

效果:

一个卡片搞定全家智能插座 — Smart Plug Card 上手体验


✨ 六大核心功能

1️⃣ 开关状态,一目了然

开启/关闭状态用绿色/红色标签直观展示,不需要点进实体看`on`/`off`。

2️⃣ 功率 · 电压 · 电流,三列并排

再也不用来回切实体。功率、电压、电流三列网格排布,一眼扫完:

3️⃣ 日用电量 · 月用电量

直接在卡片底部显示今日和本月累计用电,省去翻统计页面的麻烦。

4️⃣ 💡 指示灯状态

支持两种指示灯配置:

  • indicator_entity(binary_sensor)— 显示指示灯亮/灭

  • indicator_light_entity(sensor)— 显示指示灯亮度或其他数值

5️⃣ 横向多列布局

多个插座不想上下堆叠?切换横向模式,并排显示:

```yaml

type:custom:smart-plug-card

display_mode:horizontal # 横向布局

columns:2 # 2列显示

entities:

-name:客厅空调

switch_entity:switch.living_room_ac

power_entity:sensor.living_room_ac_power

-name:卧室风扇

switch_entity:switch.bedroom_fan

power_entity:sensor.bedroom_fan_power

```

效果:

一个卡片搞定全家智能插座 — Smart Plug Card 上手体验

6️⃣ 深色主题自动适配

使用 HA 官方 CSS 变量,主题切换时颜色自动跟随,无需手动配置。

一个卡片搞定全家智能插座 — Smart Plug Card 上手体验

---

📋 完整配置一览

一个卡片搞定全家智能插座 — Smart Plug Card 上手体验

| 参数 | 说明 | 默认值 |

|------|------|--------|

|`switch_entity`| 开关实体(必需) | — |

|`power_entity`| 功率传感器(W) | 可选 |

|`voltage_entity`| 电压传感器(V) | 可选 |

|`current_entity`| 电流传感器(A) | 可选 |

|`daily_energy_entity`| 日用电量(kWh) | 可选 |

|`monthly_energy_entity`| 月用电量(kWh) | 可选 |

|`indicator_entity`| 指示灯状态(亮/灭) | 可选 |

|`indicator_light_entity`| 指示灯亮度 | 可选 |

|`display_mode`| vertical / horizontal | vertical |

|`columns`| 横向模式列数 | 2 |

>所有传感器都是**可选**的,没配置的字段自动显示`--`,不影响其他字段。

---

🚀 安装方式

一个卡片搞定全家智能插座 — Smart Plug Card 上手体验

HACS 安装(推荐)

  1. HACS → 前端 → 右下角 + → 自定义仓库

  2. 输入:`https://github.com/j1617/smart-plug-card`

  3. 类别选 Lovelace → 安装

手动安装

  1. 下载 smart-plug-card.js/config/www/

  2. 配置资源引用:

```yaml

lovelace:

resources:

-url:/local/smart-plug-card.js

type:module

```

3.重启 HA → 添加卡片

---


🛠 常见问题

Q: 功率/电压/电流显示 "--"?

>确认对应的传感器实体 ID 正确,且状态不为`unavailable`。

Q: 多个插座怎么配?

>用`entities`列表,每个插座一个对象,支持混合配置详细字段。

Q: 想用深色主题?

>卡片默认跟随 HA 主题,无需额外配置。如需自定义:

>```yaml

>background_color:'#1a1f2e'

>text_color:'#f1f5f9'

>secondary_color:'#94a3b8'

>```

---


🔗 项目地址

---


同系列卡片

  • 🔋 Battery Card(电池状态卡片) — 一键掌控全家设备电量

  • 📱 Phone Info Card(话费卡片) — 手机话费余额一目了然

三个卡片搭配使用,电量、用电、话费,关键信息一屏搞定。

---

专注 Home Assistant 自动化技巧与插件开发

展开 收起
1评论

  • 精彩
  • 最新
  • 试试看,用ai编辑了一些卡片,不太满意

    校验提示文案

    提交
提示信息

取消
确认
评论举报

相关文章推荐

更多精彩文章
更多精彩文章
最新文章 热门文章
5
扫一下,分享更方便,购买更轻松