Rule Machine Expert Features [deprecated]

Rule Machine Expert Features

Bruce has been gracious enough to humor my request to add some previously unavailable functionality (unavailable anywhere), to his fantastic Rule Machine.

This feature is available in version 1.6 and later, see: Rule Machine

Expert Features extends the Select Action choices in your rules with a new Run custom device command option.
This feature allows you to control devices that have custom (IE non stock, un published or yet to be published capabilities)
These devices could be devices that you or someone else has created.

Notable examples of published devices with custom capabilities:
-Fibaro RGBW controller, all of the buttons in the device detail tile have associated custom commands.
-Sonos and other Speaker devices, playTrackAndRestore and playTrackAndResume being two.
-Thing Shields, every thing shield has nothing but custom commands, you can now run these commands directly from Rule Machine.

Have a multi channel relay, and you want to ditch all those virtual switches?, well here you go


Basically any device that formally required a custom smartApp to support could be a candidate to migrate and control using Rule Machine.

Here’s a few examples that I’m using in Rule Machine
–softwhite() and deepfade() on an Fibaro RGBW controller that uses @twack device type
–playTrackAndRestore(‘https://s3.amazonaws.com/smartthingssmartapps/Boss+is+arriving.mp3’,6,30) on a Samsung Speaker
–fanOff() on a custom AEON dual switch device that I wrote

The cool thing about expert is you don’t even need to know what commands the device supports, it will give you a list to choose from and experiment with. (see cautions below)

There are two steps required to use custom commands in your rules.
-Create/test and save your command
-Select the device and command to execute in your rule

Create/test and save your command
–Open Rule Machine
–Select Expert Features, then Configure Custom Commands
–Select a device to extract the available commands from (any device with capability actuator will be shown)
–Select New Custom command, then select Available device commands (all standard and custom commands will be displayed)
–Select the command you wish to create from the above list, the results of the command execution will be immediately shown.
–Add any required parameters to the command.
–After the command is executing against the device as expected, select save command now, then done, then done again to return to the Custom Commands page.
–The saved command will now be available in the “saved command to test” list, and also in your new and existing rules.

Select the device and command to execute in your rule
–Create a new rule or edit an existing one
–In the Actions section (at the very bottom), select the custom device(s) and the command (saved above) to execute against them.
–If multiple devices are selected, each one should support the selected command, any errors will be trapped and show in the logs.

Managing commands
One or more commands can be removed by selecting them in Delete Custom Commands, then Delete commands now, then done.

Tips:
–Un-select your test device or the “saved command to test” before leaving the custom commands page, otherwise the command will execute the next time you open the page.
–Un-Select “available device commands” after saving the new command, otherwise the command will execute the next time you open the page.
–Un-Select “parameter type” for each of your parameters, in reverse order (ie 3,2,1) after saving the new command, this is just a convenience thing.
–The success or failure of any parameters can’t be determined by expert, use the logging in the IDE if you’re having issues getting a command to function.
–If your wizBang device isn’t in the list, add capability actuator to it.

Cautions:
Expert will expose commands on device types that aren’t published by ST, when you find these commands and play with them, you are doing so at your own. Neither Bruce, ST or myself are going to have any sympathy when you successfully execute wipeDisk() on your new Samsung appliance and have bricked it.
So, be advised it’s probably better to play with device types and commands that you have the code for, there I said it.

Please post any questions or issues with expert to this thread.
Thanks, Mike

14 Likes

Wow. I was hoping Rule Machine would add the ability to set OSRAM bulb color temperatures. Glad I didn’t distract you from this. This let’s me do do that and so much more.

Thank You!

1 Like

@Mike_Maxwell

, if we can keep the expert issues over in the expert post, that would help Bruce and I with the “you take it, I got it” issues.
@bamarayne, It appears that you are working on a new command with a parameter, but the parameter value field is empty?
If the command doesn’t have any parameters, then parameter type needs to be unchecked. If it requires a parameter, type and value must be entered.
can you post the issue and a screen shot of your select parameters page over in the expert topic?
I might be able to trap these errors, or maybe the instructions need updating.

Edit:
@Mike_Maxwell actually I can’t get to the parameters fields.

I click on expert features, then configure custom commands, I chose a device, click new custom command and I get that error.

It does the same with every device.

Is this the first time you used expert?, or have you been in there before

Can go into my location, list smart apps, rules and pm me a screen shot of this:

It was working fine. I had not saved anything, was just checking it out and it started doing this.

I’m on my phone so the screenshots aren’t capturing everything.
And
 Is that just the pop up go rule machine? Or should it be a specific rule?

The screen shot is from the IDE, you’ll need to do this from a desktop browser to get enough screen for me to see.
The error is from rule machine, so that’s the app section I need, not any of the actual rules you have.

Ok, I’ll get that when I get home.

I’m getting a not authorized message as well, I was trying to do some testing with my speaker to play a track using your example you had above and instead of select playTrackAndResume I selected playTextAndResume and I can no longer go in and change it because I get the error. Below is screenshot of that screen you requested.

thanks for that, BTW play text and resume uses smartthings TTS, which is broken at the moment, well broken for text that’s not currently cached

In any event, the issue you have is the same one that @bamarayne is having, I’ll get this sorted.
Pretty sure this is being caused by selecting a parameter, then leaving the value input empty


How would we get in to change that? I can’t make it that far lol

Yea, that’s the issue I’m fighting! I’ll have a patch here in a bit.

@bamarayne , @sgoncalves
Check your pm’s for a link to an interim patch to resolve this.
This will be included in the next release, but that may be a few days.

In the meantime, the current 1.6.0 rule machine expert code has the following bug
Selecting a parameter type on the parameter page, without entering a value, and then leaving the page will cause subsequent attempts to enter the new custom commands page to fail.
So for now, enter a parameter value, or unselect the parameter type before leaving the page.

In other words, if you’re going to use a parameter, it must have a value!

Mike,
I noticed that in the devices field it doesn’t show my garage door, motion sensor, or my contact sensors which some have temp.

Is this by design? I’m not sure exactly how the programming sees the devices, just curious.

For the garage opener, that’s most likely because the device type does not have capability.actuator. You could modify the device type to add this (one line) and save/publish for yourself, and edit the device’s device type to this new device type.

Also, you can’t use the Expert Features to access the temperature in those sensors, because the Expert Features are only for Actions with devices that have commands available, which sensors generally don’t have. You can access the temperature of those sensors in Rule Machine as a trigger event or condition.

1 Like

Ok, I understand about the temp sensors and the garage. I’m going to attempt the change in the device type.

I’m trying to learn the programming side and unfortunately my work has me on the road all of the time
 It’s my busy season!

But in the mean time, thanks again for everything. You guys are great and really make this system into something that it should be.

2 Likes

The patches to resolve a few expert bugs when creating commands are now live in Rule Machine 1.6.2

Issueing TTS (text to speech) commands to speakers using expert does work btw, subject to st’s tts engine working. As of right now it appears that only previously caches commands are available.
New ones throw some pretty ugly errors, that for the most part are now captured in expert and will prevent you from saving the non cached commands.
playTextAndResume(‘Good Night’,80) will work, where as playTextAndResume(‘did smartthings fix tts yet?’,80) will not.

Here’s another tts tip.
The result of a successful tts command is a reference to an mp3 url. You can capture this url by watching the logs for your speakers.
Once you have the url, you can use that to create a playTrackAndRestore command.

Anyway of getting this to support Landroid to issue Text to Speech to Android Devices? I currently have my device setup with BigTalker, however clicking on expert mode in Rule Machines does not seem to identify the device to select and test commands on. I was hoping for a way to be able to push TTS to my Android tablet using either this or Rule Machine.

http://www.keybounce.com/LANdroidHowTo/LANdroid.html - Landroid
Android as a Speech/Alarm Device released! And Updated! - Thread about Landroid

[OBSOLETE 1.1.6 5/25/16] Big Talker - Talk when events occur - Bigtalker SmartApp that uses Landroid devices to send pre-defined TTS on events.

Appreciate the help.

1 Like

In the device type definition section add: capability “actuator”, it will show up in the custom device listing after that.

1 Like

Awesome, that worked, thanks.