2026年最新TC1接入HA教程

2026-04-22 12:24:12 0点赞 2收藏 0评论
2026年最新TC1接入HA教程

我接入的Homeassistant版本

接入效果图接入效果图

斐讯的这款TC1质量还是非常的不错,选择价格也非常便宜,50以内随便买。接入HA的前提必须刷入zTC1固件。通过qttm协议接入HA。

具体步骤如下:

1.将TC1传感器写入yaml文件

在HA主页面找到文件管理器(扳手图标)点开文件夹找到confinguration.yaml移到最后粘贴传感器配置

2026年最新TC1接入HA教程

mqtt: - switch: name: 'ztc1_1_你的设备MAC' unique_id: ztc1_1_你的设备MAC state_topic: 'device/ztc1/你的设备MAC/state' command_topic: 'device/ztc1/你的设备MAC/set' payload_on: '{"mac":"你的设备MAC","plug_0":{"on":1}}' payload_off: '{"mac":"你的设备MAC","plug_0":{"on":0}}' value_template: '{{ value_json.plug_0.on }}' state_on: '1' state_off: '0' availability_topic: "device/ztc1/你的设备MAC/availability" payload_available: 1 payload_not_available: 0 - switch: name: 'ztc1_2_你的设备MAC' unique_id: ztc1_2_你的设备MAC state_topic: 'device/ztc1/你的设备MAC/state' command_topic: 'device/ztc1/你的设备MAC/set' payload_on: '{"mac":"你的设备MAC","plug_1":{"on":1}}' payload_off: '{"mac":"你的设备MAC","plug_1":{"on":0}}' value_template: '{{ value_json.plug_1.on }}' state_on: '1' state_off: '0' availability_topic: "device/ztc1/你的设备MAC/availability" payload_available: 1 payload_not_available: 0 - switch: name: 'ztc1_3_你的设备MAC' unique_id: ztc1_3_你的设备MAC state_topic: 'device/ztc1/你的设备MAC/state' command_topic: 'device/ztc1/你的设备MAC/set' payload_on: '{"mac":"你的设备MAC","plug_2":{"on":1}}' payload_off: '{"mac":"你的设备MAC","plug_2":{"on":0}}' value_template: '{{ value_json.plug_2.on }}' state_on: '1' state_off: '0' availability_topic: "device/ztc1/你的设备MAC/availability" payload_available: 1 payload_not_available: 0 - switch: name: 'ztc1_4_你的设备MAC' unique_id: ztc1_4_你的设备MAC state_topic: 'device/ztc1/你的设备MAC/state' command_topic: 'device/ztc1/你的设备MAC/set' payload_on: '{"mac":"你的设备MAC","plug_3":{"on":1}}' payload_off: '{"mac":"你的设备MAC","plug_3":{"on":0}}' value_template: '{{ value_json.plug_3.on }}' state_on: '1' state_off: '0' availability_topic: "device/ztc1/你的设备MAC/availability" payload_available: 1 payload_not_available: 0 - switch: name: 'ztc1_5_你的设备MAC' unique_id: ztc1_5_你的设备MAC state_topic: 'device/ztc1/你的设备MAC/state' command_topic: 'device/ztc1/你的设备MAC/set' payload_on: '{"mac":"你的设备MAC","plug_4":{"on":1}}' payload_off: '{"mac":"你的设备MAC","plug_4":{"on":0}}' value_template: '{{ value_json.plug_4.on }}' state_on: '1' state_off: '0' availability_topic: "device/ztc1/你的设备MAC/availability" payload_available: 1 payload_not_available: 0 - switch: name: 'ztc1_6_你的设备MAC' unique_id: ztc1_6_你的设备MAC state_topic: 'device/ztc1/你的设备MAC/state' command_topic: 'device/ztc1/你的设备MAC/set' payload_on: '{"mac":"你的设备MAC","plug_5":{"on":1}}' payload_off: '{"mac":"你的设备MAC","plug_5":{"on":0}}' value_template: '{{ value_json.plug_5.on }}' state_on: '1' state_off: '0' availability_topic: "device/ztc1/你的设备MAC/availability" payload_available: 1 payload_not_available: 0 - sensor: name: 'ztc1_power_你的设备MAC' unique_id: ztc1_power_你的设备MAC state_topic: 'device/ztc1/你的设备MAC/sensor' unit_of_measurement: 'W' icon: 'mdi:gauge' value_template: '{{ value_json.power }}' availability_topic: "device/ztc1/你的设备MAC/availability" payload_available: 1 payload_not_available: 0 - sensor: name: 'ztc1_time_你的设备MAC' unique_id: ztc1_time_你的设备MAC state_topic: 'device/ztc1/你的设备MAC/sensor' #unit_of_measurement: '秒' icon: 'mdi:gauge' availability_topic: "device/ztc1/你的设备MAC/availability" payload_available: 1 payload_not_available: 0 #value_template: '{{ value_json.total_time }}' value_template: >- {% set time = value_json.total_time %} {% set minutes = ((time % 3600) / 60) | int %} {% set hours = ((time % 86400) / 3600) | int %} {% set days = (time / 86400) | int %} {%- if time < 60 -%} <1分钟 {%- else -%} {%- if days > 0 -%} {{ days }}天 {%- endif -%} {%- if hours > 0 -%} {{ hours }}小时 {%- endif -%} {%- if minutes > 0 -%} {{ minutes }}分钟 {%- endif -%} {%- endif -%} homeassistant: customize: switch.ztc1_1_你的设备MAC: friendly_name: zTC1插槽1 switch.ztc1_2_你的设备MAC: friendly_name: zTC1插槽2 switch.ztc1_3_你的设备MAC: friendly_name: zTC1插槽3 switch.ztc1_4_你的设备MAC: friendly_name: zTC1插槽4 switch.ztc1_5_你的设备MAC: friendly_name: zTC1插槽5 switch.ztc1_6_你的设备MAC: friendly_name: zTC1插槽6 sensor.ztc1_power_你的设备MAC: friendly_name: zTC1功率 sensor.ztc1_time_你的设备MAC: friendly_name: zTC1运行时间

