forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request openhab#1 from kubawolanin/mihome
Xiaomi Smart Home Binding - code review followup + battery level report
- Loading branch information
Showing
21 changed files
with
555 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="src/main/java"/> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>org.openhab.binding.mihome</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ManifestBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.SchemaBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ds.core.builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 70 additions & 47 deletions
117
addons/binding/org.openhab.binding.mihome/ESH-INF/thing/sensor_ht.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,72 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<thing:thing-descriptions bindingId="mihome" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0" | ||
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd"> | ||
|
||
<thing-type id="sensor_ht"> | ||
<supported-bridge-type-refs> | ||
<bridge-type-ref id="bridge"/> | ||
</supported-bridge-type-refs> | ||
|
||
<label>Temperature & Humidity Sensor</label> | ||
<description>Temperature & Humidity Sensor</description> | ||
|
||
<channels> | ||
<channel id="temperature" typeId="temperature"/> | ||
<channel id="humidity" typeId="humidity"/> | ||
</channels> | ||
|
||
<config-description> | ||
<parameter name="itemId" type="text" readOnly="true"> | ||
<label>Item ID</label> | ||
<description>An identifier for the item connected.</description> | ||
<required>true</required> | ||
</parameter> | ||
</config-description> | ||
</thing-type> | ||
|
||
<channel-type id="temperature" advanced="true"> | ||
<item-type>Number</item-type> | ||
<label>Temperature</label> | ||
<category>Temperature</category> | ||
<tags> | ||
<tag>weather</tag> | ||
</tags> | ||
<state min="-50" max="60" step="0.1" pattern="%.1f °C" readOnly="true"> | ||
</state> | ||
</channel-type> | ||
<channel-type id="humidity" advanced="true"> | ||
<item-type>Number</item-type> | ||
<label>Humidity</label> | ||
<category>Humidity</category> | ||
<tags> | ||
<tag>weather</tag> | ||
</tags> | ||
<state min="0" max="100" step="0.1" pattern="%.1f%%" readOnly="true"> | ||
</state> | ||
</channel-type> | ||
<thing:thing-descriptions bindingId="mihome" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0" | ||
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd"> | ||
|
||
<thing-type id="sensor_ht"> | ||
<supported-bridge-type-refs> | ||
<bridge-type-ref id="bridge" /> | ||
</supported-bridge-type-refs> | ||
|
||
<label>Xiaomi Mi Temperature & Humidity Sensor</label> | ||
<description>Reports temperature and humidity. Operating temperature: −20°C to 60°C. Operating humidity: 0 to 100%. | ||
Sensor reports the temperature when there's a difference around 0.5°C. If there is no significant temperature change, sensor reports temperature once a 50 minutes.\ | ||
</description> | ||
|
||
<channels> | ||
<channel id="temperature" typeId="temperature" /> | ||
<channel id="humidity" typeId="humidity" /> | ||
<channel id="voltage" typeId="voltage" /> | ||
<channel id="batteryLevel" typeId="batteryLevel" /> | ||
</channels> | ||
|
||
<config-description> | ||
<parameter name="itemId" type="text" readOnly="true"> | ||
<label>Item ID</label> | ||
<description>An identifier for the item connected.</description> | ||
<required>true</required> | ||
</parameter> | ||
</config-description> | ||
</thing-type> | ||
|
||
<channel-type id="temperature"> | ||
<item-type>Number</item-type> | ||
<label>Temperature</label> | ||
<category>Temperature</category> | ||
<tags> | ||
<tag>weather</tag> | ||
</tags> | ||
<state min="-50" max="60" step="0.1" pattern="%.1f °C" readOnly="true"> | ||
</state> | ||
</channel-type> | ||
|
||
<channel-type id="humidity"> | ||
<item-type>Number</item-type> | ||
<label>Humidity</label> | ||
<category>Humidity</category> | ||
<tags> | ||
<tag>weather</tag> | ||
</tags> | ||
<state min="0" max="100" step="0.1" pattern="%.1f%%" readOnly="true"> | ||
</state> | ||
</channel-type> | ||
|
||
<channel-type id="voltage" advanced="true"> | ||
<item-type>Number</item-type> | ||
<label>Battery Voltage</label> | ||
<category>Battery Voltage</category> | ||
<state pattern="%d mv" readOnly="true"></state> | ||
</channel-type> | ||
|
||
<channel-type id="batteryLevel" advanced="true"> | ||
<kind>trigger</kind> | ||
<label>Low Battery Level</label> | ||
<description>Triggers LOW event when voltage is below 2800 mv</description> | ||
<event> | ||
<options> | ||
<option value="LOW">low</option> | ||
</options> | ||
</event> | ||
</channel-type> | ||
|
||
</thing:thing-descriptions> |
84 changes: 52 additions & 32 deletions
84
addons/binding/org.openhab.binding.mihome/ESH-INF/thing/sensor_magnet.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,54 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<thing:thing-descriptions bindingId="mihome" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0" | ||
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd"> | ||
|
||
<thing-type id="sensor_magnet"> | ||
<supported-bridge-type-refs> | ||
<bridge-type-ref id="bridge"/> | ||
</supported-bridge-type-refs> | ||
|
||
<label>Door/Window Sensor</label> | ||
<description>Sensor for Door/Window to detect open/closed state.</description> | ||
|
||
<channels> | ||
<channel id="isOpen" typeId="isOpen"/> | ||
</channels> | ||
|
||
<config-description> | ||
<parameter name="itemId" type="text" readOnly="true"> | ||
<label>Item ID</label> | ||
<description>An identifier for the item connected.</description> | ||
<required>true</required> | ||
</parameter> | ||
</config-description> | ||
</thing-type> | ||
|
||
<channel-type id="isOpen" advanced="true"> | ||
<item-type>Contact</item-type> | ||
<label>Open Status</label> | ||
<category>Contact</category> | ||
<state readOnly="true"></state> | ||
</channel-type> | ||
<thing:thing-descriptions bindingId="mihome" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0" | ||
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd"> | ||
|
||
<thing-type id="sensor_magnet"> | ||
<supported-bridge-type-refs> | ||
<bridge-type-ref id="bridge" /> | ||
</supported-bridge-type-refs> | ||
|
||
<label>Xiaomi Door/Window Sensor</label> | ||
<description>Contact sensor mounted on doors or windows. Detects states: open and closed.</description> | ||
|
||
<channels> | ||
<channel id="isOpen" typeId="isOpen" /> | ||
<channel id="voltage" typeId="voltage" /> | ||
<channel id="batteryLevel" typeId="batteryLevel" /> | ||
</channels> | ||
|
||
<config-description> | ||
<parameter name="itemId" type="text" readOnly="true"> | ||
<label>Item ID</label> | ||
<description>An identifier for the item connected.</description> | ||
<required>true</required> | ||
</parameter> | ||
</config-description> | ||
</thing-type> | ||
|
||
<channel-type id="isOpen"> | ||
<item-type>Contact</item-type> | ||
<label>Open Status</label> | ||
<category>Contact</category> | ||
<state readOnly="true"></state> | ||
</channel-type> | ||
|
||
<channel-type id="voltage" advanced="true"> | ||
<item-type>Number</item-type> | ||
<label>Battery Voltage</label> | ||
<category>Battery Voltage</category> | ||
<state pattern="%d mv" readOnly="true"></state> | ||
</channel-type> | ||
|
||
<channel-type id="batteryLevel" advanced="true"> | ||
<kind>trigger</kind> | ||
<label>Low Battery Level</label> | ||
<description>Triggers LOW event when voltage is below 2800 mv</description> | ||
<event> | ||
<options> | ||
<option value="LOW">low</option> | ||
</options> | ||
</event> | ||
</channel-type> | ||
|
||
</thing:thing-descriptions> |
Oops, something went wrong.