What I am trying to accomplish is:
1. Have VC tell me the total number of devices on my network
2. the total number of active/inactive devices on the network (this is identified by the "formatted" status) and
3. the status of a particular node if requested
After reading through your comment, I'm guessing there is a better way to write this command to achieve the results that I am looking for. I'm just not sure of it yet.
It sounds as though you want a group of commands, rather than a single command. The issue is not just mastering regular expressions, but thinking in terms of how VC works, and what types of ISY queries you can use that make it easier to isolate the values you're interested in, in each case.
There are different ways to parse your objectives, but I would probably break it down into as many as 5 commands -- something like:
Command 1: Scan my devices / (How many devices do I have)
Solution:
Scrape
http://YOUR_ISY_URL/rest/statusSimple Results.regex --> node id="(.*?)" [just looking for node ids]
OSD.ShowText Total devices: {#M}
Store this value as a variable to be used in command 2, using Results.SetVar.
Command 2: Triggered automatically by command 1, using an event trigger. (Technically all this could be done in command 1 instead -- this is just my preference.)
Solution:
Scrape
http://YOUR_ISY_URL/rest/statusSimple Results.regex --> formatted="\s" [looking ONLY for cases when formatted is blank (which I'm assuming means a device is inactive/disabled?)]
Then I can calculate active devices by subtracting inactive devices from my total. This requires that the Python plugin be enabled. We use it to do the math. Simply, PY.ExecString --> result = {var.devices} - {#M}
Now I can report the number of active ({LastResult}) and inactive ({#M}) devices.
Command 3: Get status info
only for my lights.
To make this convenient, I would create a payload XML file associating the node IDs for each light switch device with that device's friendly name.
This way you can ask more naturally, "Is the hall light/living room light/bedroom light on?"
You take advantage of the fact that you can query the status for a specific node ID. You pass in the payload value for that specific device node id.
Solution:
Scrape
http://YOUR_ISY_URL/rest/nodes/{1}/STSimple Results.regex --> formatted="(.*?)"
Now you can customize the feedback you receive based on whether the regex returns a value of on, off, or a number indicating the dim level of a dimmable light. You can use a logic block for this.
If {Match.1} is either on or off, VC tells you that. [If AcontainsB > On Off > {Match.1}, then "{PF.1} is {Match.1}"]
Otherwise, it tells you the dim level. (Slightly different wording to make this natural-sounding.)
Command 4: Give the thermostat its own special command, because it has various properties apart from its current status (What mode is the thermostat in? What's the humidity reading, etc.).
In this case I'd create a payload XML file that associates each of the 4 property IDs with a convenient phrase for that property ID. Along the lines of:
ST -> temperature
CLIMD -> mode
CLIHUM -> humidity reading
CLISPH -> heat set point
Now you can take advantage of your ability to query specific property types for specific nodes. You can hard code the node ID for the thermostat, and use a payload{1} to pass in the property that you're interested in:
Solution:
Scrape
http://YOUR_ISY_URL/rest/nodes/11 B3 8F 1/{1}
Simple Results.regex --> formatted="(.*?)"
You can again customize the response with a logic block, or keep it simple and just report {Match.1} for whatever you asked for.
Command 5: Give your door lock its own command as well. (Basically, I prefer to monitor different types of devices using distinct commands, in part so that I can customize the feedback.
So, same scrape and regex as above but using the lock's node ID, and then you can customize the wording of both the voice command and the feedback so that it makes sense for a door lock.