保存重启后在实体就能看到ztcz1

2026年最新TC1接入HA教程

到了这一步已成功80%下面就是在仪表盘编辑卡片。

tc1.png图片tc1.png图片须将图片放到你设备www文件夹里面的UI文件夹内须将图片放到你设备www文件夹里面的UI文件夹内

stack-in-card卡片须在HACS里面提前下载好并重启后进入下面步骤

找到你自己的仪表盘点击编辑按钮(🖊)

2026年最新TC1接入HA教程

在最下面可以找到并点击新建部件在搜索框输入手动,点击手动进入编辑状态。

2026年最新TC1接入HA教程2026年最新TC1接入HA教程

删除原来配置参数

2026年最新TC1接入HA教程

导入新的配置文件

2026年最新TC1接入HA教程

type: custom:stack-in-card

mode: vertical

cards:

- type: custom:mod-card

card:

type: custom:mushroom-title-card

title: TC1

card_mod:

style:

mushroom-title-card$: |

/* Set spacing around greeting */

.header {

--title-padding: 20px 0px 10px 20px;

--title-spacing: 8px;

}

- type: custom:mod-card

card:

type: grid

square: false

mode: horizontal

cards:

- type: custom:mod-card

card:

type: picture

image: /local/UI/tc1.png

card_mod: null

style: |

