Z-Uno & OpenHAB2

Tags: #<Tag:0x00007f7456560af0> #<Tag:0x00007f74565609d8> #<Tag:0x00007f7456560910>

Here I’ll be documenting the steps I took to get a Z-Uno up and running with OpenHAB2.

The Z-Uno is a (semi) Arduino compatible device with Z-Wave built in. It now supports up to 32! channels (up from the 10 that it was initially shipped with).

See: https://z-uno.z-wave.me/technical/

After browsing a couple other posts, it looks like we’ll need to build the entire binding with the appropriate XML - you cannot just modify the XML in {userdata}/zwave like I originally had hoped.

See: Zwave Database entry for zuno and Z-Uno - Arduino Z-Wave node

Prereqs:

1: Install Java SDK https://www.oracle.com/technetwork/java/javase/downloads/index.html

2: Install Maven https://maven.apache.org/

3: Install Git https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

Step 1: “Git” the ZWave Binding source:

git clone https://github.com/openhab/org.openhab.binding.zwave.git

Make sure you can build the project:

cd org.openhab.binding.zwave
mvn package

Step 2: Get the node xml from {userdata}/zwave for reference.

Step 3: Create Z-Wave Database XML

My use case is a RGB LED light strip, so I’ve implemented a few switches (for on/off and other modes) and a few dimmers (to control each color individually).

Depending on your use case, and the channels you implement, you can use exisiting device XMLs as examples. Go to https://www.cd-jackson.com/index.php/zwave/zwave-device-database/zwave-device-list/devices find a device; click Export > OpenHAB 2 to view a device’s DB entry.

See attached zmezuno1_0_0.xml for my DB XML as an example.
zmezuno1_0_0.xml (5.0 KB)

Step 4: Add Z-Wave Database XML to binding project source

Save the XML file from the above step to the manufacturer’s folder in source - it should already exist, as they have other products:

org.openhab.binding.zwave/ESH-INF/thing/zwaveme

Step 5: Compile binding jar

cd org.openhab.binding.zwave
mvn package

Jar will be created in the target folder.

Step 6: Add the new binding

  1. If your Z-Uno was already added as a thing, delete it via the HABmin interface.

  2. Uninstall the current Z-Wave binding (I did this via the terminal client):

    bundle:list

    Make note of the bundle ID.

    bundle:uninstall <ID#>

  3. Make sure you still have openhab-transport-serial installed
    feature:install openhab-transport-serial

  4. Stop OpenHAB
    sudo systemctl stop openhab2.service

  5. Add new jar to the addons folder (for my install, it is located at /usr/share/openhab2/addons)

  6. Start OpenHAB
    sudo systemctl start openhab2.service

Step 7: Add the appropriate items

I did this via an items file, as I’m still used to the OH1 way of doing things.

Here are my items for reference:

Switch 	Light_Kitchen_Cabinets "Cabinets" <light> (Kitchen,iLightSwitches) {channel="zwave:device:169497c2994:node13:switch_binary"}
Switch 	Light_Kitchen_Cabinets_Fade "Fade" <light> (Kitchen,iLightSwitches) {channel="zwave:device:169497c2994:node13:switch_binary1"}
Switch 	Light_Kitchen_Cabinets_Flash "Flash" <light> (Kitchen,iLightSwitches) {channel="zwave:device:169497c2994:node13:switch_binary2"}
Dimmer	Dimmer_Kitchen_Cabinets_Green	"Green  [%d %%]"  <light>	(Kitchen,iLightDimmers)		{channel="zwave:device:169497c2994:node13:switch_dimmer"}
Dimmer	Dimmer_Kitchen_Cabinets_Red 	"Red  [%d %%]"	  <light> 	(Kitchen,iLightDimmers)		{channel="zwave:device:169497c2994:node13:switch_dimmer1"}
Dimmer	Dimmer_Kitchen_Cabinets_Blue	"Blue  [%d %%]"	  <light> 	(Kitchen,iLightDimmers)		{channel="zwave:device:169497c2994:node13:switch_dimmer2"}

Step 8: Add items to sitemap

Here is my sitemap for reference:

sitemap cabinets label="Cabinets"
{
	Frame label="Cabinets" {
		Switch item=Light_Kitchen_Cabinets
		Switch item=Light_Kitchen_Cabinets_Fade
		Switch item=Light_Kitchen_Cabinets_Flash
		Slider item=Dimmer_Kitchen_Cabinets_Red
		Slider item=Dimmer_Kitchen_Cabinets_Green
		Slider item=Dimmer_Kitchen_Cabinets_Blue
	}	
}

Bonus:

