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

Alexa Routines no longer working #761

Open
rfiorentino1 opened this issue Jan 8, 2025 · 19 comments
Open

Alexa Routines no longer working #761

rfiorentino1 opened this issue Jan 8, 2025 · 19 comments
Labels

Comments

@rfiorentino1
Copy link

rfiorentino1 commented Jan 8, 2025

Analysis

Up until sometime yesterday, everything was working beautifully with this plugin. As far as I know, nothing changed yesterday on my end, no updates, etc. However, though Alexa can control homebridge devices, all routines have stopped working, and all contact sensors for triggering them are gone/won't come back. Everything looks fine in the plugin and in homebridge, the cloud service Alexa contact sensor is closed, etc. I've unlinked and re-linked, rediscovered devices, even tried downgrading the alexa plugin and the dummy contact plugin, all to no avail. Though when I downgraded dummy contact, Alexa re-discovered all of the contact sensors, but still didn't allow them to be routine triggers. I deleted a few of them and re-discovered again, no luck. I also thought about restoring from a homebridge backup, but for some reason the UI has decided to stop backing up my instances completely.......so, that wasn't an option either. lol

When I turned on the debug mode inside the plugin, I did notice that it started saying contact sensor not detected, so not sure what that's about. Just hoping I don't have to redo all of my routines one by one :)

Expected Behavior

Alexa sees all devices I've specified as contact sensors as available triggers for routines.

Steps To Reproduce

  1. Setup the plugin as normal, link account etc.
  2. Add contact sensors, and enable the routines option in plugin config. (I've also tried toggling this with no luck)
  3. Alexa will not see the contact sensors as routine triggers, though they are seen as separate devices.

Logs

log is too long, uploaded as attachment

Configuration

{
            "name": "Alexa",
            "username": "********",
            "password": "********",
            "pin": "***-**-***",
            "routines": true,
            "blind": true,
            "door": true,
            "debug": true,
            "deviceCleanup": true,
            "refresh": 3600,
            "keepalive": 5,
            "thermostatTurnOn": 3,
            "CloudTransport": "mqtts",
            "deviceListHandling": "allow",
            "deviceList": [
                "Garage Door",
                "DummyLock",
                "Play Everywhere",
                "Play Inside",
                "Back Porch",
                "Kitchen",
                "Living Room",
                "Master Bedroom",
                "Tornado Warning",
                "TV Audio",
                "Doorbell trigger",
                "Washer done",
                "Dryer done",
                "G door Announcement",
                "Entry Delay",
                "Back porch shuffle",
                "Apple TV",
                "Disarm Error",
                "Disarm home",
                "Sleeping",
                "Hannah"
            ],
            "platform": "Alexa"
        },

Environment

  • OS: Synology DSM
  • Software: Homebridge 1.8.5, plugin version 0.8.2
  • Node: v20
  • npm:

Process Supervisor

hb-service

Additional Context

Not entirely related to this bug, but is there a way to speed up response time between when Alexa is aware of a device state change?
homebridge-alexa.log

@rfiorentino1
Copy link
Author

I can also upload the JSON file created from the debug output if that would be helpful :)

@NorthernMan54
Copy link
Owner

Sorry, just saw this now

The json file created with debug enabled during startup contains your device config that is being shared with Amazon.

Pls share that, and you can also view it with a text editor as well

Pls also share the names of your devices you want as contact sensor, so I know which devices in the config to look at.

PS - Response time of routine triggers - if you look at your log I can see that Alexa is occasionally throttling your events as too many as being sent at the same time. Do you have devices sending events too often or flapping

@rfiorentino1
Copy link
Author

No worries, all good, thank you for responding so quickly, I really appreciate it. Interesting that Amazon is throttling my requests sometimes, I've never really looked that closely at the logs but also never noticed anything negative impact on functionality lol. The only thing I could think of that might be causing that is that I have quite a few dummy switches/sensors that are stateless, and turn off after like 1000 MS etc? I don't have the full list of contact sensors off the top of my head but can easily pull that from config tomorrow if needed; a few I can remember are: entry delay, hannah arriving, dryer done, washer done, etc. Thanks so much again.

homebridge-alexa-discovery.json

@NorthernMan54
Copy link
Owner

I parsed the discovery response with cat homebridge-alexa-discovery-2.json | egrep "friendlyName|_SENSOR"

