Interfacing Alexa with Reactor via Routines and Dimmer VS
-
Most of my spoken commands to Alexa go something like this:
"Alexa, time for bed"
at which point she executes a pre-planned Routine (triggered by that spoken phrase). The routine may turn
On
a virtual switch (named, say, "VS: Time for Bed" on my Vera Plus, but known to the Alexa Smart Home skill as "Time for Bed" just to keep my sanity).The VS is a child device of Switchboard plug-in (by @toggledbits ) and acts as a binary (
On
/Off
) light switch. Typically, I'll instruct Reactor to turn the switch back off -- or, more commonly, have it set to turn itself back off after NN seconds in the Switchboard UI. In other words, it's just a brief Trigger for a Reactor routine or Vera scene.Now, here's my question: In order to avoid creating dozens of virtual switches -- one for each Routine / Scene -- has anyone tried using a DIMMER instead?
Seems to me that a dimming device, since it can be set to 100 different "brightness levels", could trigger 100 different responses in Reactor. But I'm hesitant to try this arrangement until I know others have had success, and that the faux "dimming" process won't inadvertently trigger intermediate values (e.g. "ramping") along the way.
Eager to hear if this alternative workflow makes sense and is practical, insofar as "Binary" and "Dimmer" seem to be the only switch types that Vera allows Alexa to "see" on Discovery.
Thanks! - Libra
-
I use an expression set to 0, I update the variable using node-red local alexa(similar to HA Bridge) In reactor I have several RS's that monitor this expression variable for different values, if the reaction is triggered one of the actions will be to set the variable back to 0. You must have no actions in the false reaction, as when expression is reset to 0 the true action will stop as reactor would want to run the false actions. So far no issues. i have 4 RS's monitoring this variable for different values, but it is unlimited.
-
Alexa will not rump up/down a dimmer, so you'll be good.
I'm personally using Virtual Devices under HA-Bridge, calling HTTP endpoints (vera Scenes, my own, etc). I have one sending 0-100 to control my ampli volume via Harmony. Your imagination is the limit.
The only downside, for me, is that sensors are not supported under HA-bridge, otherwide I'd have been a perfect match for my Alexa's need.
-
Thanks, guys, I'm greatly heartened by your replies. In fact, yesterday I undertook to create a test workflow and it works better than expected. In an abundance of caution, I introduced two safeguards in the process:
(a) I added an auxiliary VS to the mix, which I have Alexa turn ON at the outset of a Routine, then OFF again. In MSR, I use the ON condition as a Constraint, without which nothing will (accidentally) run. I know it's overkill. But think of it as a kind of "write strobe" signal for RAM, where you don't want any spurious values setting something off.
(b) Within the SET Reaction, I purposely set a variable to "ACK" and then to the NN value derived from the VS dim level. This way, my target Rules can watch for "changes from 'ACK' to (any)" and know with confidence that they are being triggered by a formal routine.Just me being all "belt and suspenders" about it. But yeah, I agree this has massive potential. Why didn't I think of trying this before?
Only (minor) downside is that I don't see myself being able to entirely do away with all the previous VSes on Vera, because they have some usefulness in her UI and on the app, when I really do wanna just mash "LIGHTS OUT" and be done with it (that is, I won't always be using Alexa for things).
Again, thanks for the valuable input!
-
UPDATE: Troubleshooting Alexa's odd timing on sending Routine actions, combined with an increasingly complex "response matrix" that I created in MSR, got the better of me. I'm going back to traditional Virtual Switches (in Switchboard) for my modest purposes.
-
Upon further testing, I've concluded that Alexa Routines are a not reliable means of sending discrete data. For instance, in a simple test to see whether MSR could receive individual "Dim" commands from Alexa, the failure rate was almost 100%.
I created a Routine that sets the same device (a Hue bulb running on the Hue hub, connected with Vera Plus via the AltHue plug-in) to three different "Dim" levels (21%, 67%, then 3%) in rapid succession.
As this graph shows, displaying 3 separate runs of the Routine over the course of a minute, the resulting final "Dim" level was effectively random among the three possible values.
Additional testing -- using a Virtual Dimmer Switch instead, thinking that may remove several lag points in the workflow -- revealed that results vary. I changed the "Dim" levels to 99%, 21%, followed by 0%. While this setup was slightly more dependable in terms of the desired outcome (e.g. VS gets set to proper brightness levels, but not always in the correct order), the only way to guarantee results was to introduce 5-second delays between steps. (Alexa Routines only permit delays in 5-second increments, thus vastly reducing the utility of this approach.)
Avoid. Unless you are confident in sending only a single datum with no delay. Even then, I would test the routine a bunch to make sure it actually fires each time you think it should.
-
-
Tracking same as you show, except the inescapable fact that when it's an Alexa Routine doing the dimming, the bulb was apt to wind up dimmed to 21%, or 67%, or 3% at the end of the test. In other words, Alexa sending multiple different values over a short span were not going to be honored faithfully on the receiving end, which means MSR was going to detect erroneous data. Therefore, triggering Scenes off of such data seems like a bad idea.
-
@librasun said in Interfacing Alexa with Reactor via Routines and Dimmer VS:
Tracking same as you show
You are tracking dimming.level, which is the status I believe. My example was tracking the target level. The difference being, target is set to to loadLevelTarget in the controller so is clearly defined and MSR should pick it up clearly as it is set. Tracking the status means tracking a moving target, as the new level target sent from alexa will mess with the status level.
My image is a routine from alexa with 2 levels, fired by voice several time in quick successio.
-
Roger that. I had tacitly assumed that
dimming.level
in MSR land was the same asloadLevelTarget
.Let me delve into the details of what I was tracing and get back to you. Thanks for the clarification!
-
Here are my results, after running the same (revised) Alexa Routine, which is supposed to send out four events in a row: "Dim to 39%", "Dim to 21%", "Dim to 100%", and "Dim to 0%". Literally all four tests resulted in different data, as shown by this Scope snapshot.
If you examine the four graphs closely, it's almost as if Alexa is doing a "look-ahead" and skipping some of the earlier assigned values when she "knows" the VS is already set to a later value.
Either way, I feel more confident now that "Dimming Level" and "loadLevelTarget" are identical in value for testing purposes.
-
@elcid Intriguing how your setup seems so much more consistent than mine. It's the story of my life. In fact, while doing this test battery, I realized that Switchboard plug-in for some reason is refusing to "Reset" the Test Dimmer despite its ImpulseTime value being non-zero (I've tried 1, 3, 5, doesn't matter). Never resets.
I find a problem, it always has a baby.
-
How are you connecting the dimmer to alexa?
I am using node-red local and not vera plugin -
@elcid "Test Dimmer" is a child device of Switchboard plug-in on my VeraPlus. MSR runs in a Docker container on my Synology NAS, connected to the same local network.
I'm accessing and executing the Alexa Routine using an Android phone (also connected to the same WiFi).
Clearly the type and timing of propagated data in this arrangement is not deterministic enough to be used as a Trigger in MSR. Spent two solid days proving that to myself, lol!
Surely with Node-Red and other more modern, streamlined data channels in place, it would not be a problem, I'm sure. Just wanted to test what I have in my arsenal, which is always 1-2 generations old.
-
@librasun said in Interfacing Alexa with Reactor via Routines and Dimmer VS:
Test Dimmer" is a child device of Switchboard plug-in on my VeraPlus. MSR runs in a Docker container on my Synology NAS, connected to the same local network.
That did not answer my question, how is alexa communicating with the vera virtual device?
-
@elcid Hmm, I gotta think about that.... All I can say is that after creating the virtual switch "Test Dimmer" I went into GetVera configuration > Alexa > checked the new device, then FINISH. Then I ran Alexa app's "Discovery" mode (it found the new device), whereupon it became available inside my Routines.
So as to "how" it communicates, I suppose it's happening through the Alexa <> Vera connection at an API level. That's my best guess.
-
So it's using the laggy Ezlo Alexa plugin. Can you not use HA bridge on your NAS?
[edit] I moved most of the plugins off vera and no aleax plugin , result is alexa is faster and veraplus reloads 1 or 2 times a week, and i am still on firmware 7.31, waiting for offical release of 7.32 as don't want to fall into the no support as you loaded beta firmware trap. -
Ha, your suggestion led me to Google "HA Bridge" and I read up on it over at Github. Fascinating concept, although a bit beyond my technical level (i.e. "slightly scary") and I dare say it solves problems I'm not quite sure (yet) that I have.
As for Vera firmware, yep, on the advice of others, I took the plunge upgrading to 7.32 (beta) and have no regrets. In fact, at the same time I also uninstalled several plug-ins (Site Sensor, Reactor, and GCal3) and have experienced exactly ZERO Luup engine restarts since!
I'll keep your advice in mind for the future, as I learn more about my system's weaknesses. Right now, it does everything I need and more. The experimentation I do here is mostly connected with beta testing MSR, which has kept me occupied for over a month now.
-
HA bridge is actually really simple. Nearly all of my stuff is running on it (at least all the stuff I need to expose to Alexa) and it's pretty instant
C
10/42