斐讯DC1 插排接入Home Assistant (0.93版本)
视频教程:
https://youtu.be/vqvzF_mwM7E
1.首先解析域名smartplugconnect.phicomm.com到你的Home Assistant 服务器。
——————————————————————————————
2.下载一个DC1网络配置工具安卓版本
DC1网络配置工具
——————————————————————————————
3.点此下载插件
再把附件放到.homeassistant/custom_components/下
—————————————————————————————-
4.配置文件增加如下配置(一个DC1插排):
switch:
- platform: phicomm_dc1
name: dc1
ip: "192.168.2.116" #修改此处为你的DC1 插排IP地址
ports: {'1':'dc1_s1','2':'dc1_s2','3':'dc1_s3'}
- platform: template
switches:
dc1_template:
friendly_name: 总开关
value_template: "{{ is_state('switch.dc1', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1
dc1_s1_template:
friendly_name: 插座1
value_template: "{{ is_state('switch.dc1_s1', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1_s1
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1_s1
dc1_s2_template:
friendly_name: 插座2
value_template: "{{ is_state('switch.dc1_s2', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1_s2
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1_s2
dc1_s3_template:
friendly_name: 插座3
value_template: "{{ is_state('switch.dc1_s3', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1_s3
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1_s3
sensor:
- platform: template
sensors:
dc1_v:
friendly_name: 当前电压
value_template: "{{ states.switch.dc1.attributes.v }}"
unit_of_measurement: V
dc1_p:
friendly_name: 当前功率
value_template: "{{ states.switch.dc1.attributes.p }}"
unit_of_measurement: W
# dc1_totale:
# friendly_name: 累计用电
# value_template: "{{ states.switch.dc1.attributes.totalelect }}"
# unit_of_measurement: 度
group:
dc1:
name: 工作区DC1排插
view: no
entities:
- sensor.dc1_v
- sensor.dc1_p
#- sensor.dc1_totale
- switch.dc1_template
- switch.dc1_s1_template
- switch.dc1_s2_template
- switch.dc1_s3_template
homeassistant:
customize:
# Add an entry for each entity that you want to overwrite.
switch.dc1:
hidden: true
switch.dc1_s1:
hidden: true
switch.dc1_s2:
hidden: true
switch.dc1_s3:
hidden: true
配置文件增加如下配置(两个DC1插排):
switch:
- platform: phicomm_dc1
name: dc1
ip: "192.168.2.116" #修改此处为你的DC1 插排IP地址
ports: {'1':'dc1_s1','2':'dc1_s2','3':'dc1_s3'}
- platform: phicomm_dc1
name: dc1_2
ip: "192.168.2.122" #修改此处为你的DC1 插排IP地址
ports: {'1':'dc1_2_s1','2':'dc1_2_s2','3':'dc1_2_s3'}
- platform: template
switches:
dc1_template:
friendly_name: 总开关
value_template: "{{ is_state('switch.dc1', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1
dc1_s1_template:
friendly_name: 插座1
value_template: "{{ is_state('switch.dc1_s1', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1_s1
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1_s1
dc1_s2_template:
friendly_name: 插座2
value_template: "{{ is_state('switch.dc1_s2', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1_s2
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1_s2
dc1_s3_template:
friendly_name: 插座3
value_template: "{{ is_state('switch.dc1_s3', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1_s3
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1_s3
dc1_2_template:
friendly_name: 总开关
value_template: "{{ is_state('switch.dc1', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1
dc1_2_s1_template:
friendly_name: 插座3
value_template: "{{ is_state('switch.dc1_s1', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1_2_s1
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1_2_s1
dc1_2_s2_template:
friendly_name: 插座4
value_template: "{{ is_state('switch.dc1_s2', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1_2_s2
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1_2_s2
dc1_2_s3_template:
friendly_name: 插座5
value_template: "{{ is_state('switch.dc1_s3', 'on') }}"
turn_on:
service: switch.turn_on
data:
entity_id: switch.dc1_2_s3
turn_off:
service: switch.turn_off
data:
entity_id: switch.dc1_2_s3
sensor:
- platform: template
sensors:
dc1_v:
friendly_name: 当前电压
value_template: "{{ states.switch.dc1.attributes.v }}"
unit_of_measurement: V
dc1_p:
friendly_name: 当前功率
value_template: "{{ states.switch.dc1.attributes.p }}"
unit_of_measurement: W
dc1_2_v:
friendly_name: 当前电压
value_template: "{{ states.switch.dc1_2.attributes.v }}"
unit_of_measurement: V
dc1_2_p:
friendly_name: 当前功率
value_template: "{{ states.switch.dc1_2.attributes.p }}"
unit_of_measurement: W
# dc1_totale:
# friendly_name: 累计用电
# value_template: "{{ states.switch.dc1.attributes.totalelect }}"
# unit_of_measurement: 度
group:
dc1:
name: 工作区DC1排插
view: no
entities:
- sensor.dc1_v
- sensor.dc1_p
#- sensor.dc1_totale
- switch.dc1_template
- switch.dc1_s1_template
- switch.dc1_s2_template
- switch.dc1_s3_template
dc1_2:
name: DC1排插2
view: no
entities:
- sensor.dc1_2_v
- sensor.dc1_2_p
#- sensor.dc1_totale
- switch.dc1_2_template
- switch.dc1_2_s1_template
- switch.dc1_2_s2_template
- switch.dc1_2_s3_template
homeassistant:
customize:
# Add an entry for each entity that you want to overwrite.
switch.dc1:
hidden: true
switch.dc1_s1:
hidden: true
switch.dc1_s2:
hidden: true
switch.dc1_s3:
hidden: true
按照你的教程看了几遍了,我用手机APP配置了DC1。灯也变了,但是,我怎么知道DC1的IP地址呢?视频没有交代,请多指教,谢谢!
你可以从路由器上看到DC1的IP地址,路由器的DHCP池里可以看到,如果不确定是哪个地址,你可以ping配合插拔电源来测试是不是这个地址。
地址池了找到了PHICOMM_9E16F0,然后按照你的步骤试了,还是不行,还有一个问题,这个版本有packages文件夹吗,版本太多,而且很多教程,搞晕了。我的是0.93版本。
教程很好,按照教程配置好DC1。我后来还买了一个TC1, 好像TC1的方法和这个不一样?
据说TC1拆了刷机很方便,用mqtt控制。
请问配置多个传感器后homeassistant首页只显示当前配置的插座,之前的温湿度传感器不见了怎么找回来?
通过编辑UI来显示
新版0.97哭了 找不到插件
好像斐讯K2 官改固件没有DNS设置这个功能? 要怎么办?
那就只能找个支持DNS解析的路由器
https://www.sumju.net/wp-content/uploads/2019/06/phicomm_dc1.zip
这个文件和你视频的不一样
请问哪里不一样
up主,我(小白)经过看你的视频,经过多次研究才测试成功。因为你视频里讲的一处,是把configuration.yaml删掉,我照着做hass无法启动了。然后把原来备份的configuration.yaml恢复,再把switch:…那段代码复制再configuration.yaml里(原configuration.yaml不动,接下去复制)后才成功,而且底下的那一小部分因为直接复制格式,导致没有空格,不符合pytho*格式报错,加上python的空格纠正格式后,可以正常控制了。纠正!!!
你可以参考这个视频安装网页版本编辑器https://youtu.be/ej3C36PtNOI
我是遇到和你一样的情况了。。。请教下如何把原来备份的configuration.yaml进行恢复呢?谢谢
老师,您好,小白,第一次弄,树莓派64位镜像,集成DOCKER版本OPENWRT,还有HOME ASSISTANT。安装了以上版本系统,集成home assistant,按您去年那篇文章https://sumju.net/?p=685配置DC1,提示没有那个路径,这个版本的配置路径改为哪个路径,该怎么设置呢?请指导,重装了好几次系统,没成功,求指导。谢谢!
这些代码是不是只能使用在HA 0.93版本上面,我现在是N1上面docker安装的hassio,HA的版本好像是0.103吧。运行不成功啊。HA配置检查,总是出错。难道一定要0.93。难道HA还不能升级了吗??
可以升级
提示:APP配置DC1的wifi账号时,请直接在插排灯闪烁时让手机接入DC1,这样配网成功率99,99%。
2个插排调试情况:
configuration.yaml里面,遇到DC1 脚本配置大类两处与老脚本同类的,如何让新老脚本合法执行呢,
我改了两次,把原有sensor 与 switch 老脚本剪切到 新脚本同类下部,这样处理:#sensor 与 #switch,
提交后重启进入hass,所以插件消失,进入安全状态:
2020-05-05 00:16:54 ERROR (SyncWorker_1) [homeassistant.util.yaml.loader] while scanning for the next token
found character ‘\t’ that cannot start any token
in “/config/configuration.yaml”, line 152, column 1
2020-05-05 00:16:54 ERROR (MainThread) [homeassistant.bootstrap] Failed to parse configuration.yaml: while scanning for the next token
found character ‘\t’ that cannot start any token
in “/config/configuration.yaml”, line 152, column 1. Falling back to safe mode
2020-05-05 00:17:14 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2020-05-05 01:01:26 WARNING (MainThread) [homeassistant.components.webhook] Received message for unregistered webhook 5d2a494311dd4893a464c0b31e64f392314f4f76137cc4eda911bf1825c30207
2020-05-05 01:01:26 WARNING (MainThread) [homeassistant.components.webhook] Received message for unregistered webhook 5d2a494311dd4893a464c0b31e64f392314f4f76137cc4eda911bf1825c30207
2020-05-05 01:01:27 WARNING (MainThread) [homeassistant.components.webhook] Received message for unregistered webhook 5d2a494311dd4893a464c0b31e64f392314f4f76137cc4eda911bf1825c30207
只能把备份的yaml恢复,,,,,,,
通过阅读上面的系统警告提示:found character ‘\t’ that cannot start any token in “/config/configuration.yaml”, line 152, column
操作:xshell —-》修改152上下文有空格,删除空格,保持语法连贯。
HASS重启后界面回复正常。插件都有了。
我按照你的方式配置之后在hass里控制并不能生效,功率之类的也看不到数据。
2020-06-07 00:56:53 WARNING (SyncWorker_10) [custom_components.phicomm_dc1.switch] PhicommDC1Switch Client list is empty
为什么我reboot之后连HASS也进不去了
因为你缺乏耐心
感谢分享教程,已经成功。但是现在有个蛋疼的问题,dc1在WIFI重启之后不会自动连接WIFI,用的是k2p刷了chongshengb的padavan固件,只能手动把插座断电再插电或者重复一遍配网操作。请问帖主有没有办法解决?
硬改会稳定些
好吧,谢谢,担心自己手贱把主板弄坏了才劫持的。
之前好用的 今天不知道为啥突然 dc变得一闪一闪的,重启了斐讯也没有用 有遇到这样的问题的小伙伴吗?
之前好用的 今天不知道为啥突然 dc变得一闪一闪的,重启了斐讯也没有用 有遇到这样的问题的小伙伴吗?
楼主N1镜像https://t.me/itcommander/59国内打不开,能不能更新一下链接呢?
新版hassio有百度盘
配置好出现这个
Invalid config for [group]: [view] is an invalid option for [group]. Check: group->group->dc1_1->view. (See ?, line ?).
看node-red接入教程,比这个稳定
我也有这个问题,咋解决的
看下流控文件. 谢谢