Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vera] Vera Binding initial contribution #2283

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions addons/binding/org.openhab.binding.vera/.classpath
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.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions addons/binding/org.openhab.binding.vera/.project
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.vera</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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<binding:binding id="vera" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:binding="http://eclipse.org/smarthome/schemas/binding/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/binding/v1.0.0 http://eclipse.org/smarthome/schemas/binding-1.0.0.xsd">

<name>Vera Binding</name>
<description>Vera (lite/edge/plus/etc version) is a popular Z-Wave controller. Vera binding automatically finds the addresses of all such controllers on the local network, and through HTTP api loads all their devices and scenes.</description>
<author>Dmitriy Ponomarev</author>

</binding:binding>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<config-description:config-descriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:config-description="http://eclipse.org/smarthome/schemas/config-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/config-description/v1.0.0
http://eclipse.org/smarthome/schemas/config-description-1.0.0.xsd">
<config-description uri="binding:vera:veraController">

<parameter-group name="veraController">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to remove this group as you do not have that many parameters.

<label>Vera controller</label>
<description>The configuration of the Vera. All the information can be detected during the discovery.</description>
</parameter-group>

<parameter name="veraIpAddress" groupName="veraController" type="text">
<context>network-address</context>
<label>IP address</label>
<description>The IP address or hostname of the Vera controller.</description>
<default>192.168.1.10</default>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this and rather add required=true instead.

</parameter>

<parameter name="veraPort" groupName="veraController" type="integer" required="false" min="0" max="65335">
<label>Port</label>
<description>The port of the Vera controller</description>
<default>3480</default>
</parameter>

<parameter name="pollingInterval" groupName="binding" type="integer" required="false" min="5" max="3600"
unit="s">
<label>Polling Interval</label>
<description>Refresh all values (name, room, state) for all devices and scenes.</description>
<unitLabel>Seconds</unitLabel>
<default>60</default>
</parameter>

<parameter name="clearNames" groupName="binding" type="boolean" required="false">
<label>Clear Names</label>
<description>Remove digits, slashes and double spaces from all names. Good for some voice recognition services.</description>
<default>false</default>
</parameter>

<parameter name="defaulRoomName" groupName="binding" type="text" required="false">
<label>Default room name</label>
<description>Default name for room, if no room specified.</description>
<default>No Room</default>
</parameter>

<parameter name="homekitIntegration" groupName="binding" type="boolean" required="false">
<label>Homekit integration</label>
<description>If enabled, homekit tags are created for all supported devices. Please read Homekit add-on instructions.</description>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please indent this XML using tabs.

<default>true</default>
</parameter>
</config-description>

</config-description:config-descriptions>
16 changes: 16 additions & 0 deletions addons/binding/org.openhab.binding.vera/ESH-INF/thing/bridge.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="vera" 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 org.eclipse.smarthome.thing-description.xsd">

<bridge-type id="veraController">
<label>Vera Controller</label>
<description>A popular Z-Wave controller Vera (lite/edge/plus/etc).</description>

<channels>
<channel id="actions" typeId="actions" />
</channels>

<config-description-ref uri="binding:vera:veraController" />

</bridge-type>
</thing:thing-descriptions>
188 changes: 188 additions & 0 deletions addons/binding/org.openhab.binding.vera/ESH-INF/thing/channels.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="vera" 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">

<channel-type id="sensorTemperature">
<item-type>Number</item-type>
<label>Temperature</label>
<category>Temperature</category>
<state readOnly="true" pattern="%.1f °C" />
</channel-type>

<channel-type id="sensorLuminosity">
<item-type>Number</item-type>
<label>Luminiscence</label>
<category>Light</category>
<state readOnly="true" pattern="%.1f Lux" />
</channel-type>

<channel-type id="sensorHumidity">
<item-type>Number</item-type>
<label>Humidity</label>
<category>Humidity</category>
<state readOnly="true" pattern="%.1f %%" />
</channel-type>

