<?xml version="1.0" encoding="utf-8"?>
<Templates format="2" protocolVersion="83">
  <Template id="387a9e6a-7395-4eb2-bb65-e54a291d78cb" revision="1.1">
    <RevisionHistory>
      <Revision id="1.1">Cooling (2202 = 3) needs &quot;Cooling Heating&quot; enabled in the heat pump service menu (Husdata support, 2026-10-20).</Revision>
    </RevisionHistory>
    <Name>Husdata H66 – IVT Rego 2000 Heat Pump (HTTP API)</Name>
    <CcuModel>PacketParserCCU</CcuModel>
    <Producer>Husdata</Producer>
    <Model>H66 + IVT Rego 2000</Model>
    <Description>Husdata H66 gateway (cable 10) for IVT / Bosch heat pumps with the Rego 2000 controller over the local HTTP API. Requires API_ENABLED=2 and an H66 restart; set the controller type to HMC. Not yet tested with TapHome. Cooling (2202 = 3) needs &quot;Cooling Heating&quot; enabled in the heat pump service menu and is untested. Values the pump does not report show as device errors.</Description>
    <Category>1</Category>
    <ImportParameters>
      <Parameter>
        <Id>IpAddress</Id>
        <Name>IP address of the Husdata H66</Name>
        <Value>192.168.1.100</Value>
      </Parameter>
    </ImportParameters>
    <Module>
      <Name>Husdata H66</Name>
      <Id>-1</Id>
      <Model>PacketParserModuleHttp</Model>
      <DeviceProperties>
        <IpAddress>$[IpAddress]</IpAddress>
        <Port>80</Port>
        <UseHttps>False</UseHttps>
        <HttpAuthentification>0</HttpAuthentification>
        <InternalPollInterval>30000</InternalPollInterval>
        <CustomVariables>[{&quot;Name&quot;:&quot;alldata&quot;,&quot;ValueTypeId&quot;:2,&quot;NumericValue&quot;:0,&quot;StringValue&quot;:&quot;&quot;}]</CustomVariables>
        <ReadScriptPacketParser>alldata := &quot;&quot;;
VAR r := SENDHTTPREQUEST(&quot;/api/alldata&quot;);
IF r.IsSuccess = false
    ADDERROR(0, &quot;H66 /api/alldata failed: HTTP &quot; + r.StatusCode);
ELSEIF INDEXOF(r.Content, &quot;{&quot;) &lt; 0
    ADDERROR(0, &quot;H66 /api/alldata answer is not JSON: &quot; + r.Content);
ELSE
    alldata := r.Content;
END</ReadScriptPacketParser>
      </DeviceProperties>
      <Devices>
        <Device>
          <Name>Operating Mode HC1</Name>
          <Id>-2</Id>
          <Model>PacketParserMultiValueSwitch</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <IsReadOnly>False</IsReadOnly>
            <ReadSwitchStateScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;2202&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 2202 not found in H66 data&quot;);
    RETURN(NaN);
END
IF raw &lt; 0 OR raw &gt; 3
    ADDERROR(3, &quot;IDX 2202 value &quot; + raw + &quot; is not in the list&quot;);
    RETURN(NaN);
END
RETURN(raw);</ReadSwitchStateScriptPacketParser>
            <WriteSwitchStateScriptPacketParser>VAR r := SENDHTTPREQUEST(&quot;/api/set?idx=2202&amp;val=&quot; + Mu);
IF r.IsSuccess = false OR INDEXOF(r.Content, &quot;Ok&quot;) &lt; 0
    ADDERROR(2, &quot;Write IDX 2202 failed: &quot; + r.Content);
END</WriteSwitchStateScriptPacketParser>
            <OffStateValue>0</OffStateValue>
            <Value0>0</Value0>
            <Value0Index>0</Value0Index>
            <Value0Name>Off</Value0Name>
            <Value0IconId>4</Value0IconId>
            <Value1>1</Value1>
            <Value1Index>1</Value1Index>
            <Value1Name>Auto</Value1Name>
            <Value1IconId>3</Value1IconId>
            <Value2>2</Value2>
            <Value2Index>2</Value2Index>
            <Value2Name>Constant Heating</Value2Name>
            <Value2IconId>1</Value2IconId>
            <Value3>3</Value3>
            <Value3Index>3</Value3Index>
            <Value3Name>Cooling</Value3Name>
            <Value3IconId>2</Value3IconId>
            <Value4Index>68</Value4Index>
            <Value5Index>69</Value5Index>
            <Value6Index>70</Value6Index>
            <Value7Index>71</Value7Index>
            <Value8Index>72</Value8Index>
            <Value9Index>73</Value9Index>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>Room Thermostat HC1</Name>
          <Id>-3</Id>
          <Model>PacketParserThermostat</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <ReadCurrentTemperatureScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;0008&apos;]&quot;, true);
