16
XML Exchange / Domoticz switches -- generate payload xml for switches & turn switches on/off
« on: February 21, 2016, 11:41:43 AM »
---
Unless you already have a good understanding of http requests, home automation, and VC, please start by reviewing Nodo's great, brief intro to Domoticz + VC:
http://voxcommando.com/forum/index.php?topic=2405.0
--
NOTE: You'll need to replace the Domoticz server IP address and port number in these commands with your own.
Personally, I store this info in a map table and access it as a map variable so that I don't have to type the address manually for every scrape action.
Unless you already have a good understanding of http requests, home automation, and VC, please start by reviewing Nodo's great, brief intro to Domoticz + VC:
http://voxcommando.com/forum/index.php?topic=2405.0
--
NOTE: You'll need to replace the Domoticz server IP address and port number in these commands with your own.
Personally, I store this info in a map table and access it as a map variable so that I don't have to type the address manually for every scrape action.
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.6-->
<commandGroup open="True" name="Domoticz switches" enabled="True" prefix="" priority="0" requiredProcess="" description="">
<command id="173" name="Domoticz switch {1} to {2}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>Scrape</cmdType>
<params>
<param>http://{M:Domoticz.serverIP:Port}/json.htm?type=command&param=switchlight&idx={1}&switchcmd={2}</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<phrase>Domoticz switch</phrase>
<payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\domoticzSwitches.xml</payloadFromXML>
<phrase optional="true">to</phrase>
<payloadList>On,Off</payloadList>
</command>
<command id="149" name="Domoticz switches GenXML" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
<action>
<cmdType>PayloadXML.Clear</cmdType>
<params>
<param>payloads\domoticzSwitches.xml</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Scrape</cmdType>
<params>
<param>http://{M:Domoticz.serverIP:Port}/json.htm?type=command&param=getlightswitches</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.RegExSingle</cmdType>
<params>
<param>"Name"\s:\s"(.*?)".*?"Idx"\s:\s"(.*?)"</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<action>
<cmdType>Results.MatchToXML</cmdType>
<params>
<param>payloads\domoticzSwitches.xml</param>
<param>True</param>
</params>
<cmdRepeat>1</cmdRepeat>
</action>
<phrase>GenXML switches</phrase>
</command>
</commandGroup>