Author Topic: Homeseer 2  (Read 1709 times)

0 Members and 1 Guest are viewing this topic.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Homeseer 2
« on: February 21, 2014, 05:15:57 PM »
People have been asking for special plugins for Homeseer. It is already possible to link VC and Homeseer.

The REST-like API for HS3 users is discussed in another thread (http://voxcommando.com/forum/index.php?topic=1395.0). If you have HS2, you can try the following:

1. Download and install the TenHsServer 2.5 plugin, available here: http://www.tenholder.net/tenware2/tenHsServer/installation.aspx

Just double-click on the installer file to run it. This installer will put everything where it needs to go and configure everything automatically, assuming you have HS2 installed. No thinking required.

2. Select the XML code below, copy and paste it into your VC command tree.

NOTE: Within each command that has a "scrape" action, you'll need to insert the proper URL for your own HS2.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="Homeseer2" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="229" name="Generate HS devices payload x m l" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape</cmdType>
      <cmdString>http://[Your HS URL(usually an IP address)]/tenHsServer/tenHsServer.aspx?t={Rnd.1.99}&amp;f=Getdevices</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <cmdString>;*(\D\d+):.*?:.*?:(.*?):</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
        <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)&lt;(B)</ifType>
      <ifParams>0&amp;&amp;{#M}</ifParams>
      <then>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <cmdString>Storing {#M} devices in your payload x m l file</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <cmdString>Storing {#M} devices in your payload x m l file</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>PayloadXML.Clear</cmdType>
          <cmdString>HS2payloads\hsDevices.xml</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.MatchToEvent</cmdType>
          <cmdString>hs.addDevice&amp;&amp;99</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.RestartQuick</cmdType>
          <cmdString />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <cmdString>Sorry, there seems to be a problem.</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <cmdString>Sorry, there seems to be a problem.</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>Generate devices payload x m l</phrase>
  </command>
  <command id="248" name="Generate HS events payload x m l" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape</cmdType>
      <cmdString>http://[Your HS URL(usually an IP address)]/tenHsServer/tenHsServer.aspx?t={Rnd.1.99}&amp;f=Getevents</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <cmdString>"Result"&gt;(.*?)&lt;</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetLastResult</cmdType>
      <cmdString>{Match.1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <cmdString>\A?(.*?);</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)&lt;(B)</ifType>
      <ifParams>0&amp;&amp;{#M}</ifParams>
      <then>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <cmdString>Storing {#M} events in your payload x m l file</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <cmdString>Storing {#M} events in your payload x m l file</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>PayloadXML.Clear</cmdType>
          <cmdString>HS2payloads\hsEvents.xml</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.MatchToEvent</cmdType>
          <cmdString>hs.addEvent&amp;&amp;99</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.RestartQuick</cmdType>
          <cmdString />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <cmdString>Sorry, I'm not finding any Homeseer events.</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <cmdString>Sorry, I'm not finding any Homeseer events.</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>Generate events payload x m l</phrase>
  </command>
  <command id="264" name="addDevice" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Results.RegEx</cmdType>
      <cmdString>(\D\d+)&amp;&amp;&amp;&amp;{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.SetVar</cmdType>
      <cmdString>devID&amp;&amp;{Match.1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <cmdString>\d(.*?)\Z&amp;&amp;&amp;&amp;{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>PayloadXML.AddPair</cmdType>
      <cmdString>HS2payloads\hsDevices.xml&amp;&amp;{Var.devID}&amp;&amp;{Match.1}&amp;&amp;True</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>hs.addDevice</event>
  </command>
  <command id="269" name="addEvent" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>PayloadXML.AddPair</cmdType>
      <cmdString>HS2payloads\hsEvents.xml&amp;&amp;{1}&amp;&amp;{1}&amp;&amp;True</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <event>hs.addEvent</event>
  </command>
  <command id="1115" name="Run event {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape</cmdType>
      <cmdString>http://[Your HS URL(usually an IP address)]/tenHsServer/tenHsServer.aspx?t={Rnd.1.99}&amp;f=RunEvent&amp;d={1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <cmdString>Executing event {1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <cmdString>Executing event {1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Run event</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">HS2payloads\hsEvents.xml</payloadFromXML>
  </command>
  <command id="1118" name="Turn {1}{2}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape</cmdType>
      <cmdString>http://[Your HS URL(usually an IP address)]/tenHsServer/tenHsServer.aspx?t={Rnd.1.99}&amp;f=Device{2}&amp;d={1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <cmdString>Switching {PF.1} {2}.</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <cmdString>Switching {PF.1} {2}.</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Turn, Switch</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">HS2payloads\hsDevices.xml</payloadFromXML>
    <payloadList>On, Off</payloadList>
  </command>
</commandGroup>


SAY "Generate devices payload x m l, or "Generate events payload x m l" to:

a) Automatically generate payload xml files for your devices and for your Homeseer events.
Once executed, you'll find the 2 files in the HS2payloads folder of your VC directory.

Other included commands:

b) Switch devices on or off.
c) Run any event that you've created in HS2.

Obviously you can change the command phrases in VC. Hopefully you know how to do that.

There's more that can be done with this plugin, particularly if you get creative with events within Homeseer. This is just a sample, and since figuring out how to generate payload xml is definitely quite advanced, I have hopefully taken care of that aspect.

CAVEAT: I could only test it hypothetically using virtual devices and events. I tested it with HomeseerPro 2.5.
« Last Edit: February 22, 2014, 10:39:57 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Homeseer 2
« Reply #1 on: February 21, 2014, 05:16:32 PM »
Documentation for the tenHsServer is here: http://www.tenholder.net/tenware2/tenHsServer/default.aspx

The pdf has more details than the Overview page.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)