IF ISNULL(raw)
    ADDWARNING(1, &quot;IDX 0008 not reported - no cable indoor sensor; the setpoint still works&quot;);
    RETURN(NaN);
END
RETURN(IF(raw &gt; 32767, raw - 65536, raw) / 10);</ReadCurrentTemperatureScriptPacketParser>
            <ReadTemperatureSetPointScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(2, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;0203&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(2, &quot;IDX 0203 not found in H66 data&quot;);
    RETURN(NaN);
END
RETURN(IF(raw &gt; 32767, raw - 65536, raw) / 10);</ReadTemperatureSetPointScriptPacketParser>
            <WriteTemperatureSetPointScriptPacketParser>VAR r := SENDHTTPREQUEST(&quot;/api/set?idx=0203&amp;val=&quot; + ROUND(Se * 10));
IF r.IsSuccess = false OR INDEXOF(r.Content, &quot;Ok&quot;) &lt; 0
    ADDERROR(3, &quot;Write IDX 0203 failed: &quot; + r.Content);
END</WriteTemperatureSetPointScriptPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>Cooling Temperature HC1</Name>
          <Id>-4</Id>
          <Model>PacketParserVariable</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <IsReadOnly>False</IsReadOnly>
            <ReadStateScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;0214&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 0214 not found in H66 data&quot;);
    RETURN(NaN);
END
RETURN(IF(raw &gt; 32767, raw - 65536, raw) / 10);</ReadStateScriptPacketParser>
            <WriteStateScriptPacketParser>VAR r := SENDHTTPREQUEST(&quot;/api/set?idx=0214&amp;val=&quot; + ROUND(Va * 10));
IF r.IsSuccess = false OR INDEXOF(r.Content, &quot;Ok&quot;) &lt; 0
    ADDERROR(2, &quot;Write IDX 0214 failed: &quot; + r.Content);
END</WriteStateScriptPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>Outdoor Temperature</Name>
          <Id>-5</Id>
          <Model>PacketParserTemperatureSensor</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <ReadTemperatureScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;0007&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 0007 not found in H66 data&quot;);
    RETURN(NaN);
END
RETURN(IF(raw &gt; 32767, raw - 65536, raw) / 10);</ReadTemperatureScriptPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>Supply Temperature</Name>
          <Id>-6</Id>
          <Model>PacketParserTemperatureSensor</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <ReadTemperatureScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;0002&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 0002 not found in H66 data&quot;);
    RETURN(NaN);
END
RETURN(IF(raw &gt; 32767, raw - 65536, raw) / 10);</ReadTemperatureScriptPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>Heat Carrier Return</Name>
          <Id>-7</Id>
          <Model>PacketParserTemperatureSensor</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <ReadTemperatureScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;0003&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 0003 not found in H66 data&quot;);
    RETURN(NaN);
END
RETURN(IF(raw &gt; 32767, raw - 65536, raw) / 10);</ReadTemperatureScriptPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>Heat Carrier Forward</Name>
          <Id>-8</Id>
          <Model>PacketParserTemperatureSensor</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <ReadTemperatureScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;0004&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 0004 not found in H66 data&quot;);
    RETURN(NaN);
END
RETURN(IF(raw &gt; 32767, raw - 65536, raw) / 10);</ReadTemperatureScriptPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>Hot Water Top</Name>
          <Id>-9</Id>
          <Model>PacketParserTemperatureSensor</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <ReadTemperatureScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;0009&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 0009 not found in H66 data&quot;);
    RETURN(NaN);
