找回密码
 立即注册
查看: 2389|回复: 9

[插件集成] 斐讯DC1插件for HomeAssistant 报错 求助

[复制链接]
piww 

16

主题

116

回帖

778

积分

高级会员

积分
778
金钱
646
HASS币
0
发表于 2022-7-16 19:12:42 | 显示全部楼层 |阅读模式
谁能帮忙看看吗?


报错是这样的,到底是啥问题啊。。
Platform error switch.phicomm_dc1 - cannot import name 'SwitchDevice' from 'homeassistant.components.switch' (/usr/src/homeassistant/homeassistant/components/switch/__init__.py)
Platform error switch.phicomm_dc1 - cannot import name 'SwitchDevice' from 'homeassistant.components.switch' (/usr/src/homeassistant/homeassistant/components/switch/__init__.py)
Platform error switch.phicomm_dc1 - cannot import name 'SwitchDevice' from 'homeassistant.components.switch' (/usr/src/homeassistant/homeassistant/components/switch/__init__.py)


回复

使用道具 举报

piww 

16

主题

116

回帖

778

积分

高级会员

积分
778
金钱
646
HASS币
0
 楼主| 发表于 2022-7-16 20:04:33 | 显示全部楼层
此错误来自自定义集成。

Logger: homeassistant.config
Source: custom_components/phicomm_dc1_switch/switch.py:16
Integration: phicomm_dc1_switch
First occurred: 19:55:58 (3 occurrences)
Last logged: 19:55:58

Platform error: switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 877, in async_process_component_config
    platform = p_integration.get_platform(domain)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 618, in get_platform
    cache[full_name] = self._import_platform(platform_name)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 635, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/config/custom_components/phicomm_dc1_switch/switch.py", line 16, in <module>
    from homeassistant.components.switch import (SwitchDevice, PLATFORM_SCHEMA)
ImportError: cannot import name 'SwitchDevice' from 'homeassistant.components.switch' (/usr/src/homeassistant/homeassistant/components/switch/__init__.py)
回复

使用道具 举报

1

主题

19

回帖

1055

积分

金牌会员

积分
1055
金钱
1035
HASS币
0
发表于 2022-7-16 20:10:01 来自手机 | 显示全部楼层
建议用nodered吧 稳定多了 homekit还可以直接显示为一个插座
回复

使用道具 举报

35

主题

955

回帖

4894

积分

论坛元老

积分
4894
金钱
3904
HASS币
20
发表于 2022-7-16 20:59:23 | 显示全部楼层
我直接刷机的,稳定好用
回复

使用道具 举报

78

主题

1346

回帖

2万

积分

元老级技术达人

积分
27796
金钱
26332
HASS币
290
发表于 2022-7-16 21:30:21 | 显示全部楼层
新版ha中已经弃用: SwitchDevice 这个了,需要修改,参考:
https://bbs.hassbian.com/thread-15285-1-1.html
回复

使用道具 举报

piww 

16

主题

116

回帖

778

积分

高级会员

积分
778
金钱
646
HASS币
0
 楼主| 发表于 2022-7-18 10:10:24 | 显示全部楼层
aiweiwei 发表于 2022-7-16 20:10
建议用nodered吧 稳定多了 homekit还可以直接显示为一个插座

有链接吗?我网上找了几个,不稳定啊。。。。我不是很想刷机,主要是要拆机,拆了就不帅了....
回复

使用道具 举报

3

主题

97

回帖

1624

积分

金牌会员

积分
1624
金钱
1524
HASS币
10
发表于 2022-7-18 10:13:11 | 显示全部楼层
刷机吧,一劳永逸,我5个都刷了
回复

使用道具 举报

piww 

16

主题

116

回帖

778

积分

高级会员

积分
778
金钱
646
HASS币
0
 楼主| 发表于 2022-7-18 10:58:26 | 显示全部楼层
意思域名劫持的方案(非node)非常不稳定?   
回复

使用道具 举报

0

主题

4

回帖

38

积分

新手上路

积分
38
金钱
34
HASS币
0
发表于 2022-9-8 11:41:43 | 显示全部楼层
楼主的问题解决了吗?我最近也在折腾DC1、M1,跟你一样不像刷机接入HA,如果已经解决,麻烦分享一下
回复

使用道具 举报

piww 

16

主题

116

回帖

778

积分

高级会员

积分
778
金钱
646
HASS币
0
 楼主| 发表于 2023-2-6 15:43:58 | 显示全部楼层
FrankLiang 发表于 2022-9-8 11:41
楼主的问题解决了吗?我最近也在折腾DC1、M1,跟你一样不像刷机接入HA,如果已经解决,麻烦分享一下 ...

M1   
DNS劫持:
方法可参考原插件。
劫持aircat.phicomm.com到ha地址。

DC1.zip

10.99 KB, 下载次数: 13

M1配置文件.zip

15.01 KB, 下载次数: 9

回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-5-19 00:20 , Processed in 0.136583 second(s), 25 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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