Here is my Z-Uno sketch, if anyone wants to reference its setup vs. the process listed here:
ZUnoRGBLEDStrip.ino.txt (6.6 KB)

Just rename the above and remove the .txt; .ino isn’t a supported upload here. The sketch is only using 6 of the 10 channels that are set up, but I added the extra to more easily add functions. If you add channels to your sketch down the road, then you need to exclude the Z-Uno, then include it again.

2 Likes

Thanks for the post! I’ve moved it to a more appropriate category.

1 Like

thanks for the Post, it just works for 2.5M4 to

1. thing - a XML for default zuno ID already exists in zwave binding src, i have removed that file before adding your xml to avoid conflicts. hcsr04_0_5.xml

Path for binding has changed for me its org.openhab.binding.zwave\src\main\resources\ESH-INF\thing\zwaveme

<property name="manufacturerId">0115</property>
<property name="manufacturerRef">0110:0001</property> 

Your sample works fine. :slightly_smiling_face:

2. thing - my config files

binding xml

<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="zwave"
  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/v1.0.0">

  <thing-type id="zwaveme_zuno_sensor_001" listed="false">
    <label>Z-Uno DIY Sensor</label>
    <description>
		<![CDATA[
		<h2>Z-Uno Temperatur Luftfeuchtigkeit Sensor</h2>
			<br />
		<h2>Inclusion Information</h2>
			<p>Push 3 times</p>
			<br />
		<h2>Exclusion Information</h2>
			<p>Push 3 times</p>
			<br />
		<h2>Wakeup Information</h2>
			<p>Push 3 times</p>
		]]>
	</description>
    
	<category>ZunoDIY</category>

    <!-- CHANNEL DEFINITIONS -->
	<channels>
		<channel id="sensor_temperature" typeId="sensor_temperature">
			<label>Sensor (temperature)</label>
			<properties>
				<property name="binding:*:QuantityType">COMMAND_CLASS_SENSOR_MULTILEVEL,COMMAND_CLASS_BASIC;type=TEMPERATURE</property>
			</properties>
		</channel>
		<channel id="sensor_relhumidity" typeId="sensor_relhumidity">
			<label>Sensor (relative humidity)</label>
			<properties>
				<property name="binding:*:DecimalType">COMMAND_CLASS_SENSOR_MULTILEVEL,COMMAND_CLASS_BASIC;type=RELATIVE_HUMIDITY</property>
			</properties>
		</channel>
		<channel id="battery-level" typeId="system.battery-level">
			<properties>
				<property name="binding:*:PercentType">COMMAND_CLASS_BATTERY</property>
			</properties>
		</channel>
	</channels>

    <!-- DEVICE PROPERTY DEFINITIONS -->
    <properties>
		<property name="vendor">Z-Wave.Me</property>
		<property name="modelId">Temp_Humi_Sensor</property>
		<property name="manufacturerId">0115</property>
		<property name="manufacturerRef">0111:10A0</property>
		<property name="versionMin">0</property>
		<property name="versionMax">10</property>
		<property name="dbReference">9998</property>
    </properties>

    <!-- CONFIGURATION DESCRIPTIONS -->
    <config-description>

      <!-- STATIC DEFINITIONS -->
      <parameter name="node_id" type="integer" min="1" max="232" readOnly="true" required="true">
        <label>Node ID</label>
        <advanced>true</advanced>
      </parameter>

    </config-description>

  </thing-type>

</thing:thing-descriptions>

and Zuno config

ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_FREQUENTLY_AWAKE);
ZUNO_SETUP_CHANNELS(
  ZUNO_SENSOR_MULTILEVEL_TEMPERATURE(getterTemp),
  ZUNO_SENSOR_MULTILEVEL_HUMIDITY(getterHumi)
);
ZUNO_SETUP_BATTERY_HANDLER(getterBattery);
ZUNO_SETUP_PRODUCT_ID(0x10, 0xA0);
//ZUNO_SETUP_PRODUCT_AUTO();

thats my first working setup, looking out for more :slightly_smiling_face:
Unbenannt

3. thing - change Ref ID 0115:0110:0001
since Zuno Firmware 2.1.5 Ref ID can be change.

I had no luck by using AUTO, it never results in 0112… someone?

ZUNO_SETUP_PRODUCT_AUTO(); // to set 0x0112/(automatic) 

instead next line works fine…

ZUNO_SETUP_PRODUCT_ID(0x10, 0xA0);

means you can have thousand differend Zunos with differend XML bindings :wink:

4. thing - Thing Parameter? How to implement in XML binding? Parameter 1 for Debug and 2 for LED mode would be a good first try… someone?