joeyhage / homebridge-alexa-smarthome

Connect Alexa devices to HomeKit
MIT License
62 stars 20 forks source link

Draft: Add support for Doors #123

Open fr3nch13 opened 2 months ago

fr3nch13 commented 2 months ago

Description

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

Type of change

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

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.

fr3nch13 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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.