Announcement

Collapse
No announcement yet.

Need kick start creating a script to parse some XML

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need kick start creating a script to parse some XML

    Homeseer scripting gurus,

    Just added a new Apex aquarium controller to my world. Would like to be able to reflect the status in Homeseer for all the various probes and outputs. There are some options for control but I am inclined to allow the Apex controller to do what it is best at.

    http://192.168.1.27/cgi-bin/status.xml produces the XML at the end of this post.

    I am fairly handy at writing basic scrips but sure could use a framework to parse, create the appropriate devices if not existing and then update them when called....

    Thank you all for any guidance,

    Chris

    <?xml version="1.0"?>
    <status software="5.03_2C18" hardware="1.0">
    <hostname>apex</hostname>
    <serial>AC5:40648</serial>
    <timezone>-4.00</timezone>
    <date>07/29/2018 17:44:11</date>
    <power><failed>02/01/2000 01:30:55</failed>
    <restored>02/01/2000 00:00:16</restored></power>
    <probes>
    <probe>
    <name>Tmp</name> <value>81.6 </value>
    <type>Temp</type></probe><probe>
    <name>pH</name> <value>7.98 </value>
    <type>pH</type></probe><probe>
    <name>ORP</name> <value>256 </value>
    <type>ORP</type></probe><probe>
    <name>Salt</name> <value>37.0 </value>
    <type>Cond</type></probe><probe>
    <name>Light1_2_1A</name> <value>0.0 </value>
    </probe><probe>
    <name>Light2_2_2A</name> <value>0.0 </value>
    </probe><probe>
    <name>Skimmer_3A</name> <value>0.4 </value>
    </probe><probe>
    <name>Camera_4A</name> <value>0.0 </value>
    </probe><probe>
    <name>Skimmer_2_5A</name> <value>0.0 </value>
    </probe><probe>
    <name>Pump_2_6A</name> <value>1.3 </value>
    </probe><probe>
    <name>RefLight_2_7A</name> <value>0.0 </value>
    </probe><probe>
    <name>KissilA</name> <value>0.2 </value>
    </probe><probe>
    <name>Light1_2_1W</name> <value> 0 </value>
    </probe><probe>
    <name>Light2_2_2W</name> <value> 7 </value>
    </probe><probe>
    <name>Skimmer_3W</name> <value> 28 </value>
    </probe><probe>
    <name>Camera_4W</name> <value> 1 </value>
    </probe><probe>
    <name>Skimmer_2_5W</name> <value> 2 </value>
    </probe><probe>
    <name>Pump_2_6W</name> <value> 107 </value>
    </probe><probe>
    <name>RefLight_2_7W</name> <value> 0 </value>
    </probe><probe>
    <name>KissilW</name> <value> 39 </value>
    </probe><probe>
    <name>Volt_2</name> <value>117 </value>
    </probe></probes>
    <outlets>
    <outlet>
    <name>VarSpd1_I1</name>
    <outputID>0</outputID>
    <state>PF1</state>
    <deviceID>base_Var1</deviceID>
    </outlet>
    <outlet>
    <name>VarSpd2_I2</name>
    <outputID>1</outputID>
    <state>PF2</state>
    <deviceID>base_Var2</deviceID>
    </outlet>
    <outlet>
    <name>VarSpd3_I3</name>
    <outputID>2</outputID>
    <state>PF3</state>
    <deviceID>base_Var3</deviceID>
    </outlet>
    <outlet>
    <name>VarSpd4_I4</name>
    <outputID>3</outputID>
    <state>PF4</state>
    <deviceID>base_Var4</deviceID>
    </outlet>
    <outlet>
    <name>SndAlm_I6</name>
    <outputID>4</outputID>
    <state>AOF</state>
    <deviceID>base_Alarm</deviceID>
    </outlet>
    <outlet>
    <name>SndWrn_I7</name>
    <outputID>5</outputID>
    <state>AOF</state>
    <deviceID>base_Warn</deviceID>
    </outlet>
    <outlet>
    <name>EmailAlm_I5</name>
    <outputID>6</outputID>
    <state>OFF</state>
    <deviceID>base_email</deviceID>
    </outlet>
    <outlet>
    <name>Email2Alm_I9</name>
    <outputID>7</outputID>
    <state>AOF</state>
    <deviceID>base_email2</deviceID>
    </outlet>
    <outlet>
    <name>Light1_2_1</name>
    <outputID>8</outputID>
    <state>AOF</state>
    <deviceID>2_1</deviceID>
    </outlet>
    <outlet>
    <name>Light2_2_2</name>
    <outputID>9</outputID>
    <state>AON</state>
    <deviceID>2_2</deviceID>
    </outlet>
    <outlet>
    <name>Skimmer_3</name>
    <outputID>10</outputID>
    <state>AON</state>
    <deviceID>2_3</deviceID>
    </outlet>
    <outlet>
    <name>Camera_4</name>
    <outputID>11</outputID>
    <state>AON</state>
    <deviceID>2_4</deviceID>
    </outlet>
    <outlet>
    <name>Skimmer_2_5</name>
    <outputID>12</outputID>
    <state>AON</state>
    <deviceID>2_5</deviceID>
    </outlet>
    <outlet>
    <name>Pump_2_6</name>
    <outputID>13</outputID>
    <state>AON</state>
    <deviceID>2_6</deviceID>
    </outlet>
    <outlet>
    <name>RefLight_2_7</name>
    <outputID>14</outputID>
    <state>AOF</state>
    <deviceID>2_7</deviceID>
    </outlet>
    <outlet>
    <name>Kissil</name>
    <outputID>15</outputID>
    <state>AON</state>
    <deviceID>2_8</deviceID>
    </outlet>
    <outlet>
    <name>LinkA_2_9</name>
    <outputID>16</outputID>
    <state>AOF</state>
    <deviceID>2_9</deviceID>
    </outlet>
    <outlet>
    <name>LinkB_2_10</name>
    <outputID>17</outputID>
    <state>AOF</state>
    <deviceID>2_10</deviceID>
    </outlet>

  • #2
    Here's a VBS Script I used a few years back. As you will see, it's intended to get you started as it has nothing to do with HS (it writes summary data to a spreadsheet), but it shows the basic framework of reading the XML.


    Cheers
    Scott
    Attached Files

    Comment


    • #3
      If you want to be lazy, you can use my Datascraper script to do this. Creates all the devices for you......
      Jon

      Comment


      • #4
        Thank you both!!! Really appreciate this board and mostly the folks feeding my obsessions

        Comment

        Working...
        X