VoxCommando
Help and Support (Using VoxCommando) => Vera Home Automation Controller => Topic started by: AgileHumor on March 04, 2015, 08:55:41 PM
-
Hello,
Could you consider adding support for the MultiSwitch plugin (as 8 separate switches in one)
Actions
When you select one of the MultiSwitch buttons as a scene or PLEG action, the default action will be a toggle of the switch state - on to off, off to on. If you open the scene or PLEG action Advanced tab, you will see that the newStatusN value is -1 which means toggle. To set the switch off, use a value of 0. To set the switch on, use a value of 1.
The following actions are provided for use by scenes and other plugins:
urn:dcineco-com:serviceId:MSwitch1 SetStatus1 newStatus1 = <0, 1 or -1>
..
urn:dcineco-com:serviceId:MSwitch1 SetStatus8 newStatus8 = <0, 1 or -1>
Most other apps that support MultiSwich show it as 8 individual On/Off switches in their interface.
Thanks so much if you could make this happen! I'd gladly ship you a new Vera Edge (with UI7) for your trouble.
-
Sure, I'm happy to take a look.
-
Here's something to get you started. I haven't decided yet if this should go into the actual plugin, mostly because I'm not sure what the best way to do that is yet.
Here is the group XML that I use in the video
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.2-->
<commandGroup open="True" name="Vera multiswitch" enabled="True" prefix="" priority="0" requiredProcess="" description="">
<command id="317" name="multi switch initialize" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="You must set the ID for your multiswitch in the 1st action and then run this command.
The command will always run when VC starts. It will set the variable and scan your multi-switch button names.">
<action>
<cmdType>Results.SetVar</cmdType>
<params>
<param>MltSwtchID</param>
<param>79</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>File.MakeDir</cmdType>
<params>
<param>Vera1</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>PayloadXML.Clear</cmdType>
<params>
<param>Vera1\multiswitches.xml</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Vera.Raw</cmdType>
<params>
<param>data_request?id=lu_variableget&serviceId=urn:dcineco-com:serviceId:MSwitch1&Variable=BtnNames&DeviceNum={Var.MltSwtchID}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.RegEx</cmdType>
<params>
<param>"(.*?)"</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>PayloadXML.AddPair</cmdType>
<params>
<param>Vera1\multiswitches.xml</param>
<param>{i}</param>
<param>{Match.{i}}</param>
</params>
<cmdRepeat>{#M}</cmdRepeat>
</action>
<action>
<cmdType>Group.Rebuild</cmdType>
<params>
<param>Vera multiswitch</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<event>VC.Loaded</event>
</command>
<command id="1132" name="toggle multi switch {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Vera.Raw</cmdType>
<params>
<param>data_request?id=action&output_format=xml&DeviceNum={Var.MltSwtchID}&serviceId=urn:dcineco-com:serviceId:MSwitch1&action=SetStatus{1}&newStatus{1}=-1</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<phrase>toggle multi switch</phrase>
<payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">Vera1\multiswitches.xml</payloadFromXML>
</command>
<command id="1161" name="set multi switch {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<if ifBlockDisabled="False" ifNot="False">
<ifType>(A)==(B)</ifType>
<ifParams>{2}&&on</ifParams>
<then>
<action>
<cmdType>Vera.Raw</cmdType>
<params>
<param>data_request?id=action&output_format=xml&DeviceNum={Var.MltSwtchID}&serviceId=urn:dcineco-com:serviceId:MSwitch1&action=SetStatus{1}&newStatus{1}=1</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else>
<action>
<cmdType>Vera.Raw</cmdType>
<params>
<param>data_request?id=action&output_format=xml&DeviceNum={Var.MltSwtchID}&serviceId=urn:dcineco-com:serviceId:MSwitch1&action=SetStatus{1}&newStatus{1}=0</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</else>
</if>
<phrase>turn multi switch</phrase>
<payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">Vera1\multiswitches.xml</payloadFromXML>
<payloadList>on, off</payloadList>
</command>
<command id="1222" name="Is multi switch {1} on" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Vera.Raw</cmdType>
<params>
<param>data_request?id=lu_variableget&serviceId=urn:dcineco-com:serviceId:MSwitch1&Variable=Status{1}&DeviceNum={Var.MltSwtchID}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<if ifBlockDisabled="False" ifNot="False">
<ifType>(A)==(B)</ifType>
<ifParams>{LastResult}&&1</ifParams>
<then>
<action>
<cmdType>TTS.Speak</cmdType>
<params>
<param>Multi switch {PF.1} is on</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</then>
<else>
<action>
<cmdType>TTS.Speak</cmdType>
<params>
<param>Multi switch {PF.1} is off</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
</else>
</if>
<phrase>is multi switch</phrase>
<payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">Vera1\multiswitches.xml</payloadFromXML>
<phrase>on</phrase>
</command>
</commandGroup>
-
Thanks man! Your quick on the code sir.
-
Thank you for this. The code works well for VC voice triggers. However, I do not seen the Vera triggers coming through the log to have them trigger VC actions.
My use case is to use PLEG for logic; the action turns on a MultiSwith, and then have VC trigger an action. I can do this via a scene or a tradition switch.... but not multi-switch.
Any advice?
-
The next version of VoxCommando will have a new version of the Vera plugin with a revised event engine that will support multi-switch.
In the meantime you can have PLEG send events to VC using luup if you want.