Monday, December 7, 2015

openHAB and our Fireplace Part 2 and OpenZWave

Finally, the MimoLite replay has arrived. Even though it was Amazon Prime, it look about five days to land in my eager hands. At least it was free shipping! In Part 1 we looked at a solution to control the fireplace via our openHAB network. Now the fun part of actually installing it. I set aside an evening after work for the installation. Of course when projects seem simple, they end up taking a lot longer.

MimoLite Relay



First thing is to pair the relay with the Z-Wave network. This involved shutting down opeHAB and bringing the USB controller over to where the relay will be installed. This allows the relay and controller to see the layout of the network from the perspective of the relay so it  knows it neighbors to build the mesh network.

As a reminder on Ubuntu you can use:

sudo service openhab stop

Then after including the device, bring back the controller and fire up openHAB.

sudo service openhab start

Easy right? Well, you have to have a bit of patience getting it to show green in HABmin. After a bunch of messing around with it for, whatever reason it finally showed green and initialized. Not sure if it was my messing around or just time that fixed it. Now to some more fun!

openHAB HABMin Z-Wave Devices


Long story short, I needed to configure the relay parameters to use the input and map it to the reply so that the original remote for the fireplace would still function. I ran into two problems here. For starters, there is bug in HABmin - it will fail when you set some of the parameters. A total bummer because it has a nice drop down for each parameter with labeled options. Otherwise, you have to mess with binary/hex values. To solve this problem, I tried using a workaround that updates the parameters via a rule but I couldn't get that to work for the life of me. Nothing, nada, zilch, w w w dot cannot compute dot com.

Finally, on like the second late evening of dealing with this, I decided to just install open-zwave along with open-zwave-control-panel. This turned out to be a project on its own since you have to download and compile and you can't just get it from the Ubuntu repo. You have to be careful as well as the directions I have found were for the old version. To get it all working, you have to extract the control-panel inside of the open-zwave directory after you are done compiling open-zwave. The only thing you have to do is edit the MAKE file to point to libmicrohttpd. It's supposed to work if you put libmicrohttpd inside of open-zwave. However, for some reason I had issues. After all of that fighting it turns out I could just install it from the Ubuntu repo. So this should be your structure:

 
~/open-zwave
├── open-zwave-control-panel
│   ├── ozwcp
│   ├── config
 

I suggest getting open-zwave compiled and then move on to open-zwave-control-panel. Once done, you can run the control panel from within its directory. Be sure to stop openHAB first as it has control of the serial port. Oh! And finally you need to copy the open-zwave config folder to the control-panel folder as this is the Z-Wave database.

./ozwcp -p 5000

You will want to specify the port otherwise it picks some long random port number. Hopefully at this point you are able to browse to it.

http://192.168.X.X:5000



So now it turns out that open-zwave doesn't have the MimoLite in its database. It has the manufacture, just not this specific device. So I luckily found a post that someone has started to add it. It didn't have all of the parameters but at least it was a starting place. Yep, that was another project to get the XML updated and working. The updated database is on Github but for reference this link will help with how to add devices.

Here is something to watch out for that costed me probably over an hour of head banging. In the control panel, if you use the save button on the top right it saves a cached copy of the database. So if you are making changes you wouldn't see them. Argh!!! If you do, just delete or rename it. It should be called something like zwcf_0x......xml. About time, I can see the changes. What drove me crazy is it was working the night before but I had forgotten I clicked save. Now the second half of the battle is getting the right values set for the input-mapping. It seemed when I had it set it would be backwards. Input open fireplace on and vice versa. Turns out I have to set the voltage ranges that qualify as ON or OFF. I could of saved a bunch of time had I tried the calculator first, but of course I didn't until hours or was it a day later, or wait ... I don't know! It was a blur being neck deep in Z-Waves, ha! On the MimoLite site there are PDFs and the calculator to get you informed. Here are the links

MimoLite Downloads
Calculator

The two PDFs of interest:

User Manual
Technical Appendix - specifically page 2

The appendix has the parameter definitions.

Taken from the MimoLite PDF

Here are values I used in the calculator to get the desired affect.

MimoLite Config App

Phew! Some progress! You just have to copy and paste these values into open-zwave-control-panel. Yay, the physical remote acts like the relay isn't even there, just want I wanted... wrong!

Second issue, it turns out that when input to relay mapping is turned on it ignores Z-Wave commands, what a huge FAIL!!! Terrible, just terrible. Awesome device but just terrible. I believe it is because a lot of people use this for garage doors and you would use the input mapping as your object detection input. Now that I think about it, I don't think that would work either since you would still want to be able to control it from Z-Wave. I guess you would use Z-Wave just to get the status. Whatever the reason - it's a huge face palm. At least have the option to set the override behavior. So at this point (for like a few minutes), I was ready to return the thing, get one of the basic Z-Wave relay and use the extra money saved to buy two more bulbs.

But wait there's more, I had a thought, I could read the ADC and then trigger the fireplace in a rule! Another adventure...

For reference: https://community.openhab.org/t/fortrezz-mimolite-issue/3173/14

No comments:

Post a Comment