[plugwiseha] Initial contribution (#9504)

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
This commit is contained in:
lsiepel
2021-05-19 21:53:33 +02:00
committed by GitHub
parent 7d2c8755eb
commit 8202d57965
59 changed files with 5677 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<binding:binding id="plugwiseha" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:binding="https://openhab.org/schemas/binding/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/binding/v1.0.0 https://openhab.org/schemas/binding-1.0.0.xsd">
<name>Plugwise Home Automation Binding</name>
<description>This binding supports the Plugwise Home Automation 'Adam' gateway. It allows users to access temperature
controls of zones defined on the gateway</description>
</binding:binding>

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<config-description:config-descriptions
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:config-description="https://openhab.org/schemas/config-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/config-description/v1.0.0 https://openhab.org/schemas/config-description-1.0.0.xsd">
<!-- Bridge -->
<config-description uri="bridge-type:plugwiseha:gateway">
<parameter name="host" type="text" required="true">
<context>network-address</context>
<label>Host</label>
<description>Hostname or IP address of the boiler gateway</description>
<default>adam</default>
</parameter>
<parameter name="username" type="text" required="true">
<label>Username</label>
<description>Adam HA gateway username (default: smile)</description>
<default>smile</default>
<advanced>true</advanced>
</parameter>
<parameter name="smileId" type="text" pattern="[a-zA-Z0-9]{8}" required="true">
<context>password</context>
<label>Smile ID</label>
<description>The Smile ID is the 8 letter code on the sticker on the back of the Adam boiler gateway</description>
</parameter>
<parameter name="refresh" type="integer" min="1" max="120" required="true" unit="s">
<label>Refresh Interval</label>
<unitLabel>seconds</unitLabel>
<description>Refresh interval in seconds</description>
<default>5</default>
<advanced>true</advanced>
</parameter>
</config-description>
<!-- Zone thing -->
<config-description uri="thing-type:plugwiseha:zone">
<parameter name="id" type="text" required="true" readOnly="false">
<label>ID</label>
<description>Location ID for the zone</description>
</parameter>
</config-description>
<config-description uri="thing-type:plugwiseha:appliance_boiler">
<parameter name="id" type="text" required="true" readOnly="false">
<label>ID</label>
<description>Appliance ID</description>
</parameter>
</config-description>
<!-- Appliance: Radiator valve -->
<config-description uri="thing-type:plugwiseha:appliance_valve">
<parameter name="id" type="text" required="true" readOnly="false">
<label>ID</label>
<description>Appliance ID</description>
</parameter>
<parameter name="lowBatteryPercentage" type="integer" min="1" max="50" required="true">
<label>Low Battery Threshold</label>
<unitLabel>%</unitLabel>
<description>Battery charge remaining at which to trigger battery low warning</description>
<default>15</default>
<advanced>true</advanced>
</parameter>
</config-description>
<!-- Appliance: Pump switch -->
<config-description uri="thing-type:plugwiseha:appliance_pump">
<parameter name="id" type="text" required="true" readOnly="false">
<label>ID</label>
<description>Appliance ID</description>
</parameter>
</config-description>
<!-- Appliance: Radiator valve -->
<config-description uri="thing-type:plugwiseha:appliance_thermostat">
<parameter name="id" type="text" required="true" readOnly="false">
<label>ID</label>
<description>Appliance ID</description>
</parameter>
<parameter name="lowBatteryPercentage" type="integer" min="1" max="50" required="true">
<label>Low Battery Threshold</label>
<unitLabel>%</unitLabel>
<description>Battery charge remaining at which to trigger battery low warning</description>
<default>15</default>
<advanced>true</advanced>
</parameter>
</config-description>
</config-description:config-descriptions>

View File

@@ -0,0 +1,194 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="plugwiseha"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<channel-type id="setpointTemperature">
<item-type>Number:Temperature</item-type>
<label>Setpoint Temperature</label>
<description>Gets or sets the set point of this zone</description>
<category>heating</category>
<state min="0.0" max="35.0" step="0.5" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="temperature">
<item-type>Number:Temperature</item-type>
<label>Zone Temperature</label>
<description>Gets the temperature of this zone</description>
<category>heating</category>
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="offsetTemperature">
<item-type>Number:Temperature</item-type>
<label>Thermostat Temperature Offset</label>
<description>Gets or sets the temperature offset for this thermostat</description>
<category>heating</category>
<state pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="preHeat">
<item-type>Switch</item-type>
<label>Preheat</label>
<description>Switch the preheating of a zone ON or OFF</description>
<category>switch</category>
</channel-type>
<channel-type id="power">
<item-type>Switch</item-type>
<label>Power</label>
<description>Switch the Plugwise Smart plug ON or OFF</description>
<category>switch</category>
</channel-type>
<channel-type id="lock">
<item-type>Switch</item-type>
<label>Lock</label>
<description>Locks the switch state of the Plugwise Smart plug</description>
<category>switch</category>
</channel-type>
<channel-type id="powerUsage">
<item-type>Number:Power</item-type>
<label>Power Usage</label>
<state pattern="%.2f %unit%" readOnly="true"></state>
</channel-type>
<channel-type id="chState">
<item-type>Switch</item-type>
<label>Central Heating Active</label>
<description>Is the boiler active for central heating, On or OFF</description>
<category>switch</category>
<state readOnly="true"/>
</channel-type>
<channel-type id="dhwState">
<item-type>Switch</item-type>
<label>Domestic Hot Water Active</label>
<description>Is the boiler active for domestic hot water, On or OFF</description>
<category>switch</category>
<state readOnly="true"/>
</channel-type>
<channel-type id="coolingState">
<item-type>Switch</item-type>
<label>Cooling State</label>
<description>Is the boiler active for cooling, On or OFF</description>
<category>switch</category>
<state readOnly="true"/>
</channel-type>
<channel-type id="flameState">
<item-type>Switch</item-type>
<label>Flame State</label>
<description>Is the boiler's flame active, On or OFF</description>
<category>switch</category>
<state readOnly="true"/>
</channel-type>
<channel-type id="intendedHeatingState">
<item-type>Switch</item-type>
<label>Intended Heating State</label>
<description>Should the boiler be active for central heating, On or OFF</description>
<category>switch</category>
<state readOnly="true"/>
</channel-type>
<channel-type id="dhwComfortMode">
<item-type>Switch</item-type>
<label>Domestic Hot Water Comfort Mode</label>
<description>Is the boiler's domestic hot water mode set to comfort, On or OFF</description>
<category>switch</category>
<state readOnly="true"/>
</channel-type>
<channel-type id="intendedBoilerTemp">
<item-type>Number:Temperature</item-type>
<label>Intended Boiler Temperature</label>
<description>Gets the intended temperature of this boiler</description>
<category>heating</category>
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="modulationLevel">
<item-type>Number</item-type>
<label>Modulelation Level</label>
<description>Gets the modulation level of this boiler</description>
<category>heating</category>
<state readOnly="true" pattern="%.0f"/>
</channel-type>
<channel-type id="otAppFaultCode">
<item-type>Number</item-type>
<label>Opentherm Application Faultcode</label>
<description>Gets the Opentherm application fault code of this boiler</description>
<category>heating</category>
<state readOnly="true" pattern="%.0f"/>
</channel-type>
<channel-type id="dhwTemperature">
<item-type>Number:Temperature</item-type>
<label>Domestic Hot Water Temperature</label>
<description>Gets the temperature of the domestic hot water</description>
<category>heating</category>
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="otOEMFaultCode">
<item-type>Number</item-type>
<label>OEM Fault Code</label>
<description>Gets the OEM fault code of this boiler</description>
<category>heating</category>
<state readOnly="true" pattern="%.0f"/>
</channel-type>
<channel-type id="boilerTemperature">
<item-type>Number:Temperature</item-type>
<label>Boiler Temperature</label>
<description>Gets the temperature of this boiler</description>
<category>heating</category>
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="dhwSetpoint">
<item-type>Number:Temperature</item-type>
<label>Domestic Hot Water Setpoint Temperature</label>
<description>Gets the temperature of the domestic hot water setpoint</description>
<category>heating</category>
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="maxBoilerTemperature">
<item-type>Number:Temperature</item-type>
<label>Max Boiler Temperature</label>
<description>Gets the maximum temperature ofthis boiler</description>
<category>heating</category>
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="waterPressure">
<item-type>Number:Pressure</item-type>
<label>Water Pressure</label>
<description>Gets the water pressure of the boiler</description>
<category>heating</category>
<state readOnly="true" pattern="%.1f %unit%"/>
</channel-type>
<channel-type id="presetScene">
<item-type>String</item-type>
<label>Preset Scene</label>
<description>Gets the preset scene of the zone</description>
<category>heating</category>
<state readOnly="true"/>
</channel-type>
<channel-type id="valvePosition">
<item-type>Number</item-type>
<label>Valve Position</label>
<description>Gets the position of the valve (0% closed, 100% open)</description>
<category>heating</category>
<state readOnly="true" pattern="%.0f"/>
</channel-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="plugwiseha"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="https://openhab.org/schemas/thing-description/v1.0.0"
xsi:schemaLocation="https://openhab.org/schemas/thing-description/v1.0.0 https://openhab.org/schemas/thing-description-1.0.0.xsd">
<!-- Bridge -->
<bridge-type id="gateway">
<label>Plugwise Home Automation Bridge</label>
<description>The Plugwise Home Automation Bridge is needed to connect to the Adam boiler gateway</description>
<config-description-ref uri="bridge-type:plugwiseha:gateway"/>
</bridge-type>
<!-- Zone thing -->
<thing-type id="appliance_boiler" listed="true">
<supported-bridge-type-refs>
<bridge-type-ref id="gateway"/>
</supported-bridge-type-refs>
<label>Boiler</label>
<description>A Plugwise Home Automation controlled boiler</description>
<channels>
<channel id="chState" typeId="chState"/>
<channel id="dhwState" typeId="dhwState"/>
<channel id="waterPressure" typeId="waterPressure"/>
<channel id="coolingState" typeId="coolingState"/>
<channel id="flameState" typeId="flameState"/>
<channel id="intendedHeatingState" typeId="intendedHeatingState"/>
<channel id="dhwComfortMode" typeId="dhwComfortMode"/>
<channel id="intendedBoilerTemp" typeId="intendedBoilerTemp"/>
<channel id="modulationLevel" typeId="modulationLevel"/>
<channel id="otAppFaultCode" typeId="otAppFaultCode"/>
<channel id="dhwTemperature" typeId="dhwTemperature"/>
<channel id="otOEMFaultCode" typeId="otOEMFaultCode"/>
<channel id="boilerTemperature" typeId="boilerTemperature"/>
<channel id="dhwSetpoint" typeId="dhwSetpoint"/>
<channel id="maxBoilerTemperature" typeId="maxBoilerTemperature"/>
</channels>
<representation-property>id</representation-property>
<config-description-ref uri="thing-type:plugwiseha:appliance_boiler"/>
</thing-type>
<!-- Zone thing -->
<thing-type id="zone" listed="true">
<supported-bridge-type-refs>
<bridge-type-ref id="gateway"/>
</supported-bridge-type-refs>
<label>Plugwise Zone</label>
<description>A Plugwise Home Automation heating zone</description>
<channels>
<channel id="setpointTemperature" typeId="setpointTemperature"/>
<channel id="temperature" typeId="temperature"/>
<channel id="presetScene" typeId="presetScene"/>
<channel id="preHeat" typeId="preHeat"/>
</channels>
<representation-property>id</representation-property>
<config-description-ref uri="thing-type:plugwiseha:zone"/>
</thing-type>
<!-- Appliance: Radiator valve (Tom) -->
<thing-type id="appliance_valve" listed="true">
<supported-bridge-type-refs>
<bridge-type-ref id="gateway"/>
</supported-bridge-type-refs>
<label>Plugwise Radiator Valve</label>
<description>A Plugwise Home Automation radiator valve</description>
<channels>
<channel id="setpointTemperature" typeId="setpointTemperature"/>
<channel id="temperature" typeId="temperature"/>
<channel id="valvePosition" typeId="valvePosition"/>
</channels>
<representation-property>id</representation-property>
<config-description-ref uri="thing-type:plugwiseha:appliance_valve"/>
</thing-type>
<!-- Appliance: Pump switch (Circle) -->
<thing-type id="appliance_pump" listed="true">
<supported-bridge-type-refs>
<bridge-type-ref id="gateway"/>
</supported-bridge-type-refs>
<label>Central Heating Pump</label>
<description>A Plugwise Home Automation smart plug switch connected to a central heating pump</description>
<channels>
<channel id="power" typeId="power"/>
<channel id="lock" typeId="lock"/>
<channel id="powerUsage" typeId="powerUsage"/>
</channels>
<representation-property>id</representation-property>
<config-description-ref uri="thing-type:plugwiseha:appliance_pump"/>
</thing-type>
<!-- Appliance: Zone thermostat (Lisa) -->
<thing-type id="appliance_thermostat" listed="true">
<supported-bridge-type-refs>
<bridge-type-ref id="gateway"/>
</supported-bridge-type-refs>
<label>Plugwise Room Thermostat</label>
<description>A Plugwise Home Automation room thermostat</description>
<channels>
<channel id="setpointTemperature" typeId="setpointTemperature"/>
<channel id="temperature" typeId="temperature"/>
<channel id="offsetTemperature" typeId="offsetTemperature"/>
</channels>
<representation-property>id</representation-property>
<config-description-ref uri="thing-type:plugwiseha:appliance_thermostat"/>
</thing-type>
</thing:thing-descriptions>

View File

@@ -0,0 +1,127 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<!-- modified identity transform -->
<xsl:template match="/domain_objects">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="gateway" />
<xsl:apply-templates select="appliance" />
<xsl:apply-templates select="location" />
<xsl:apply-templates select="module" />
</xsl:element>
</xsl:template>
<xsl:template match="node()">
<!-- prevent duplicate siblings -->
<xsl:if test="count(preceding-sibling::node()[name()=name(current())])=0">
<!-- copy element -->
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:if>
</xsl:template>
<xsl:template match="appliance">
<!-- copy element -->
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="location">
<!-- copy element -->
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="module">
<!-- copy element -->
<xsl:copy>
<xsl:apply-templates select="protocols/node()[name()='zig_bee_node']"/>
<xsl:apply-templates select="@*|node()[name()!='protocols']"/>
</xsl:copy>
</xsl:template>
<xsl:template match="location/appliances">
<!-- Apply identity transform on child elements of appliances -->
<xsl:for-each select="appliance">
<xsl:copy>
<xsl:value-of select="@id"/>
</xsl:copy>
</xsl:for-each>
</xsl:template>
<xsl:template match="module/services">
<xsl:for-each select="./node()">
<xsl:element name="service">
<xsl:element name="point_log">
<xsl:value-of select="functionalities/point_log/@id"/>
</xsl:element>
<xsl:apply-templates select="@*|node()[name()!='functionalities']"/>
</xsl:element>
</xsl:for-each>
</xsl:template>
<!-- This matches 'appliance/logs' or 'location/logs' -->
<xsl:template match="*[name() = 'location' or name()='appliance']/logs">
<!-- Apply identity transform on child elements of logs -->
<xsl:variable name="meter_id" select="point_log/*[substring(local-name(), string-length(local-name()) - string-length('_meter')+1) = '_meter']/@id"/>
<xsl:apply-templates select="/domain_objects/module/services/*[@id=$meter_id]/../../protocols/zig_bee_node"/>
<xsl:for-each select="point_log">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:for-each>
</xsl:template>
<xsl:template match="appliance/location">
<!-- Apply identity transform on child elements of location -->
<xsl:copy>
<xsl:value-of select="@id"/>
</xsl:copy>
</xsl:template>
<xsl:template match="logs/point_log/period">
<xsl:element name="measurement_date">
<xsl:value-of select="measurement/@log_date"/>
</xsl:element>
<xsl:element name="measurement">
<xsl:value-of select="measurement/text()"/>
</xsl:element>
</xsl:template>
<xsl:template match="*[name() = 'location' or name()='appliance']/actuator_functionalities">
<xsl:for-each select="./*">
<xsl:element name="actuator_functionality">
<xsl:if test="not(type)">
<xsl:choose>
<xsl:when test="local-name()='relay_functionality'">
<xsl:element name="type">
<xsl:text>relay</xsl:text>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:element name="type">
<xsl:value-of select="local-name()"/>
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
<xsl:for-each select=".">
<xsl:apply-templates select="@*|node()"/>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</xsl:template>
<!-- attributes to elements -->
<xsl:template match="@*">
<xsl:element name="{name()}">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>