iRayanKhan / homebridge-tuya

A Homebridge plugin to control Tuya devices locally.
MIT License
403 stars 167 forks source link

TypeError: this._isBelleLife is not a function #444

Closed pespinel closed 6 months ago

pespinel commented 9 months ago

Checklist

Describe the bug

/var/lib/homebridge/node_modules/homebridge-tuya/lib/SimpleBlindsAccessory.js:49
        else if (this._isBelleLife()) {
                      ^
TypeError: this._isBelleLife is not a function
    at SimpleBlindsAccessory._registerCharacteristics (/var/lib/homebridge/node_modules/homebridge-tuya/lib/SimpleBlindsAccessory.js:49:23)
    at TuyaAccessory.<anonymous> (/var/lib/homebridge/node_modules/homebridge-tuya/lib/BaseAccessory.js:22:18)
    at Object.onceWrapper (node:events:633:26)
    at TuyaAccessory.emit (node:events:518:28)
    at TuyaAccessory._change (/var/lib/homebridge/node_modules/homebridge-tuya/lib/TuyaAccessory.js:409:18)
    at TuyaAccessory._msgHandler_3_3 (/var/lib/homebridge/node_modules/homebridge-tuya/lib/TuyaAccessory.js:335:30)
    at /var/lib/homebridge/node_modules/homebridge-tuya/node_modules/async/dist/async.js:4018:13
    at Object.process (/var/lib/homebridge/node_modules/homebridge-tuya/node_modules/async/dist/async.js:1681:21)
    at /var/lib/homebridge/node_modules/homebridge-tuya/node_modules/async/dist/async.js:1533:23
    at /var/lib/homebridge/node_modules/homebridge-tuya/node_modules/async/dist/async.js:74:45
[05/02/2024, 15:59:23] [homebridge-tuya] Child bridge process ended

To Reproduce Steps to reproduce the behavior: Update to the version 3.1.0 and start the child bridge.

Expected behavior The child bridge should start without errors

Screenshots N/A

Environment (please complete the following information):

Additional context Add any other context about the problem here.

pespinel commented 9 months ago

https://github.com/iRayanKhan/homebridge-tuya/blob/95789f8926a55552d858645e6dbb92613f6d663b/lib/SimpleBlindsAccessory.js#L49

I think that this should be:

else if (this._isType2()) {

pespinel commented 9 months ago

The issue was introduced in this PR: https://github.com/iRayanKhan/homebridge-tuya/pull/264. I don't have permission to propose a fix in a PR.

05TEVE commented 9 months ago

@pespinel ,you should be able to raise a fork on your own account and create a PR with the changes. Unfortunately, due to the amount of the time between updates and the huge number of changes introduced between the two versions this was included. Hopefully future updates shouldn't have this sort of issue.

pespinel commented 9 months ago

@05TEVE I've tried the fix with the 3.1.1 beta 1 and now the process ends for another reason:

/var/lib/homebridge/node_modules/homebridge-tuya/lib/SimpleBlindsAccessory.js:85
        this.cmdOpen = _cmdOpen;
                       ^
ReferenceError: _cmdOpen is not defined
    at SimpleBlindsAccessory._registerCharacteristics (/var/lib/homebridge/node_modules/homebridge-tuya/lib/SimpleBlindsAccessory.js:85:24)
    at TuyaAccessory.<anonymous> (/var/lib/homebridge/node_modules/homebridge-tuya/lib/BaseAccessory.js:22:18)
    at Object.onceWrapper (node:events:633:26)
    at TuyaAccessory.emit (node:events:518:28)
    at TuyaAccessory._change (/var/lib/homebridge/node_modules/homebridge-tuya/lib/TuyaAccessory.js:409:18)
    at TuyaAccessory._msgHandler_3_3 (/var/lib/homebridge/node_modules/homebridge-tuya/lib/TuyaAccessory.js:335:30)
    at /var/lib/homebridge/node_modules/homebridge-tuya/node_modules/async/dist/async.js:4018:13
    at Object.process (/var/lib/homebridge/node_modules/homebridge-tuya/node_modules/async/dist/async.js:1681:21)
    at /var/lib/homebridge/node_modules/homebridge-tuya/node_modules/async/dist/async.js:1533:23
    at /var/lib/homebridge/node_modules/homebridge-tuya/node_modules/async/dist/async.js:74:45
05TEVE commented 9 months ago

@pespinel, i pushed a change that at least gets the plugin running 3.1.1-beta.2. Looks like a heap of changes where merged in for the blinds modules for the unreleased 2.1.0 version. I am not sure what testing was done on the changes unfortunately.

pespinel commented 9 months ago

@05TEVE After upgrading to the 3.1.1.-beta.2 the process is starting without issues but unfortunately, the actions are not working anymore even the logs shows that the blinds are "opening" and "closing" without errors. Do you want to treat this in another issue and close this one?

Thanks

05TEVE commented 9 months ago

Let's leave this one open so everything is in one place. 🙂 I guess we can either revert back the previous version or fix this one? I think the changes were made by @ElphaX but never made a release so I am not sure whether the changes were fully tested.

05TEVE commented 9 months ago

@pespinel I have tried reverting back the changes made in https://github.com/iRayanKhan/homebridge-tuya/pull/264. This should put everything back to how it was in 2.0.1. Can you test 3.1.1-beta.4 and let me know how you go?

pespinel commented 9 months ago

@05TEVE I've been testing this version during this morning and it seems to be working pretty fine. Thanks

05TEVE commented 9 months ago

Hi @pespinel , based on the feedback from #451 I have updated the files again. Are you able to confirm whether it is still working on the new version?

pespinel commented 9 months ago

Hi @pespinel , based on the feedback from #451 I have updated the files again. Are you able to confirm whether it is still working on the new version?

With version 3.1.1-beta.5 it's not working again.

The child bridge starts with no problem but the commands don't do anything.

05TEVE commented 9 months ago

HI @pespinel,

Can you try 3.1.1-beta.9 with an extra variable in the config. "dpBlindType": 3

It seems like there are multiple different types of blind config that can be used. This should hopefully allow that to be configured correctly. Apologies for the inconvenience here. Unfortunately I don't have any of the blind devices so it is a bit hard to test fully.

pespinel commented 9 months ago

Hi @05TEVE

Sorry for the delay, I've been busy these days. I tested it by adding the configuration you mentioned and it seems to be working fine:

{
    "_bridge": {
        "name": "tuya-bridge",
        "username": "XXYY",
        "port": 58632
    },
    "platform": "TuyaLan"
    "devices": [
        {
            "type": "SimpleBlinds",
            "name": "Persiana dormitorio",
            "id": "XXYY",
            "key": "XXYY",
            "manufacturer": "Loratap",
            "model": "SC500W",
            "timeToOpen": 13,
            "timeToTighten": 2,
            "dpBlindType": 3
        },
        ...
    ]
}
05TEVE commented 8 months ago

Awesome. That is great news! I'll add the change into the upcoming 3.1.1 release.