END
RETURN(IF(raw &gt; 32767, raw - 65536, raw) / 10);</ReadTemperatureScriptPacketParser>
            <ServiceAttributesScriptsPacketParser>[{&quot;AttributeDefinition&quot;: {&quot;Name&quot;: &quot;Hot Water Setpoint&quot;}, &quot;ReadFormula&quot;: &quot;VAR raw := PARSEJSON(alldata, \&quot;$[&apos;0111&apos;]\&quot;, TRUE); IF(ISNULL(raw), \&quot;N/A\&quot;, TOSTRING(IF(raw &gt; 32767, raw - 65536, raw) / 10, \&quot;F1\&quot;) + \&quot; °C\&quot;)&quot;}]</ServiceAttributesScriptsPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>Hot Water Program</Name>
          <Id>-10</Id>
          <Model>PacketParserMultiValueSwitch</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <IsReadOnly>False</IsReadOnly>
            <ReadSwitchStateScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;2213&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 2213 not found in H66 data&quot;);
    RETURN(NaN);
END
IF raw &lt; 0 OR raw &gt; 2
    ADDERROR(3, &quot;IDX 2213 value &quot; + raw + &quot; is not in the list - check controller type HMC&quot;);
    RETURN(NaN);
END
RETURN(raw);</ReadSwitchStateScriptPacketParser>
            <WriteSwitchStateScriptPacketParser>VAR r := SENDHTTPREQUEST(&quot;/api/set?idx=2213&amp;val=&quot; + Mu);
IF r.IsSuccess = false OR INDEXOF(r.Content, &quot;Ok&quot;) &lt; 0
    ADDERROR(2, &quot;Write IDX 2213 failed: &quot; + r.Content);
END</WriteSwitchStateScriptPacketParser>
            <OffStateValue>0</OffStateValue>
            <Value0>0</Value0>
            <Value0Index>0</Value0Index>
            <Value0Name>Off</Value0Name>
            <Value0IconId>4</Value0IconId>
            <Value1>1</Value1>
            <Value1Index>1</Value1Index>
            <Value1Name>ECO</Value1Name>
            <Value1IconId>5</Value1IconId>
            <Value2>2</Value2>
            <Value2Index>2</Value2Index>
            <Value2Name>Comfort</Value2Name>
            <Value2IconId>6</Value2IconId>
            <Value3Index>67</Value3Index>
            <Value4Index>68</Value4Index>
            <Value5Index>69</Value5Index>
            <Value6Index>70</Value6Index>
            <Value7Index>71</Value7Index>
            <Value8Index>72</Value8Index>
            <Value9Index>73</Value9Index>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>Extra Hot Water</Name>
          <Id>-11</Id>
          <Model>PacketParserSwitch</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <OnStateIconId>60</OnStateIconId>
            <OffStateIconId>61</OffStateIconId>
            <OnStateName>${general_on}</OnStateName>
            <OffStateName>${general_off}</OffStateName>
            <ReadSwitchStateScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;1231&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 1231 not found in H66 data&quot;);
    RETURN(NaN);
END
RETURN(raw);</ReadSwitchStateScriptPacketParser>
            <WriteSwitchStateScriptPacketParser>VAR r := SENDHTTPREQUEST(&quot;/api/set?idx=1231&amp;val=&quot; + IF(St, 1, 0));
IF r.IsSuccess = false OR INDEXOF(r.Content, &quot;Ok&quot;) &lt; 0
    ADDERROR(2, &quot;Write IDX 1231 failed: &quot; + r.Content);
END</WriteSwitchStateScriptPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>Compressor</Name>
          <Id>-12</Id>
          <Model>PacketParserReedContact</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <OnStateIconId>87</OnStateIconId>
            <OffStateIconId>88</OffStateIconId>
            <OnStateName>Running</OnStateName>
            <OffStateName>Stopped</OffStateName>
            <ReadStateScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;1A01&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 1A01 not found in H66 data&quot;);
    RETURN(NaN);