<channel-type id="sensorUltraviolet">
<item-type>Number</item-type>
<label>Ultraviolet</label>
<category>Light</category>
<state readOnly="true" pattern="%.1f UV index" />
</channel-type>

<channel-type id="sensorEnergy">
<item-type>Number</item-type>
<label>Energy</label>
<category>Energy</category>
<state readOnly="true" pattern="%.1f W" />
</channel-type>

<channel-type id="sensorMeterKWh">
<item-type>Number</item-type>
<label>Energy</label>
<category>Energy</category>
<state readOnly="true" pattern="%.1f kWh" />
</channel-type>

<channel-type id="sensorMeterW">
<item-type>Number</item-type>
<label>Energy</label>
<category>Energy</category>
<state readOnly="true" pattern="%.1f W" />
</channel-type>

<channel-type id="sensorSmoke">
<item-type>Switch</item-type>
<label>Smoke</label>
<category>Smoke</category>
<state readOnly="true" />
</channel-type>

<channel-type id="sensorCo">
<item-type>Switch</item-type>
<label>Gas</label>
<category>Gas</category>
<state readOnly="true" />
</channel-type>

<channel-type id="sensorFlood">
<item-type>Switch</item-type>
<label>Flood</label>
<category>Water</category>
<state readOnly="true" />
</channel-type>

<channel-type id="sensorDoorWindow">
<item-type>Contact</item-type>
<label>DoorWindow</label>
<category>Contact</category>
<state readOnly="true" />
</channel-type>

<channel-type id="sensorMotion">
<item-type>Switch</item-type>
<label>Motion</label>
<category>Motion</category>
<state readOnly="true" />
</channel-type>

<channel-type id="switchBlinds">
<item-type>Rollershutter</item-type>
<label>Rollshutter</label>
<category>Blinds</category>
<state readOnly="false" />
</channel-type>

