Virtual Light to turn on/off and control volume via Echo Speakers

My goal is to be able to turn off/on my Alexa speakers/speaker groups and control their volume through a virtual light. I have a brilliant smart switch and have SmartThings (connected via HubConnect with my Hubitat). I was able to connect my virtual light to my brilliant and through Rule Machine made it turn on/off, and tested out a rule making it volume 1 (10%) whenever the virtual light was 10% brightness.

Is there an easier way than making a rule for every percentage of brightness to correspond to the volume? If I can copy and paste a rule that makes it easier but I would like to avoid making 10-100 rules for each speaker/group.

Yes. I'm not sure what you have now, but it sounds like maybe you have something like this:

Trigger events: Dimmer level is 10%

Actions to run:

Set Speaker Volume to 1

What you want to do instead is something more like this:

Trigger events: Dimmer level *changed*

Actions to run:

IF (Dimmer Level <= 10%) THEN
  Set Speaker Volume to 1
ELSE-IF (Dimmer Level <= 20%) THEN
  Set Speaker Volume to 2
ELSE-IF ...
 ...
END-IF

The above is only one of several ways you could write this. In any case, you'll want conditional actions to do certain things in certain cases and not in others. I used "full" conditionals (rather than "simple conditionals") and am taking advantage of the fact that only one of the IF, ELSE-IF, or ELSE (not pictured, but if you group it into 10s like I did, you could use an ELSE instead of an ELSE-IF Level <= 100% since at that point, that's all you'd have left) blocks will run--the first that matches a condition (i.e, where the condition is true), in case that design is not intuitive.

Since you appear to be new (welcome!), you might be wondering how to use the RM UI to get the above. As you've probably discovered, you need to use the dropdowns and other inputs to create a rule that looks something like what I wrote. If you have trouble figuring out the conditionals, this video from Hubitat's YouTube channel may help: Rule Machine 2: Advance Conditional Rules - YouTube

Good luck!

2 Likes

thank you. I'll try that out, my issue was when I got to level; 2 (20%), I made one <= 20, =20, then got kinda lost on if I should add a >10 rule.