【发布时间】:2019-09-16 23:56:08
【问题描述】:
我已经安装了一个插件来通过我的 Homebridge 服务器控制我的三星电视 (https://github.com/xeenon/homebridge-samsung-tv),但是开发人员没有提供 config-sample.json,因此我尝试自己制作。我对编码完全陌生,所以请告诉我我做错了什么。
这是我目前该配件的配置文件的一部分(稍后我将添加 ip 地址和 mac 地址)。
{
"bridge": {
"name": "Homebridge",
"username": "",
"port": 4318,
"pin": "031-45-154"
},
"accessories": [{
"accessory": "samsungTv",
"name": "samsungTvAccessory",
"ip_address": "",
"macAddress": "",
"polling": "true",
"pollingInterval": "1"
}]
}
当我尝试启动 Homebridge 时出现错误
TypeError: Cannot read property 'forEach' of undefined
at new SamsungTvAccessory (usr/local/lib/node_modules/homebridge-samsung-tv-controller/index.js:76:10
如果我将配置文件更改为
{
"bridge": {
"name": "Homebridge",
"username": "",
"port": 4318,
"pin": "031-45-154"
},
"accessories": [{
"accessory": "samsungTv",
"name": "samsungTvAccessory",
"ip_address": "",
"macAddress": "",
"polling": "true",
"pollingInterval": "1",
"enabledInputs": "true"
}]
}
我添加的地方
"enabledInputs": "true"
我得到了错误
TypeError: config.enabledInputs.forEach is not a function
at new SamsungTvAccessory (usr/local/lib/node_modules/homebridge-samsung-tv-controller/index.js:76:10
非常感谢任何帮助!
【问题讨论】: