Haiku Fan device handler for Google Assistant control

I’ve been wanting to use my Google Home to control my Haiku L-series fans for awhile now, so I decided to write a device handler with the goal of being able to send commands to my fans using voice control.

I took System48’s code (also see the original thread here) and rewrote it from the ground up as a composite device handler to achieve this. The Haiku Fan device handler is the parent device and the Haiku Fan Light device handler is the child device. Both are using the Switch and Switch Level capabilities.

As a consequence of this design, SmartApps are now able to interact with both the fan and the fan’s light as independent switches!

Here’s the repo with the device handlers:

One limitation is that the commands are very much one-way – SmartThings has no way of knowing the fan’s current state. If you adjust your fan with the remote control or Haiku’s app, it will go out of sync with SmartThings. I’ve looked into addressing this and it seems like there’s no good way to do it at the moment, as the SmartThings Hub doesn’t support listening to UDP ports.

It’s my first time writing code for SmartThings, and also my first time writing Groovy (or Java for that matter), so I welcome any guidance on how to improve or make my code more idiomatic! :slight_smile:

3 Likes

Weimeng thanks for the device handler.

I got it installed and added as a device, but doesn’t seem to be working on my fans. I have one L and one H series fans and two lights that I think should work with your device handler.

I think I got the ZigBee Id and the Device Network Id correct:
ZigBee Id is the mac address or name of the fan
Network Id is the ip address of the fan
Is that correct?

I selected the Haiku Fan Control from the Type list
For Version selected Published
Entered my Location and Hub

Is there anything that I am missing?
The firmware version on the fans was recently updated about end of May 2018 to Firmware Version 2.5 if that makes a difference?

Would love to be able to control my fans in Smartthings if possible so looking forward to seeing if I can get your device handler to work properly. Thanks again for putting this together.

UPDATE 1 hour later:

Now I got it. Once I installed the device handler I had to enter the fan name and IP address in the settings of each added fan device on my device/list.

Now it works great. Now I just need to figure out some good smart apps/routines to work it into. Like when I come home turn on the fan to 50% if the room is over 78 Deg F or something like that.

Nice work Weimeng!!!

Weimeng or Gwong, how are you able to connect this to routines or anything else since it appears that the device handler only received voice commands? I would love to be able to tie the ceiling fan light to a physical switch press but don’t see how I can set that up. Any ideas?

Any possible edge driver for this?