ha-card {

/* Set padding of card */

padding: 0px 0px 0px 0px;

/* Move card up to match header card */

--ha-card-border-radius: 0px;

margin-left: 0px;

margin-right: 40px;

margin-bottom: 0px;

- type: custom:mod-card

card:

type: custom:mushroom-template-card

icon: mdi:timer-play

icon_color: red

layout: horizontal

entity: sensor.tc1_你自己设备MAC地址_uptime

fill_container: true

primary: 运行时间

secondary: "{{states('sensor.ztc1_time_你自己设备MAC地址')}}"

tap_action:

action: fire-dom-event

card_mod: null

style: |

ha-card {

/* Move card up to match header card */

margin-left: -10px;

margin-right: 20px;

margin-top: -5px;

margin-bottom: 0px;

columns: 2

style: |

ha-card {

/* Set padding of card */

padding: 0px 0px 0px 0px;

/* Move card up to match header card */

margin-left: 28px;

margin-right: 0px;

margin-bottom: -8px;

/* Remove styling from card */

--ha-card-background: none;

--ha-card-box-shadow: none;

--ha-card-border-width: 0;

padding: 0px !important;

transition: all 0s;

}

- type: custom:mod-card

card:

type: horizontal-stack

cards:

- type: custom:mod-card

card:

type: custom:mushroom-title-card

subtitle: 功率 Power

style:

mushroom-title-card$: |

/* Style name */

.subtitle {

--subtitle-font-size: 18px;

--subtitle-font-weight: var(--mush-title-font-weight, bold);

color: var(--secondary-text-color) !important;

}

- type: custom:mod-card

card:

type: custom:mushroom-title-card

alignment: end

subtitle: "{{states('sensor.ztc1_power_你自己设备MAC地址')}} W"

style:

mushroom-title-card$: |

/* Style name */

.subtitle {

--subtitle-font-size: 18px;

--subtitle-font-weight: var(--mush-title-font-weight, bold);

color: var(--secondary-text-color) !important;

}

style: |

ha-card {

margin-left: 10px;

margin-right: 10px;

margin-bottom: -40px;

}

- type: custom:mod-card

card:

type: custom:mini-graph-card

name: null

entities:

- sensor.ztc1_power_你自己设备MAC地址

animate: false

height: 100

upper_bound_secondary: 40

line_color: skyblue

line_width: 6

font_size: 80

font-weight: bold

show:

name: false

icon: false

state: false

style: |

ha-card {

/* Move card up to match header card */

margin-left: 10px;

margin-right: 10px;

margin-bottom: 0px;

/* Remove styling from card */

--ha-card-background: none;

--ha-card-box-shadow: none;

--ha-card-border-width: 0;

--ha-card-border-radius: 15px;

padding: 0px !important;

transition: all 0s;

}

- type: custom:mod-card

card:

type: grid

square: true

cards:

- type: custom:mushroom-entity-card

entity: switch.ztc1_1_你自己设备MAC地址

name:你自己所接设备名称

layout: vertical

icon_color: orange

tap_action:

action: toggle

double_tap_action:

action: more-info

card_mod:

style: |

ha-card {

background: var(--card-background-color);

width: auto;

border-radius: 20px;

margin-left: auto;

margin-right: auto;

margin-bottom: 0px;

}

- type: custom:mushroom-entity-card

entity: switch.ztc1_2_你自己设备MAC地址

name: 你自己所接设备名称

layout: vertical

icon_color: orange

tap_action:

action: toggle

double_tap_action:

action: more-info

card_mod:

style: |

ha-card {

background: var(--card-background-color);

width: auto;

border-radius: 20px;

margin-left: auto;

margin-right: auto;

margin-bottom: 0px;

}

- type: custom:mushroom-entity-card

entity: switch.ztc1_3_你自己设备MAC地址

name: 你自己所接设备名称

layout: vertical

icon_color: orange

tap_action:

action: toggle

double_tap_action:

action: more-info

card_mod:

style: |

ha-card {

background: var(--card-background-color);

width: auto;

border-radius: 20px;

margin-left: auto;

margin-right: auto;

margin-bottom: 0px;

}

- type: custom:mushroom-entity-card

entity: switch.ztc1_4_你自己设备MAC地址

name: 你自己所接设备名称

layout: vertical

icon_color: orange

tap_action:

action: toggle

double_tap_action:

action: more-info

card_mod:

style: |

ha-card {

background: var(--card-background-color);

width: auto;

border-radius: 20px;

margin-left: auto;

margin-right: auto;

margin-bottom: 0px;

}

- type: custom:mushroom-entity-card

entity: switch.ztc1_5_你自己设备MAC地址

name: 你自己所接设备名称

layout: vertical

icon_color: orange

tap_action:

action: toggle

double_tap_action:

action: more-info

card_mod:

style: |

ha-card {

background: var(--card-background-color);

width: auto;

border-radius: 20px;

margin-left: auto;

margin-right: auto;

margin-bottom: 0px;

}

- type: custom:mushroom-entity-card

entity: switch.ztc1_6_你自己设备MAC地址

name: 你自己所接设备名称

layout: vertical

icon_color: orange

tap_action:

action: toggle

double_tap_action:

action: more-info

card_mod:

style: |

ha-card {

background: var(--card-background-color);

width: auto;

border-radius: 20px;

margin-left: auto;

margin-right: auto;

margin-bottom: 0px;

}

columns: 3

card_mod:

style: |

ha-card {

margin-top: 20px;

margin-left: 10px;

margin-right: 10px;

}

2026年最新TC1接入HA教程2026年最新TC1接入HA教程

打开电视测试功率显示正常。

展开 收起
0评论

当前文章无评论,是时候发表评论了
提示信息

取消
确认
评论举报

相关文章推荐

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