<channel-type id="battery">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this and rather use the existing system.battery-level type (see https://www.eclipse.org/smarthome/documentation/development/bindings/thing-definition.html#channels)

<item-type>Number</item-type>
<label>Battery</label>
<category>Battery</category>
<state readOnly="true" pattern="%.1f %%" />
</channel-type>

<channel-type id="doorlock">
<item-type>Switch</item-type>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please re-apply the auto-formatter

<label>Doorlock</label>
<category>Door</category>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line, it isn't a door, it is a lock :-)

<state readOnly="false" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please indent this XML using tabs.

</channel-type>

<!-- Channel types without further information -->

<channel-type id="sensorBinary">
<item-type>Switch</item-type>
<label>Sensor binary</label>
<description>This channel represents a universal channel if no further device information is available.</description>
<category>Switch</category>
<state readOnly="true" />
</channel-type>

<channel-type id="switchBinary">
<item-type>Switch</item-type>
<label>Switch binary</label>
<description>This channel represents a universal channel if no further device information is available.</description>
<category>Switch</category>
<state readOnly="false" />
</channel-type>

<channel-type id="switchMultilevel">
<item-type>Dimmer</item-type>
<label>Switch multilevel</label>
<description>This channel represents a universal channel if no further device information is available.</description>
<category>Switch</category>
<state readOnly="false" />
</channel-type>

<channel-type id="switchColor">
<item-type>Color</item-type>
<label>Switch color</label>
<description>This channel represents the rgbw switch device type from Vera.</description>
<category>ColorLight</category>
</channel-type>

<channel-type id="thermostatMode">
<item-type>Switch</item-type>
<label>Thermostat mode</label>
<description>The channel allows the control or display of a thermostat (mode). A thermostat can have up to three states (modes): off, heating and cooling. The state of heating and cooling is alternately set at the state on.</description>
<category>Temperature</category>
<state readOnly="false" />
</channel-type>

<channel-type id="thermostatSetPoint">
<item-type>Number</item-type>
<label>Thermostat set point</label>
<category>Temperature</category>
<state readOnly="false" />
</channel-type>

<channel-type id="thermostatModeCC">
<item-type>Number</item-type>
<label>Thermostat mode (Command Class)</label>
<description>The channel allows the control or display of a thermostat (mode) from command class. The modes differ from device to device.</description>
<category>Temperature</category>
<state readOnly="false" />
</channel-type>

<!-- TODO -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there still something todo here?

<channel-type id="sceneButton">
<item-type>Switch</item-type>
<label>Run scene</label>
<description>This channel represents a scene button.</description>
<category>Switch</category>
<state readOnly="false" />
</channel-type>

<!-- Special channel types -->

<channel-type id="actions">
<item-type>String</item-type>
<label>Actions</label>
<description>Available actions of the Vera Controller</description>
<state>
<options>
<option value="REFRESH">Refresh all things</option>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fishy. The REFRESH command is already defined for any channel, so they all should react to it.
And "things" cannot really be refreshed, only their channel states - so I would rather think that this channel should be removed.

</options>
</state>
</channel-type>
</thing:thing-descriptions>
22 changes: 22 additions & 0 deletions addons/binding/org.openhab.binding.vera/ESH-INF/thing/device.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="vera" 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="veraDevice">
<supported-bridge-type-refs>
<bridge-type-ref id="veraController" />
</supported-bridge-type-refs>

<label>Vera Device</label>
<description>
A Vera device represents one sensor or actor with the one or more channels.
</description>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apply formatter

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please indent this XML using tabs.

<config-description>
<parameter name="deviceId" type="text" required="true">
<label>Device Id</label>
<description>Id of the Vera device</description>
</parameter>
</config-description>
</thing-type>
</thing:thing-descriptions>
22 changes: 22 additions & 0 deletions addons/binding/org.openhab.binding.vera/ESH-INF/thing/scene.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="vera" 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="veraScene">
<supported-bridge-type-refs>
<bridge-type-ref id="veraController" />
</supported-bridge-type-refs>

<label>Vera Scene</label>
<description>
A Vera scene represents one scene with the one channel.
</description>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apply formatter

<config-description>
<parameter name="sceneId" type="text" required="true">
<label>Scene Id</label>
<description>Id of the Vera scene</description>
</parameter>
</config-description>
</thing-type>
</thing:thing-descriptions>
30 changes: 30 additions & 0 deletions addons/binding/org.openhab.binding.vera/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Vera Binding
Bundle-SymbolicName: org.openhab.binding.vera;singleton:=true
Bundle-Vendor: openHAB
Bundle-Version: 2.1.0.qualifier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update to 2.4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Bundle-Version: 2.1.0.qualifier
Bundle-Version: 2.5.0.qualifier

Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ClassPath: .
Import-Package: com.google.common.collect,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the com.google.common.collect import and use the Java 8 constructs instead (e.g. Stream.of(..).collect(..)).

com.google.gson,
com.google.gson.annotations,
org.apache.commons.lang,
org.apache.commons.lang.builder,
org.apache.commons.net.util,
org.eclipse.smarthome.config.core,
org.eclipse.smarthome.config.discovery,
org.eclipse.smarthome.core.library.types,
org.eclipse.smarthome.core.thing,
org.eclipse.smarthome.core.thing.binding,
org.eclipse.smarthome.core.thing.binding.builder,
org.eclipse.smarthome.core.thing.type,
org.eclipse.smarthome.core.types,
org.openhab.binding.vera,
org.openhab.binding.vera.handler,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove:

 org.openhab.binding.vera,
 org.openhab.binding.vera.handler

and put all classes in org.openhab.binding.vera.internal or sub packages.

org.osgi.framework,
org.slf4j
Service-Component: OSGI-INF/*.xml
Export-Package: org.openhab.binding.vera,
org.openhab.binding.vera.handler
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove:

Export-Package: org.openhab.binding.vera,
 org.openhab.binding.vera.handler

and put all classes in org.openhab.binding.vera.internal or sub packages.

Bundle-ActivationPolicy: lazy
Loading