We leave the garage door slightly open on hot days. I have put a contact sensor -- because the GoControl does not get triggered with this small amount -- and this Rule Machine rule to remind me when the door is open:
The rule works but the announcement is repeated twice on each Echo. This started happening in the last couple of months (I think.) Before that it would announce it just once, on each Echo.
The above rule is based on a "similar" rule to announce when the garage door is fully open -- found on this forum. It relies on GoControl's sensor, and that one works just fine (i.e a single announcement for the event).
A few more details.
- I have refreshed -- uninstalled and reinstalled -- to the latest Echo Speaks (v188.8.131.52). I have also gone through the whole Echo Speaks installation process again.
- I also deleted the rule and recreated it
Any suggestions on what might be going on? Please let me know if you need any additional info or logs.
The first thing I'd do is turn on trigger and action logging for your rule so you can see what's going on. That will narrow down the problem. My suspcion is that your contact sensor may be sending two "opened" events in quick succession, esentailly triggering two instances of your rule that could each both ultimately cause an announcement (also in quick succession), but logging will help narrow it down for sure.
If this specifically is the problem, the "Events" page for the contact sensor (Devices > this sensor > Events) will also show double events, but this is more or less a wild guess (based on similar behavior of some of these sensors, however). So you might want to start there just in case, but turning on loggig will likely be the best help otherwise. I'd also verify that a single "speak" command on the individual Alexa device doesn't result in the same behavior if run manually; otherwise, you've ruled the rule out as a probelm and scoped it to the device/Alexa app.
Thank you for your reply! You are right, I am getting multiple triggers.
I have been reading the forum to figure out how to stop the rule from running multiple times tried Private booleans and also Global variables. But, to be honest, I can't seem to figure this out based on the docs.
I spent a bit of time searching for examples in the forum and tried a couple of different ways, but neither one worked. I am pasting an example of my attempt at using a private boolean to guard against multiple invocations of the rule:
And the log snippet, with the private boolean update, which still shows multiple triggers:
And here's a snippet of the log about 20 minutes later:
I have also verified that a single "speak" command is only played once.
If you, or anyone else, can show how to use either private boolean or global variables to guard against multiple invocations of a rule, I will appreciate it. I presume that "local" variables in this case would not make sense?
You can approach this from the rule side, but it would be easier (because you wouldn't have to do that) and better (since this would take care of any app, not just this rule) to approach it from the device side instead. What device (manufacturer/model) is this, and what driver is it using? You may want to check the preferences on the device page, as some have an option to "suppress duplicate events" or similar that were geared towards solving this problem.
@bertabcd1234's approach probably makes more sense.. but here's an example of how I use private boolean to prevent a rule from running more than once.
The z-wave contact sensor I have is this:
And it seems to be using the generic driver for z-wave contact sensore. It's device page shows:
The 'Suppress duplicate contact events?' toggle was NOT on. However, even after having turned it on, I am still getting repeated events:
Thank you for your prompt responses. Really appreciate the helpful community!
I'm assuming you hit "Save Preferences" after enabling "Suppress duplicate events"? If not, make sure you do that before testing. If that doesn't help, I see you have debug logging enabled (keep in mind that it will auto-disable after 30 minutes), so if you look in "Logs," you'll see what Z-Wave commands are getting sent from the device to the hub and what the driver is ultimately parsing into an event. Apparently, whatever the duplicate-event-suppression setting is trying to do isn't accounting for one of these, but the logs will show you what, and perhaps it is something staff could fix if they know what (you'd be looking for something in the logs like "BasicReport," "SensorBinaryReport," or whatever you're likely to see in the logs shortly before or around the time the "opened" events occur).
Also, while Hubitat's docs do recommend that driver for the "BeSense" sensor (no mdoel numbers and I don't know if they have more than one, so I guess I'm not really sure), the product appears to be Z-Wave Plus, so you might want to try Hubitat's "Generic Z-Wave Plus Contact Sensor" driver instead to see if your luck is any different. I normally wouldn't do this if the docs recommend something else, but the dedicated "Plus" drivers are a bit new (and it's possible they haven't been tested with every deivce or the docs updated to match), and I'm not sure how many models there are from this brand name, so it probably can't hurt to at least try.
Short version: It works now!
I'm assuming you hit "Save Preferences" after enabling "Suppress duplicate events"?
Yes, I was clicking on "Save Preferences."
Also, while Hubitat's docs do recommend that driver for the "BeSense" sensor (no mdoel numbers and I don't know if they have more than one, so I guess I'm not really sure), the product appears to be Z-Wave Plus, so you might want to try Hubitat's "Generic Z-Wave Plus Contact Sensor" driver instead to see if your luck is any different.
I switched the driver to "Generic Z-Wave Plus Contact Sensor" and that seems to have done it! Interestingly enough, the new driver doesn't even have the 'Suppress duplicate events' as an option.
@brad5 I also tried your suggestion, before switching the driver, but it didn't make a difference. Nevertheless, thank you for that example. I can use it in future.
Again, thanks for the super speedy responses! I can end my weekend on a high-note.