Closed jeromeanthony closed 3 years ago
This was fixed in 0.0.8. Can you please update and give it go?
I am running 0.0.8 and I still get this error:
/usr/lib/node_modules/homebridge-tuya-ir/src/lib/TuyaAPIHelper.ts:180
cb(body, error);
^
TypeError: Cannot read property 'length' of undefined
at /usr/lib/node_modules/homebridge-tuya-ir/src/lib/TuyaAPIHelper.ts:61:33
at Request._callback (/usr/lib/node_modules/homebridge-tuya-ir/src/lib/TuyaAPIHelper.ts:180:13)
at Request.self.callback (/usr/lib/node_modules/homebridge-tuya-ir/node_modules/request/request.js:185:22)
at Request.emit (events.js:375:28)
at Request.
I have configured only an Air Conditioner Object on the IR blaster.
Thanks for the plugin - hope we can get it working.
There isn’t .length at the line mentioned. So, something is wrong with the version. Can you please try removing and reinstalling the plugin?
Hi,
I uninstalled using the UI-X. Reinstalled using sudo npm install -g homebridge-tuya-ir.
Still the same problem.
I then started removing objects and have confirmed that if I configure the plugin but do not add the sub-devices to "Device Ids of devices added for IR blaster to control" which is what I assume I should be adding, then it no longer has the error about length undefined.
My sub-devices have a string/device ID that is 22 characters when connected to the Europe cloud.
npm list -g
├─┬ homebridge-tuya-ir@0.0.8 │ ├── crypto-js@4.0.0 │ └─┬ request@2.88.2 │ ├── aws-sign2@0.7.0 │ ├── aws4@1.11.0 │ ├── caseless@0.12.0 │ ├─┬ combined-stream@1.0.8 │ │ └── delayed-stream@1.0.0 │ ├── extend@3.0.2 │ ├── forever-agent@0.6.1 │ ├─┬ form-data@2.3.3 │ │ ├── asynckit@0.4.0 │ │ ├── combined-stream@1.0.8 deduped │ │ └── mime-types@2.1.31 deduped │ ├─┬ har-validator@5.1.5 │ │ ├─┬ ajv@6.12.6 │ │ │ ├── fast-deep-equal@3.1.3 │ │ │ ├── fast-json-stable-stringify@2.1.0 │ │ │ ├── json-schema-traverse@0.4.1 │ │ │ └─┬ uri-js@4.4.1 │ │ │ └── punycode@2.1.1 deduped │ │ └── har-schema@2.0.0 │ ├─┬ http-signature@1.2.0 │ │ ├── assert-plus@1.0.0 │ │ ├─┬ jsprim@1.4.1 │ │ │ ├── assert-plus@1.0.0 deduped │ │ │ ├── extsprintf@1.3.0 │ │ │ ├── json-schema@0.2.3 │ │ │ └─┬ verror@1.10.0 │ │ │ ├── assert-plus@1.0.0 deduped │ │ │ ├── core-util-is@1.0.2 │ │ │ └── extsprintf@1.3.0 deduped │ │ └─┬ sshpk@1.16.1 │ │ ├─┬ asn1@0.2.4 │ │ │ └── safer-buffer@2.1.2 deduped │ │ ├── assert-plus@1.0.0 deduped │ │ ├─┬ bcrypt-pbkdf@1.0.2 │ │ │ └── tweetnacl@0.14.5 deduped │ │ ├─┬ dashdash@1.14.1 │ │ │ └── assert-plus@1.0.0 deduped │ │ ├─┬ ecc-jsbn@0.1.2 │ │ │ ├── jsbn@0.1.1 deduped │ │ │ └── safer-buffer@2.1.2 deduped │ │ ├─┬ getpass@0.1.7 │ │ │ └── assert-plus@1.0.0 deduped │ │ ├── jsbn@0.1.1 │ │ ├── safer-buffer@2.1.2 │ │ └── tweetnacl@0.14.5 │ ├── is-typedarray@1.0.0 │ ├── isstream@0.1.2 │ ├── json-stringify-safe@5.0.1 │ ├─┬ mime-types@2.1.31 │ │ └── mime-db@1.48.0 │ ├── oauth-sign@0.9.0 │ ├── performance-now@2.1.0 │ ├── qs@6.5.2 │ ├── safe-buffer@5.2.1 │ ├─┬ tough-cookie@2.5.0 │ │ ├── psl@1.8.0 │ │ └── punycode@2.1.1 │ ├─┬ tunnel-agent@0.6.0 │ │ └── safe-buffer@5.2.1 deduped │ └── uuid@3.4.0
The same error occurred to me, so I checked the code.
/dist/lib/TuyaApiHelper.js
...
fetchDevices(deviceId, cb) {
this._apiCall(this.apiHost + `/v1.0/infrareds/${deviceId}/remotes`, "GET", {}, (_body, err) => {
if (err) {
this.log.error("Failed to get remotes device: " + deviceId);
cb([]);
}
else {
var body = JSON.parse(_body);
var devs = [];
if (body.result.length == 0) { // length error line
...
It was an error on line 54 of this file. I checked the body with the console log and found the following output.
{
code: 28841101,
msg: 'No permissions. This API is not subscribed.',
success: false,
t: 1626870269219
}
I guess it's a Tuya API authority issue.
I was able to solve this problem on the Tuya IoT platform.
I found and subscribed to IR Control Hub Open Service. Subscription was free, and this service authorized my project.
My controller is not air conditioner, so it is not supported normally, but the plugin works normally.
It would be nice if the contents were in README. I will make Pull Request after modifying it.
I found and subscribed to IR Control Hub Open Service. Subscription was free, and this service authorized my project.
This resolved my issue.
But is also seems that if you have an IR remote with more than an AC on it, the plugin will fail to render the AC at all.
Thanks for helping resolve the issue.
I found and subscribed to IR Control Hub Open Service. Subscription was free, and this service authorized my project.
This resolved my issue.
But is also seems that if you have an IR remote with more than an AC on it, the plugin will fail to render the AC at all.
Thanks for helping resolve the issue.
The new release should fix this. There was bug that I fixed.
Hi Prasad,
Excited to see this package for Homebridge.
I seem to be getting an error when I am trying to configure my device. Going through some settings, it seems to be related to the device location being "Europe". I get a timeout error instead if I set it to China?
(To confirm, my devices are Europe).
[17/07/2021, 18:29:39] TypeError: Cannot read property 'length' of undefined at /usr/local/lib/node_modules/homebridge-tuya-ir/src/lib/TuyaAPIHelper.ts:61:33 at Request._callback (/usr/local/lib/node_modules/homebridge-tuya-ir/src/lib/TuyaAPIHelper.ts:180:13) at Request.self.callback (/usr/local/lib/node_modules/homebridge-tuya-ir/node_modules/request/request.js:185:22) at Request.emit (events.js:315:20) at Request. (/usr/local/lib/node_modules/homebridge-tuya-ir/node_modules/request/request.js:1154:10)
at Request.emit (events.js:315:20)
at IncomingMessage. (/usr/local/lib/node_modules/homebridge-tuya-ir/node_modules/request/request.js:1076:12)
at Object.onceWrapper (events.js:421:28)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
Would really appreciate your assistance if possible :)
Thanks!