『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 1952|回复: 12

[技术探讨] 请教zigbee添加外部转换器的问题。

[复制链接]

39

主题

477

帖子

2689

积分

金牌会员

Rank: 6Rank: 6

积分
2689
金钱
2212
HASS币
10
发表于 2022-6-23 11:28:24 | 显示全部楼层 |阅读模式
本帖最后由 yinghu183 于 2022-6-24 09:02 编辑

按照官网的教程,配置目录中添加js文件(代码是在官网推荐的示例中找的)错误日志如下:
Jun 24 08:59:10 raspberrypi npm[5232]:         if (converter.options) {
Jun 24 08:59:10 raspberrypi npm[5232]:                       ^
Jun 24 08:59:10 raspberrypi npm[5232]: TypeError: Cannot read properties of undefined (reading 'options')
Jun 24 08:59:10 raspberrypi npm[5232]:     at Object.addDefinition [as addDeviceDefinition] (/opt/zigbee2mqtt/node_modules/zigbee-herdsman-converters/index.js:91:23)
Jun 24 08:59:10 raspberrypi npm[5232]:     at new ExternalConverters (/opt/zigbee2mqtt/lib/extension/externalConverters.ts:15:17)
Jun 24 08:59:10 raspberrypi npm[5232]:     at new Controller (/opt/zigbee2mqtt/lib/controller.ts:84:58)
Jun 24 08:59:10 raspberrypi npm[5232]:     at start (/opt/zigbee2mqtt/index.js:108:18)
Jun 24 08:59:10 raspberrypi systemd[1]: zigbee2mqtt.service: Succeeded.
Jun 24 08:59:10 raspberrypi systemd[1]: Stopped zigbee2mqtt.
Jun 24 08:59:10 raspberrypi systemd[1]: Started zigbee2mqtt.
Jun 24 08:59:12 raspberrypi npm[5289]: > [email protected] start
Jun 24 08:59:12 raspberrypi npm[5289]: > node index.js
Jun 24 08:59:18 raspberrypi npm[5289]: /opt/zigbee2mqtt/node_modules/zigbee-herdsman-converters/index.js:91
Jun 24 08:59:18 raspberrypi npm[5289]:         if (converter.options) {
Jun 24 08:59:18 raspberrypi npm[5289]:                       ^
Jun 24 08:59:18 raspberrypi npm[5289]: TypeError: Cannot read properties of undefined (reading 'options')
Jun 24 08:59:18 raspberrypi npm[5289]:     at Object.addDefinition [as addDeviceDefinition] (/opt/zigbee2mqtt/node_modules/zigbee-herdsman-converters/index.js:91:23)
Jun 24 08:59:18 raspberrypi npm[5289]:     at new ExternalConverters (/opt/zigbee2mqtt/lib/extension/externalConverters.ts:15:17)
Jun 24 08:59:18 raspberrypi npm[5289]:     at new Controller (/opt/zigbee2mqtt/lib/controller.ts:84:58)
Jun 24 08:59:18 raspberrypi npm[5289]:     at start (/opt/zigbee2mqtt/index.js:108:18)
Jun 24 08:59:18 raspberrypi systemd[1]: zigbee2mqtt.service: Main process exited, code=exited, status=1/FAILURE
Jun 24 08:59:18 raspberrypi systemd[1]: zigbee2mqtt.service: Failed with result 'exit-code'.

然后在configuration.yaml文件中添加
external_converters:
  - xxxx.js
然后重启zigbee页面就死活打不开了,把上面两行代码注释掉就又可以了。。。



回复

使用道具 举报

76

主题

1357

帖子

1万

积分

元老级技术达人

积分
18325
金钱
16928
HASS币
290
发表于 2022-6-23 11:41:50 | 显示全部楼层
可以肯定这个转换代码有问题。
打不开也有z2m的日志,要有日志才容易判断具体哪错了。
否则别人只能靠猜:
zigbee-herdsman-converters 中需要的文件是否下载到对应目录了?
回复

使用道具 举报

8

主题

361

帖子

3725

积分

论坛元老

Rank: 8Rank: 8

积分
3725
金钱
3364
HASS币
10
发表于 2022-6-23 12:12:27 来自手机 | 显示全部楼层
js文件直接写你要添加设备的内容,其他的全部删掉
回复

使用道具 举报

39

主题

477

帖子

2689

积分

金牌会员

Rank: 6Rank: 6

积分
2689
金钱
2212
HASS币
10
 楼主| 发表于 2022-6-23 17:41:01 | 显示全部楼层
dscao 发表于 2022-6-23 11:41
可以肯定这个转换代码有问题。
打不开也有z2m的日志,要有日志才容易判断具体哪错了。
否则别人只能靠猜:

大佬有空帮忙看下日志
Jun 23 17:40:27 raspberrypi npm[11362]:     at Function.Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
Jun 23 17:40:27 raspberrypi npm[11362]:     at Function.Module._load (node:internal/modules/cjs/loader:780:27)
Jun 23 17:40:27 raspberrypi npm[11362]:     at Module.require (node:internal/modules/cjs/loader:1005:19)
Jun 23 17:40:27 raspberrypi npm[11362]:     at require (node:internal/modules/cjs/helpers:102:18)
Jun 23 17:40:27 raspberrypi npm[11362]:     at /opt/zigbee2mqtt/dist/util/externally-loaded.js:2:17
Jun 23 17:40:27 raspberrypi npm[11362]:     at Script.runInContext (node:vm:139:12)
Jun 23 17:40:27 raspberrypi npm[11362]:     at Script.runInNewContext (node:vm:144:17)
Jun 23 17:40:27 raspberrypi npm[11362]:     at Object.runInNewContext (node:vm:298:38)
Jun 23 17:40:27 raspberrypi npm[11362]:     at loadModuleFromText (/opt/zigbee2mqtt/lib/util/utils.ts:148:8)
Jun 23 17:40:27 raspberrypi npm[11362]:     at loadModuleFromFile (/opt/zigbee2mqtt/lib/util/utils.ts:155:12)
Jun 23 17:40:27 raspberrypi systemd[1]: zigbee2mqtt.service: Main process exited, code=exited, status=1/FAILURE
Jun 23 17:40:27 raspberrypi systemd[1]: zigbee2mqtt.service: Failed with result 'exit-code'.
回复

使用道具 举报

39

主题

477

帖子

2689

积分

金牌会员

Rank: 6Rank: 6

积分
2689
金钱
2212
HASS币
10
 楼主| 发表于 2022-6-23 17:42:25 | 显示全部楼层
s2233 发表于 2022-6-23 12:12
js文件直接写你要添加设备的内容,其他的全部删掉

你的办法我试了,行不通。。。
回复

使用道具 举报

8

主题

361

帖子

3725

积分

论坛元老

Rank: 8Rank: 8

积分
3725
金钱
3364
HASS币
10
发表于 2022-6-23 19:18:11 | 显示全部楼层
yinghu183 发表于 2022-6-23 17:42
你的办法我试了,行不通。。。

077.PNG

原来用的时候就这么着的,当时能用
回复

使用道具 举报

39

主题

477

帖子

2689

积分

金牌会员

Rank: 6Rank: 6

积分
2689
金钱
2212
HASS币
10
 楼主| 发表于 2022-6-23 19:56:07 | 显示全部楼层
s2233 发表于 2022-6-23 19:18
原来用的时候就这么着的,当时能用

我的zigbee是装在树莓派上的,我看了日志,提醒我找不到什么什么模块,然后我到github上下载了放在zigbee相应路径中还是不行。。。
回复

使用道具 举报

39

主题

477

帖子

2689

积分

金牌会员

Rank: 6Rank: 6

积分
2689
金钱
2212
HASS币
10
 楼主| 发表于 2022-6-23 20:06:37 | 显示全部楼层
s2233 发表于 2022-6-23 19:18
原来用的时候就这么着的,当时能用

你看日志,又说找不奥module'lib/exposes',你有这个模块吗,是在哪个文件夹里的呢
Jun 23 20:04:59 raspberrypi npm[27933]:   ^
Jun 23 20:04:59 raspberrypi npm[27933]: Error: Cannot find module 'lib/exposes'
Jun 23 20:04:59 raspberrypi npm[27933]: Require stack:
Jun 23 20:04:59 raspberrypi npm[27933]: - /opt/zigbee2mqtt/dist/util/utils.js
Jun 23 20:04:59 raspberrypi npm[27933]: - /opt/zigbee2mqtt/dist/util/settings.js
Jun 23 20:04:59 raspberrypi npm[27933]: - /opt/zigbee2mqtt/index.js

回复

使用道具 举报

0

主题

70

帖子

926

积分

高级会员

Rank: 4

积分
926
金钱
856
HASS币
0
发表于 2022-6-23 21:26:25 | 显示全部楼层
把这段去掉应该就可以了ota: ota.zigbeeOTA,
回复

使用道具 举报

8

主题

361

帖子

3725

积分

论坛元老

Rank: 8Rank: 8

积分
3725
金钱
3364
HASS币
10
发表于 2022-6-23 21:31:45 | 显示全部楼层
yinghu183 发表于 2022-6-23 20:06
你看日志,又说找不奥module'lib/exposes',你有这个模块吗,是在哪个文件夹里的呢

...

抱歉 我已经转用ZHA了
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-26 11:37 , Processed in 4.621712 second(s), 34 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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