END
RETURN(raw);</ReadStateScriptPacketParser>
            <ServiceAttributesScriptsPacketParser>[{&quot;AttributeDefinition&quot;: {&quot;Name&quot;: &quot;Compressor Speed&quot;}, &quot;ReadFormula&quot;: &quot;VAR raw := PARSEJSON(alldata, \&quot;$[&apos;3108&apos;]\&quot;, TRUE); IF(ISNULL(raw), \&quot;N/A\&quot;, TOSTRING(raw / 10, \&quot;F1\&quot;) + \&quot; %\&quot;)&quot;}, {&quot;AttributeDefinition&quot;: {&quot;Name&quot;: &quot;Compressor Power&quot;}, &quot;ReadFormula&quot;: &quot;VAR raw := PARSEJSON(alldata, \&quot;$[&apos;9112&apos;]\&quot;, TRUE); IF(ISNULL(raw), \&quot;N/A\&quot;, TOSTRING(raw / 10, \&quot;F1\&quot;) + \&quot; kW\&quot;)&quot;}]</ServiceAttributesScriptsPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>Heat Pump Alarm</Name>
          <Id>-19</Id>
          <Model>PacketParserReedContact</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <OnStateIconId>97</OnStateIconId>
            <OffStateIconId>98</OffStateIconId>
            <OnStateName>Alarm</OnStateName>
            <OffStateName>OK</OffStateName>
            <ReadStateScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;1A20&apos;]&quot;, TRUE);
VAR code := PARSEJSON(alldata, &quot;$[&apos;BA91&apos;]&quot;, TRUE);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 1A20 not found in H66 data&quot;);
    RETURN(NaN);
END
IF raw = 1 AND ISNULL(code)
    ADDWARNING(2, &quot;Heat pump alarm active, alarm code (IDX BA91) not reported&quot;);
ELSEIF raw = 1
    ADDWARNING(2, &quot;Heat pump alarm active, code &quot; + code);
END
RETURN(raw);</ReadStateScriptPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>External Control 1</Name>
          <Id>-14</Id>
          <Model>PacketParserSwitch</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <OnStateIconId>60</OnStateIconId>
            <OffStateIconId>61</OffStateIconId>
            <OnStateName>Active</OnStateName>
            <OffStateName>Inactive</OffStateName>
            <ReadSwitchStateScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;2233&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 2233 not found in H66 data&quot;);
    RETURN(NaN);
END
RETURN(raw);</ReadSwitchStateScriptPacketParser>
            <WriteSwitchStateScriptPacketParser>VAR r := SENDHTTPREQUEST(&quot;/api/set?idx=2233&amp;val=&quot; + IF(St, 1, 0));
IF r.IsSuccess = false OR INDEXOF(r.Content, &quot;Ok&quot;) &lt; 0
    ADDERROR(2, &quot;Write IDX 2233 failed: &quot; + r.Content);
END</WriteSwitchStateScriptPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>External Control 2</Name>
          <Id>-15</Id>
          <Model>PacketParserSwitch</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <OnStateIconId>60</OnStateIconId>
            <OffStateIconId>61</OffStateIconId>
            <OnStateName>Active</OnStateName>
            <OffStateName>Inactive</OffStateName>
            <ReadSwitchStateScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;2234&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 2234 not found in H66 data&quot;);
    RETURN(NaN);
END
RETURN(raw);</ReadSwitchStateScriptPacketParser>
            <WriteSwitchStateScriptPacketParser>VAR r := SENDHTTPREQUEST(&quot;/api/set?idx=2234&amp;val=&quot; + IF(St, 1, 0));
IF r.IsSuccess = false OR INDEXOF(r.Content, &quot;Ok&quot;) &lt; 0
    ADDERROR(2, &quot;Write IDX 2234 failed: &quot; + r.Content);
END</WriteSwitchStateScriptPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>External Control 3</Name>
          <Id>-16</Id>
          <Model>PacketParserSwitch</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <OnStateIconId>60</OnStateIconId>
            <OffStateIconId>61</OffStateIconId>
            <OnStateName>Active</OnStateName>
            <OffStateName>Inactive</OffStateName>
            <ReadSwitchStateScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;2235&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 2235 not found in H66 data&quot;);
    RETURN(NaN);
END
RETURN(raw);</ReadSwitchStateScriptPacketParser>
            <WriteSwitchStateScriptPacketParser>VAR r := SENDHTTPREQUEST(&quot;/api/set?idx=2235&amp;val=&quot; + IF(St, 1, 0));
IF r.IsSuccess = false OR INDEXOF(r.Content, &quot;Ok&quot;) &lt; 0
    ADDERROR(2, &quot;Write IDX 2235 failed: &quot; + r.Content);
END</WriteSwitchStateScriptPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>External Control 4</Name>
          <Id>-17</Id>
          <Model>PacketParserSwitch</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <OnStateIconId>60</OnStateIconId>
            <OffStateIconId>61</OffStateIconId>
            <OnStateName>Active</OnStateName>
            <OffStateName>Inactive</OffStateName>
            <ReadSwitchStateScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;2236&apos;]&quot;, true);
IF ISNULL(raw)
    ADDERROR(1, &quot;IDX 2236 not found in H66 data&quot;);
    RETURN(NaN);
END
RETURN(raw);</ReadSwitchStateScriptPacketParser>
            <WriteSwitchStateScriptPacketParser>VAR r := SENDHTTPREQUEST(&quot;/api/set?idx=2236&amp;val=&quot; + IF(St, 1, 0));
IF r.IsSuccess = false OR INDEXOF(r.Content, &quot;Ok&quot;) &lt; 0
    ADDERROR(2, &quot;Write IDX 2236 failed: &quot; + r.Content);
END</WriteSwitchStateScriptPacketParser>
          </DeviceProperties>
        </Device>
        <Device>
          <Name>Electricity Meter</Name>
          <Id>-18</Id>
          <Model>PacketParserElectricityMeter</Model>
          <DeviceProperties>
            <DeviceType>0</DeviceType>
            <InternalPollInterval>30000</InternalPollInterval>
            <ReadDemandScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(1, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR raw := PARSEJSON(alldata, &quot;$[&apos;C130&apos;]&quot;, true);
IF ISNULL(raw)
    ADDWARNING(1, &quot;IDX C130 (power draw) not reported - only newer pumps have it&quot;);
    RETURN(NaN);
END
RETURN(raw / 1000);</ReadDemandScriptPacketParser>
            <ReadTotalConsumptionScriptPacketParser>IF alldata = &quot;&quot;
    ADDERROR(2, &quot;No data from the H66 - see the module error&quot;);
    RETURN(NaN);
END
VAR comp := PARSEJSON(alldata, &quot;$[&apos;5C54&apos;]&quot;, true);
VAR aux := PARSEJSON(alldata, &quot;$[&apos;5C57&apos;]&quot;, true);
IF ISNULL(comp)
    ADDERROR(2, &quot;IDX 5C54 not found in H66 data&quot;);
    RETURN(NaN);
END
IF ISNULL(aux)
    ADDWARNING(3, &quot;IDX 5C57 (auxiliary heater) not reported - total is the compressor only&quot;);
    RETURN(comp);
END
RETURN(comp + aux);</ReadTotalConsumptionScriptPacketParser>
            <ServiceAttributesScriptsPacketParser>[{&quot;AttributeDefinition&quot;: {&quot;Name&quot;: &quot;Heat Supplied Total&quot;}, &quot;ReadFormula&quot;: &quot;VAR raw := PARSEJSON(alldata, \&quot;$[&apos;5C51&apos;]\&quot;, TRUE); IF(ISNULL(raw), \&quot;N/A\&quot;, TOSTRING(raw) + \&quot; kWh\&quot;)&quot;}, {&quot;AttributeDefinition&quot;: {&quot;Name&quot;: &quot;Compressor Consumed&quot;}, &quot;ReadFormula&quot;: &quot;VAR raw := PARSEJSON(alldata, \&quot;$[&apos;5C54&apos;]\&quot;, TRUE); IF(ISNULL(raw), \&quot;N/A\&quot;, TOSTRING(raw) + \&quot; kWh\&quot;)&quot;}, {&quot;AttributeDefinition&quot;: {&quot;Name&quot;: &quot;Auxiliary Heater Consumed&quot;}, &quot;ReadFormula&quot;: &quot;VAR raw := PARSEJSON(alldata, \&quot;$[&apos;5C57&apos;]\&quot;, TRUE); IF(ISNULL(raw), \&quot;N/A\&quot;, TOSTRING(raw) + \&quot; kWh\&quot;)&quot;}]</ServiceAttributesScriptsPacketParser>
          </DeviceProperties>
        </Device>
      </Devices>
    </Module>
  </Template>
</Templates>
