Hi guys, so i'm new to Hubitat, got it yesterday. I have most of my devices moved over and a lot of simple automation and Rule Machine work in place thanks to these forums and the drivers contained within! Seems like a great community!
Now that most thing are in place i'm starting to tweak small things. one thing is i'm not sure how to hook a function to a virtual switch. So i created a virtual switch, I went into rule machine and selected it as my trigger event, however I can't find a way to access the device attribute i'm looking for? It's simple enough, I want to tell Alexa to pause the TV in the living room. I have used the custom driver to create my Sony TV as a device, as the TV in the living room is one year too old for direct Alexa intergration. All I wanted to do was expose a virtual switch to Alexa for the action "pause" from the driver. I can see and activate the pause function from the device page. But in general I just wanted to know how to access those function that I know are programmed within Rule Machine?
Sorry for the rambling post, i've been deep in smart home rules for 24 hours!
you need to look for custom action or custom attribute within RM (depending on what you are trying to find).
you can also create local variables and "connectors" in RM instead of virtual devices these are essentially the same but i prefer to use them for use cases like this, as they are directly built in RM.
Hey @BorrisTheCat quick related question...
I thought I remembered reading somewhere that the local variables required a bit more execution time (i want to say a measly 20ms) than virtual switches. I assume I am mis remembering or have which is faster backwards.
Do you by chance know for sure, or do you have better luck with the forum search than me and can point me to clarifying info on this?
Im not using RM myself anymore (all logic on NR now), but I want to make sure I give the most up to date/accurate info when helping others
i haven't seen this but I would assume if it was true it would be a the other way around or B to do with global variables.
No, that would be a question for Bruce, i just find it easier that way as they are kept in a nice neat package. Also in my tests ages ago i had rules that i needed to use virtual devices it didn't work very well, then Globable variables came out and it was better but still not 100% then locals came and the rule started working perfect. But this rule needs very fast flipping of a boolean variable that only exists in that rule.
If you not using RM there would definitely be no advantages to using variable and connectors in RM.
I have Sony Bravia driver that @ptdalen built which works brilliantly, i have two instances setup for living room and bedroom. In that virtual device there is a pause function. All i’m looking to do it set an Alexa command to trigger a virtual switch to execute that pause command. The bedroom TV is newer so has alexa control builtin but the living room one doesn’t. But I can’t find a way to map the virtual switch that i’ve created to issue the pause command from that virtual device.
What virtual device do you use? I think its a switch, so assuming that.
Start in RM
create a rule of TV pause or something, go to create local variables.
do the above then click create connector and click switch
click done and you get back to the rule.
put this as your trigger event
in actions select this
I don't have you TV but i would think you will find it in here.
no parameters are needed.
done all the way out as this is your completed rule.
click done and go to your device page and find you newly created virtial device.
in virtual device do this and save preferences.
now expose this switch to alexa and give it a test, when you turn on the switch the TV will pause.
logs showing it running
Thanks! that all looks to make sense. I'll give it a try tomorrow and report back, thanks for taking the time to put in so much effort!
I couldn't wait til tomorrow, so i've built the switch in Hubitat just got to integrate it into alexa tomorrow and then test, the only bit that was different was I had to set the "capability of action device" to switch where you had music player for sonos but that then gave me the list of commands i'd been trying to find!
OK so still couldn't wait, I linked the virtual switch to the Alexa skill, I ran device discovery in the Alexa app.... Nothing, it won't find that switch, I even went as far as disabling the Hubitat skill in Alexa and reenabling to get to the select devices page and sure enough there is the switch in the list to select but once the skill is enabled and device discovery has run it's still not showing in alexa devices.. ?
I presume i'm missing something really obvious?
Unfortunately I don't use Alexa so that bit isn't my strength, I use GH. Not sure who to tag for that one .
If you trigger the switch in HE does the TV bit work at least? Then it should turn back off? Then you may be able to ask that question on a Alexa thread.
Checked for devices again this morning and suddenly Alexa is showing it, so as soon as I get time to sit in front of the TV i'll check I can fire it and that is executes the pause function. Thanks for all your help
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.