And received this

     "friendlyName": "Back Porch",
          "friendlyName": "Kitchen",
          "friendlyName": "Living Room",
          "friendlyName": "Master Bedroom",
          "friendlyName": "Apple TV",
          "friendlyName": "Back Porch Coordinator",
          "friendlyName": "Back porch shuffle",
          "friendlyName": "Back porch shuffle",
            "CONTACT_SENSOR"
          "friendlyName": "Disarm Error",
          "friendlyName": "Disarm Error",
            "CONTACT_SENSOR"
          "friendlyName": "Disarm home",
          "friendlyName": "Disarm home",
            "CONTACT_SENSOR"
          "friendlyName": "Doorbell trigger",
          "friendlyName": "Doorbell trigger",
            "CONTACT_SENSOR"
          "friendlyName": "Dryer done",
          "friendlyName": "Dryer done",
            "CONTACT_SENSOR"
          "friendlyName": "Entry Delay",
          "friendlyName": "Entry Delay",
            "CONTACT_SENSOR"
          "friendlyName": "G door Announcement",
          "friendlyName": "G door Announcement",
            "CONTACT_SENSOR"
          "friendlyName": "Group Back Porch",
          "friendlyName": "Group Kitchen",
          "friendlyName": "Group Living Room",
          "friendlyName": "Group Master Bedroom",
          "friendlyName": "Hannah Sleeping",
          "friendlyName": "Hannah Sleeping",
            "CONTACT_SENSOR"
          "friendlyName": "Hannah arrives",
          "friendlyName": "Hannah arrives",
            "CONTACT_SENSOR"
          "friendlyName": "Hannah home",
          "friendlyName": "Hannah leaves",
          "friendlyName": "Hannah leaves",
            "CONTACT_SENSOR"
          "friendlyName": "Kitchen Announcements",
          "friendlyName": "Kitchen Announcements",
            "CONTACT_SENSOR"
          "friendlyName": "Kitchen shuffle",
          "friendlyName": "Kitchen shuffle",
            "CONTACT_SENSOR"
          "friendlyName": "Living Room shuffle",
          "friendlyName": "Living Room shuffle",
            "CONTACT_SENSOR"
          "friendlyName": "Master Bedroom announcements",
          "friendlyName": "Master Bedroom announcements",
            "CONTACT_SENSOR"
          "friendlyName": "Master Bedroom shuffle",
          "friendlyName": "Master Bedroom shuffle",
            "CONTACT_SENSOR"
          "friendlyName": "Play Everywhere",
          "friendlyName": "Play Inside",
          "friendlyName": "Sleeping",
          "friendlyName": "TV Audio",
          "friendlyName": "TV Audio",
            "CONTACT_SENSOR"
          "friendlyName": "Tornado Warning",
          "friendlyName": "Washer done",
          "friendlyName": "Washer done",
            "CONTACT_SENSOR"
          "friendlyName": "Back Porch Sonos",
          "friendlyName": "Back Porch Speakers",
          "friendlyName": "Kitchen Sonos",
          "friendlyName": "Kitchen Speakers",
          "friendlyName": "Living Room Sonos",
          "friendlyName": "Living Room Speakers",
          "friendlyName": "Master Bedroom Sonos",
          "friendlyName": "Master Bedroom Speakers",
          "friendlyName": "Kitchen Kitchen Motion",
            "MOTION_SENSOR"
          "friendlyName": "Kitchen Kitchen Person",
            "MOTION_SENSOR"
          "friendlyName": "Kitchen Kitchen Sound",
            "MOTION_SENSOR"
          "friendlyName": "Kitchen Kitchen Streaming",

So the motion and contact sensors are being shared with Alexa, and should work okay. The only thing I see on first pass is that the names are duplicated around the sensors. Which should be okay, as one is the switch, and the other is the contact sensor.

I'm going to take your discovery file, and run it thru alexa to ensure that it can be properly processed. Give me a day.

PS You asked about contact sensor not detected and this is how an open contact sensor is reported to Alexa. A closed contact sensor is marked as detected.

@rfiorentino1
Copy link
Author

Interesting. So technically, everything should work as expected. Glad I'm not crazy lol :-) thank you for the quick response again. Technically, I can still see the statuses of everything correctly in the Alexa app, so like if I turn on a switch through Homebridge I can see that it's on in Alexa and vice versa. But it's just like the routines checkbox in the config isn't being honored anymore, and all routines that used to be triggered by a contact sensor are grade out and want me to pick a new device, because all the contact sensors are gone for the available triggers for routines. Just strange

@NorthernMan54
Copy link
Owner

So I uploaded your discovery file to our test account, so I could confirm if it was properly structured etc, and your settings, and was able to create routines for your devices.

IMG_8630

IMG_8631

IMG_8632

So I'm stumped....

Is it possible that you need to ask Alexa to discover devices again, and you have duplicate devices for these ?

@rfiorentino1
Copy link
Author

