joeyhage / homebridge-alexa-smarthome

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

Door Lock state updates in HomeKit, but can't control it #66

Closed rfiorentino1 closed 8 months ago

rfiorentino1 commented 11 months ago

Describe The Bug:

I've installed/configured this plugin according to the ReadMe, and unlike the other recent issues I've seen, everything seems to be fine for me, cookie successful and devices appearing. :) However, when I try to control my door lock through HomeKit, it says no response and produces the log below. If I control it from Alexa, or manually, the state updates in the home app.

To Reproduce: Add a door lock to Alexa through a compatible manufacturer. (Mine is Level.) Turn on unlock by app and unlock by voice in the Alexa app. Lock/unlock the door through Alexa, and through HomeKit via this plugin.

Expected behavior:

The door should lock/unlock regardless of method, and report it's state to both Alexa and HomeKit.

Logs:

[10/30/2023, 2:55:29 PM] [HomebridgeAlexaSmartHome] Front Door - Set target lock state - HttpError(Error setting smart home device state. Reason: Timeout) [10/30/2023, 2:55:30 PM] [HomebridgeAlexaSmartHome] Front Door - Set target lock state - RequestUnsuccessful(Error setting smart home device state. Response: {  "controlResponses": [],  "errors": [  {  "entity": {  "entityId": "68964737-3c2c-406b-b944-e2aeca9002c6",  "entityType": "APPLIANCE"  },  "code": "IotaServiceException",  "message": "ALREADY_IN_OPERATION",  "data": null  }  ] }. Error code: IotaServiceException) [10/30/2023, 2:55:33 PM] [HomebridgeAlexaSmartHome] Front Door - Set target lock state - RequestUnsuccessful(Error setting smart home device state. Response: {  "controlResponses": [],  "errors": [  {  "entity": {  "entityId": "68964737-3c2c-406b-b944-e2aeca9002c6",  "entityType": "APPLIANCE"  },  "code": "IotaServiceException",  "message": "ALREADY_IN_OPERATION",  "data": null  }  ] }. Error code: IotaServiceException) 

Plugin Config:

    {
        "devices": [
            "Front Door"
        ],
        "auth": {
            "refreshInterval": 4,
            "proxy": {
                "clientHost": "192.168.1.238",
                "port": 9000
            }
        },
        "amazonDomain": "amazon.com",
        "language": "en-US",
        "performance": {
            "cacheTTL": 30,
            "backgroundRefresh": false
        },
        "debug": false,
        "platform": "HomebridgeAlexaSmartHome"
    }

Environment:

rfiorentino1 commented 11 months ago

Interestingly, I changed the device state cash lifetime to 15 and also played with enabling/disabling the refresh in background option, and it seems to control the physical lock now, but the state still does not update accurately.

rfiorentino1 commented 11 months ago

Anytime I close and re-open the Home app, the state seems to be updated correctly. But while in the home app, if I lock/unlock the door, it successfully completes but doesn't change the state until I restart the home app. This doesn't seem to matter whether or not I have background refresh on or off, or the amount of time specified for device cache state.

rfiorentino1 commented 11 months ago

This is the current debug log, which looks normal to me so I'm not sure where to start digging.



[10/30/2023, 10:30:10 PM] Registering platform 'homebridge-alexa-smarthome.HomebridgeAlexaSmartHome'
[10/30/2023, 10:30:16 PM] [HomebridgeAlexaSmartHome] Initializing HomebridgeAlexaSmartHome platform...
[10/30/2023, 10:30:16 PM] [HomebridgeAlexaSmartHome] Loading accessory from cache: Front Door
[10/30/2023, 10:30:17 PM] [HomebridgeAlexaSmartHome] Alexa-Remote: cookie was provided
[10/30/2023, 10:30:19 PM] [HomebridgeAlexaSmartHome] Alexa-Remote: Authentication checked: true
[10/30/2023, 10:30:20 PM] [HomebridgeAlexaSmartHome] Alexa-Remote: Change Base URL for API calls to na-api-alexa.amazon.com
[10/30/2023, 10:30:24 PM] [HomebridgeAlexaSmartHome] Successfully authenticated Alexa account.
[10/30/2023, 10:30:25 PM] [HomebridgeAlexaSmartHome] Found 158 devices connected to the current Alexa account.
[10/30/2023, 10:30:25 PM] [HomebridgeAlexaSmartHome] BEGIN devices connected to Alexa account
[10/30/2023, 10:30:25 PM] [HomebridgeAlexaSmartHome] Found all 1 devices in plugin settings.
[10/30/2023, 10:30:25 PM] [HomebridgeAlexaSmartHome] Updating device states
[10/30/2023, 10:30:25 PM] [HomebridgeAlexaSmartHome] Front Door ::: Attempting to add accessory(s) for device: {
[10/30/2023, 10:30:25 PM] [HomebridgeAlexaSmartHome] Front Door ::: Current state: [
[10/30/2023, 10:30:25 PM] [HomebridgeAlexaSmartHome] Front Door ::: Range capabilities: {}
[10/30/2023, 10:30:25 PM] [HomebridgeAlexaSmartHome] Restored existing accessory from cache: Front Door
[10/30/2023, 10:30:31 PM] [HomebridgeAlexaSmartHome] Obtained device states from cache
[10/30/2023, 10:30:31 PM] [HomebridgeAlexaSmartHome] Front Door - Get lock state result: 1
[10/30/2023, 10:30:31 PM] [HomebridgeAlexaSmartHome] Obtained device states from cache
[10/30/2023, 10:30:31 PM] [HomebridgeAlexaSmartHome] Front Door - Get lock target state result: 1
[10/30/2023, 10:30:42 PM] [HomebridgeAlexaSmartHome] Front Door - Triggered set target lock state: 0
[10/30/2023, 10:31:09 PM] [HomebridgeAlexaSmartHome] Front Door - Triggered set target lock state: 1
[10/30/2023, 10:31:25 PM] [HomebridgeAlexaSmartHome] Updating device states
[10/30/2023, 10:32:25 PM] [HomebridgeAlexaSmartHome] Updating device states
[10/30/2023, 10:33:26 PM] [HomebridgeAlexaSmartHome] Updating device states
[10/30/2023, 10:34:26 PM] [HomebridgeAlexaSmartHome] Updating device states
[10/30/2023, 10:35:27 PM] [HomebridgeAlexaSmartHome] Updating device states
joeyhage commented 8 months ago

Seems I missed this issue awhile ago, apologies. The plugin only updates at most every 60 seconds so that may be why you needed to close and reopen the home app to see the change. I'm going to close this issue because that is expected but I will take this into consideration if there are ways to improve that. Thanks!