iRayanKhan/homebridge-tuya

TypeError: this._isBelleLife is not a function

pespinel opened this issue ยท 14 comments

Checklist

  • I have read the common issues wiki page
  • I have checked to make sure the plugin is up to date

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):

  • OS: raspbian
  • iOS version: N/A
  • Homehubs: N/A
  • Node Version: 20.11.0
  • Plugin Version: 3.1.0
  • Accessory Type: SimpleBlinds

Additional context
Add any other context about the problem here.

else if (this._isBelleLife()) {

I think that this should be:

else if (this._isType2()) {

The issue was introduced in this PR: #264. I don't have permission to propose a fix in a PR.

@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.

@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

@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.

@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

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.

@pespinel I have tried reverting back the changes made in #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?

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

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?

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.

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.

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
        },
        ...
    ]
}

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