Lol I'm also stumped… Because I linked my homebridge.ca account to a different Alexa account with the skill, and that account also would not work with routines. All the devices were discovered, and I can see the contact sensors changing from open to closed etc. but none of them will appear as routine triggers. I also deleted a few of the devices and their duplicates from my original account and rediscovered them, and still no joy. I just can't figure out what changed if anything

@NorthernMan54
Copy link
Owner

Can you try the previous major version 0.7.1, in case a recent change is the trigger ?

https://github.com/NorthernMan54/homebridge-alexa/releases/tag/0.7.1

@rfiorentino1
Copy link
Author

OK, interesting, that worked! It brought all my devices back and I can see them as triggered for routines etc. Do you want me to try going up each released version at a time and see where it breaks? Or try going directly back to the latest one and see what happens? The thing is, I remember updating the plug-in, but don't remember noticing any immediate changes after the update lol. But, interestingly, it almost seemed like the routines were still working but the app couldn't see them as triggers anymore. So maybe that's why I didn't notice, because I didn't create a routine for a little while after updating the plug-in… Not sure if that makes sense lol

@NorthernMan54
Copy link
Owner

My suspicion is that the new device cleanup feature is removing / cleaning up your device by mistake.

The feature is designed to remove devices that are not responding, and I wonder if the plugin thinks you sensors are not responding.

try updating to the latest and set ‘deviceCleanup’ to false. This will disable the feature.

@rfiorentino1
Copy link
Author

I thought about that too, but I had disabled it before and restarted it with no luck. But I think that was because it had already loaded the new version with that feature on, and already decided that those devices were invalid or not responding etc. I've just updated to latest And disabled cleanup and everything seems to still be normal. I'll keep you posted if anything changes in the next few days, but I feel like it would happen immediately? If you want, I can try and enable the feature and restart homebridge and see if they disappear again

Out of curiosity, what is the plug-in's criteria for figuring out whether a device is responding or not, and how does it clean it up? Can it actually delete the device from the Alexa app itself? If that's the case, none of them were deleted, they just weren't showing up as routine triggers anymore.

@NorthernMan54
Copy link
Owner

The cleanup works like this

A request is received from Alexa, and if the plugin can not find that instance of Homebridge. It then sends an error back and sends a second message saying delete that device.

I found that my account was littered with devices from years of coding, and rather than delete each individually thru the Alexa app I just added this feature.

@rfiorentino1
Copy link
Author

rfiorentino1 commented Jan 14, 2025

Cool. I assumed it's purpose was something like that, and I also assumed that if you changed names of things in Homebridge or deleted old plug-ins that Alexa had discovered etc. it would deal with all of those cases as well. OK, so then if it's linked to the actual Homebridge instance, theoretically it should've deleted all of my devices completely, not just their ability to be triggered by routines, if it was seeing them as unresponsive. Correct? Interesting… Is there a log that would indicate whether it's cleaning them up or not? Because now, when playing with this, a whole bunch of duplicate devices were created for the switches/contact sensors when I took dummy contact down to a different version and back up again. I would love for them to all be deleted without me having to manually do it one by one lol. But at this point, everything seems to still work as expected, and that makes me happy

@NorthernMan54
Copy link
Owner

In debug mode the delete messages are logged under sending message with the following

     "namespace": "Alexa.Discovery",
        "name": "DeleteReport",

For the first pass I only wired in one Homebridge error into the delete process to reduce the likelihood of causing problems. So it may not trigger in all cases

@brsexton
Copy link

Hello. I am having a similar issue. My existing routines are still working, but I cannot create additional ones. I have several dummy switches/contacts using the [homebridge-dummy-contact] plugin. Any new contact sensors I create don't show up as a trigger in Alexa routines. They show up in devices, but not under routines. Do you have any suggestions for that issue?

@NorthernMan54
Copy link
Owner

@brsexton pls try version 0.7.1

@rfiorentino1
Copy link
Author

Interesting; @brsexton even though the routines still work, do they show as great out in the Alexa app? If you go back to 0.7.1, does it fix the issue? If so, if you then update to the latest again, and turn off cleanup devices before restarting Homebridge after the update, does it continue to work?

@brsexton
Copy link

@NorthernMan54 - Downgrading to 0.7.1 resolved the issue for me. Thanks for your help. I assume this will be resolved in a future release?

@rfiorentino1 - After I downgraded and got all of my contacts back in routines, I upgraded the plugin again, without selecting the cleanup option, and all of the newer contacts disappeared from Alexa routines again. So it doesn't matter if cleanup is selected or not.

@NorthernMan54
Copy link
Owner

Tks for the feedback on this release. Let me dig into it deeper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants