Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected some logic errors and added support for the Kogan opener. #198

Merged
merged 1 commit into from
Feb 15, 2021

Conversation

davidh2075
Copy link
Contributor

The changes made were:

  • Added test for Kogan manufacturer and changed log messages prefix to TuyaAccessory with manufacturer name. Set the dpAction and dpStatus values based on the manufacturer.
  • Changed _getCurrentDoorState to use dps or changes as the argument and test for a Kogan opener then return manufacturer-specific values.
  • Added a debug flag (name/value pair in the configuration) and debug log function _debugLog(). Replaced all console.log() calls with _debugLog() calls. The debug flag values are true and false and default to false if not present in the configuration.
  • Added the Kogan fopen and fclose commands to _getTargetDoorState.
  • Changed calls to _getCurrentDoorState() to use the dpStatus value either directly or via dps[this.dpStatus] or changes[this.dpStatus] instead of dps and state.
  • In _getTargetDoorState(), changed from Action values to Status values.
  • Added a status variant with the correct spelling for 'opening' in case Kogan to decide to correct the incorrect spelling 'openning’.
  • Corrected generic garage door to use true and false for open/close and opened/closed.
  • Removed the code that infers for generic doors the opening and closing states from dpStatus and dpAction, as the dpAction value is now unavailable in _getCurrentDoorState().

…he changes made were as follows. Added test for Kogan manufacturer and changed log messages prefix to TuyaAccessory with manufacturer name. Set the dpAction and dpStatus values based on the manufacturer. Changed _getCurrentDoorState to use dps or changes as the argument and test for a Kogan opener then return manufacturer-specific values. Added a debug flag (name/value pair in the configuration) and debug log function _debugLog(). Replaced all console.log() calls with _debugLog() calls. The debug flag values are true and false and default to false if not present in the configuration. Added the Kogan fopen and fclose commands to _getTargetDoorState. Changed calls to _getCurrentDoorState() to use the dpStatus value either directly or via dps[this.dpStatus] or changes[this.dpStatus] instead of dps and state. In _getTargetDoorState(), changed from Action values to Status values. Added a status variant with the correct spelling for 'opening' in case Kogan to decide to correct the incorrect spelling 'openning’. Corrected generic garage door to use true and false for open/close and opened/closed. Removed the code that infers for generic doors the opening and closing states from dpStatus and dpAction, as the dpAction value is now unavailable in _getCurrentDoorState().
@mayankue2
Copy link

has anyone dealt with Connect Garage Door Openers? I am using Smart Life app to manage it but would love to see that being able to control using HomeKit. I am new to HomeBridge so don't know how to upload .js file but tried using the code from this script into the current plugin that I am using but it hasn't worked. thank you

@davidh2075
Copy link
Contributor Author

I haven't used the Connect Garage Door Opener. It looks physically the same as the Kogan, however this post suggests that there may be some differences.

Have you tried setting "manufacturer": "Kogan" as in the sample configuration below? The code I added (and that @iRayanKhan fixed :-) ) for the Kogan opener depends on the manufacturer attribute.

{
    "platform": "Tuya",
    "devices": [
        {
            "name": "Garage Door",
            "type": "GarageDoor",
            "manufacturer": "Kogan",
            "model": "SmarterHome Wireless Garage Door Opener",
            "id": "blah",
            "key": "blahblah",
            "dpAction": 101,
            "dpStatus": 102,
            "flipState": false,
            "debug": false
        }
    ]
}

@mayankue2
Copy link

I haven't used the Connect Garage Door Opener. It looks physically the same as the Kogan, however this post suggests that there may be some differences.

Have you tried setting "manufacturer": "Kogan" as in the sample configuration below? The code I added (and that @iRayanKhan fixed :-) ) for the Kogan opener depends on the manufacturer attribute.

{
    "platform": "Tuya",
    "devices": [
        {
            "name": "Garage Door",
            "type": "GarageDoor",
            "manufacturer": "Kogan",
            "model": "SmarterHome Wireless Garage Door Opener",
            "id": "blah",
            "key": "blahblah",
            "dpAction": 101,
            "dpStatus": 102,
            "flipState": false,
            "debug": false
        }
    ]
}

Thank you [davidh2075], I tried this but this didn't work unfortunately.

pauldev20 pushed a commit to pauldev20/homebridge-tuya that referenced this pull request Jun 11, 2024
Corrected some logic errors and added support for the Kogan opener.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants