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

Draft: Add support for Doors #123

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

fr3nch13
Copy link

Description

I'm trying to add support for Doors, specifically the Lychee Things SmartSlyder, but I could use some help.

Type of change

  • [X ] New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Currently: testing live locally: % npm run build && npm link && homebridge -I -D
Then watching the output when viewing/triggering via the web frontend at http://localhost:8581/accessories

Checklist:

I'll do this once I have Proof of concept working, but it is currently passing npm run lint && npm run format

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

I'll put code snippets below in the comments of what the Door looks like coming from Alexa, and the error I'm getting when I try to set the state. I could use some help.

I still need to get it to properly report the position state (opening, closing, stopped https://developers.homebridge.io/#/characteristic/PositionState)

Also need to figure out how to properly submit the open/close target.

TODO, remove the console.log()s
@fr3nch13 fr3nch13 requested a review from joeyhage as a code owner April 16, 2024 01:35
@fr3nch13
Copy link
Author

fr3nch13 commented Apr 16, 2024

Output I'm seeing from Alexa:
The UUID is redacted as I'm not sure if it's specific to the product or to my instance specifically:

Support:
Alexa.TemperatureSensor - Not Started - Apparently is has a thermometer installed
Alexa.ToggleController - Not Started - Allows you to run on/off the access for Pet Passes
Alexa.RangeController - On progress - Able to read, Having trouble setting/writing

[4/15/2024, 6:20:23 PM] [HomebridgeAlexaSmartHome] Slider ::: Attempting to add accessory(s) for device: {
  "id": "[UUID REDACTED]",
  "displayName": "Slider",
  "description": "SmartSlydr by LycheeThings",
  "supportedProperties": [
    "turnOff@[UUID REDACTED]_Door.TagControl",
    "turnOn@[UUID REDACTED]b_Door.TagControl",
    "setRangeValue@[UUID REDACTED]_Door.Percent"
  ],
  "supportedTriggers": [],
  "supportedOperations": [
    "turnOff@[UUID REDACTED]_Door.TagControl",
    "turnOn@[UUID REDACTED]_Door.TagControl",
    "setRangeValue@[UUID REDACTED]_Door.Percent"
  ],
  "availability": "AVAILABLE",
  "icon": {
    "@iconType": "SmartHomeApplianceType",
    "value": "DOOR"
  },
  "providerData": {
    "enabled": true,
    "relationships": [],
    "categoryType": "APPLIANCE",
    "deviceType": "DOOR",
    "dmsDeviceIdentifiers": []
  }
}
[4/15/2024, 6:20:23 PM] [HomebridgeAlexaSmartHome] Slider ::: Current state: [
  {
    "namespace": "Alexa.TemperatureSensor",
    "name": "temperature",
    "value": {
      "value": 80.6,
      "scale": "FAHRENHEIT"
    }
  },
  {
    "namespace": "Alexa.ToggleController", <--- Pet Pass
    "name": "toggleState",
    "value": "ON",
    "instance": "Door.TagControl"
  },
  {
    "namespace": "Alexa.RangeController",
    "name": "rangeValue",
    "value": 0,
    "instance": "Door.Percent"
  }
]
[4/15/2024, 6:20:23 PM] [HomebridgeAlexaSmartHome] Slider ::: Range capabilities: {}
{
  id: '[UUID REDACTED]',
  displayName: 'Slider',
  description: 'SmartSlydr by LycheeThings',
  supportedProperties: [
    'turnOff@[UUID REDACTED]_Door.TagControl',
    'turnOn@[UUID REDACTED]_Door.TagControl',
    'setRangeValue@[UUID REDACTED]_Door.Percent'
  ],
  supportedTriggers: [],
  supportedOperations: [
    'turnOff@[UUID REDACTED]_Door.TagControl',
    'turnOn@[UUID REDACTED]_Door.TagControl',
    'setRangeValue@[UUID REDACTED]_Door.Percent'
  ],
  availability: 'AVAILABLE',
  icon: { '@iconType': 'SmartHomeApplianceType', value: 'DOOR' },
  providerData: {
    enabled: true,
    relationships: [],
    categoryType: 'APPLIANCE',
    deviceType: 'DOOR',
    dmsDeviceIdentifiers: []
  }
}
[4/15/2024, 6:20:36 PM] [HomebridgeAlexaSmartHome] Slider - Get door state result: 2
[4/15/2024, 6:20:36 PM] [HomebridgeAlexaSmartHome] Slider - Get door position result: 0
[4/15/2024, 6:20:44 PM] [HomebridgeAlexaSmartHome] Slider - Triggered door position: 100
{ action: 'setRangeValue', rangeValue: '100' }
[4/15/2024, 6:20:44 PM] [HomebridgeAlexaSmartHome] Slider - Set door position - RequestUnsuccessful(Error setting smart home device state. Response: {
  "controlResponses": [],
  "errors": [
    {
      "entity": {
        "entityId": "[UUID REDACTED]",
        "entityType": "APPLIANCE"
      },
      "code": "FAILURE_TO_SEND",
      "message": "JSON payload could not be extracted",
      "data": null
    }
  ]
}. Error code: FAILURE_TO_SEND)
[4/15/2024, 6:20:44 PM] [HomebridgeAlexaSmartHome] Slider - Service communication error

@fr3nch13
Copy link
Author

I'm currently working on the Required Characteristics as defined here, but would like to add the Optional Characteristics if I can get that info from Alexa https://developers.homebridge.io/#/service/Door

@fr3nch13
Copy link
Author

So in emailing with LycheeThings support team, it seems like I may be missing the 'instance' variable in the payload when setting the range value.

@joeyhage joeyhage force-pushed the main branch 2 times, most recently from af779ee to e7fa659 Compare July 8, 2024 01:55
@joeyhage
Copy link
Owner

joeyhage commented Jul 8, 2024

@fr3nch13, thanks for the PR! Sorry I overlooked this. I had to do a pretty major refactor of the plugin to fix some recent issues so this will need a lot of changes if you are still interested in adding door support.

@fr3nch13
Copy link
Author

fr3nch13 commented Jul 8, 2024

Oh ok. Adding support for v3?

@fr3nch13
Copy link
Author

fr3nch13 commented Jul 8, 2024

I'll wait until you have a more stable version of 2.2.0 before trying to add the door. However, I don't mind being a tester/contributor.

@joeyhage
Copy link
Owner

@fr3nch13, v2.2.0 is stable now so go ahead with your contribution when you are ready. Thanks!

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.

2 participants