Bruce's Blog Just another in the neverending world of blogs

22Nov/16Off

Indigo Plugin for SenseME Fans Reference

Disclaimer: The API for SenseME is not published by Big Ass Solutions, and this plugin is in no way supported by them.  This plugin was written by analyzing the network traffic between the SenseME iPhone app and a Haiku fan with SenseME. There is no guarantee that this plugin will continue to work if Big Ass Solutions releases new firmware/software for the fan.

The current version of the Indigo Plugin for SenseME Fans is 0.6.0

This plugin has been tested on Haiku fans running firmware version 2.2.20

Installation and Basic Usage

To use this plug-in simply download this ZIP file and uncompress it on the Mac where you have Indigo installed, then double-click on the SenseME.indigoPlugin file to install it in Indigo.  Once installed, simply create a new Indigo "SenseME Fan" device.  In the device settings, enter the name of the fan and its IP address, both of which can be found in the Haiku Home smartphone app. After you launch the app click on the menu icon in the upper right corner and tap on "Rooms and Devices". The name to use in Indigo is the name as shown in this list. Tap on the fan then choose "Network Configuration" to determine the IP address assigned to the fan.

If your internet router is capable of assigning static IP addresses to devices then I strongly suggest you do this with your fan(s). Using a static IP address will ensure Indigo can re-establish communication with it if either Indigo or the fan is restarted.  You will need the MAC address of your fan to do this, and it can be found both in the Haiku Home smartphone app or in the Device Settings of the SenseMe device once Indigo has established a connection with the fan.

Once the SenseME Fan device is created simply create actions or triggers as you would for any other Indigo device. A summary of actions and triggers is outlined below.

Triggers should fire in Indigo whenever a state change occurs in your fan, whether the state change is the result of an action performed by the Haiku Home app, by a SenseME infrared remote control, or even if a person simply enters/exits the room (triggering the fan's motion detector).

State Value

When a SenseME fan device is enabled in Indigo the "State" column in the device display of the Indigo client will show a summary of the current state of the fan. The default value of the display is in the format of "fan_mode / light_mode", where each mode is either "on" or "off".

When debugging is enabled in the SenseME Fan plugin settings then the "State" column will show more detail in the format of "fan_mode / light_mode (f:fan_level, l:light_level)".

Triggers

  • Fan (values: On/Off)
    Triggered any time the fan is turned on or off.
  • Light (values: On/Off)
    Triggered any time the optional light is turned on or off.
  • Speed (values: 0-7)
    Triggered any time the speed of the fan changes.
  • Brightness (values: 0-16)
    Triggered any time the brightness of the optional light changes.
  • Fan Motion Sensor (values: On/Off)
    Triggered when the motion sensor is enabled or disabled for the fan.
  • Light Motion Sensor (values: On/Off)
    Triggered when the motion sensor is enabled or disabled for the optional light.
  • Status String (value: string)
    Triggered any time the state of the fan changes. The string returned in this trigger matches the value shown in the "State" column of Indigo when viewing the device. See the above description of the State value for possible values of this string.
  • Smart Mode (values: 'COOLING', 'HEATING', or 'OFF')
    Triggered any time the Smart Mode of the fan is changed between Smarter Heating, Smaller Cooling, or Off.
  • Motion Detected (values: On/Off)
    Triggered any time the fans motion detector detects motion in the room or after the motion detector determines no motion has been detected for a period of time.
  • Whoosh (values: On/Off)
    Triggered whenever Whoosh Mode is turned on or off.

NOTE: It is possible for what you would expect to be a single event to actually trigger multiple triggers. For example, if you turn your fan on with the Haiku Home smartphone app then the Indigo plugin might trigger both the Fan trigger and the Speed trigger. This is because the fan will respond with multiple events, and the plugin will respond to each event where the state changes.

Actions

  • Turn Fan On, Turn Fan Off
    Turns the fan on or off.
  • Adjust Fan Speed
    Sets the speed of the fan. Valid values are 0-7. If the fan is currently off and the speed is set to a non-zero value then the fan will turn on. If the fan is on and the speed is set to 0 then the fan will turn off.
  • Turn Fan Light On, Turn Fan Light Off
    Turns the optional light, if installed, on or off.
  • Adjust Fan Light Brightness
    Sets the brightness of the optional light. Valid values are 0-16. If the light is currently off and the level is set to a non-zero value then the light will turn on. If the light is on and the brightness is set to 0 then the fan will turn off.
  • Turn Fan Motion Sensor On, Turn Fan Motion Sensor Off
    Enables or disables the motion sensor for the fan. When enabled the fan will automatically turn on or off based on whether the fan has detected motion in the room.
  • Turn Light Motion Sensor On, Turn Light Motion Sensor Off
    Enables or disables the motion sensor for the light. When enabled the light will automatically turn on or off based on whether the fan has detected motion in the room.
  • Send raw SenseME Command
    Use this action with caution. It will allow you to send any command you want to your fan. You must be familiar with the format of commands that the SenseME fan recognizes in order to use this properly.
  • Enable Smarter Heating, Enable Smarter Cooling
    Turns on either the Smarter Heating or Smarter Cooling features of the SenseME fan.
  • Disable Fan Smart Mode
    Turns off Smart Mode, disabling both Smarter Heating and Smarter Cooling.
  • Adjust Fan Smart Mode Min Speed
    Adjusts the minimum speed of the fan when Smart Mode is enabled. Valid values are 0-6. A value of 0 disables the minimum speed setting.
  • Adjust Fan Smart Mode Max Speed
    Adjusts the maximum speed of the fan when Smart Mode is enabled. Valid values are 1-7. A value of 7 disables the maximum speed setting.
  • Turn Fan Whoosh Mode On, Turn Fan Whoosh Mode Off
    Turns Whoosh Mode on or off. If Whoosh mode is turned on and the fan is off then the fan will turn on.
22Jul/150

Indigo Plugin for Haiku Fans with SenseME v 0.3

Version 0.3 of the Indigo plugin is now available.  This version mostly improves the internal handling of events from the fan, and also adds both state and address information to the Devices display in the Indigo GUI.

Download the plugin here.

If you have any questions, comments, suggestions, etc. please post them to the Indigo plugin forum.

17Jul/150

Indigo Plugin for Haiku Fans with SenseME v 0.1

The Indigo Plugin for Haiku Fans with SenseME provides the ability to remotely control fans from Big Ass Solutions from within Indigo software. Currently the plugin is limited to support the following functionality:

  • Turn the fan on/off and adjust the fan speed
  • Turn the optional light, if installed, on/off and adjust its brightness
  • Turn the fan motion sensor on/off
  • Turn the light motion sensor on/off
  • Trigger actions based on changes to any of the above states

Disclaimer: The API for SenseME is not published by Big Ass Solutions, and this plugin is in no way supported by them.  This plugin was written by analyzing the network traffic between the SenseME iPhone app and a Haiku fan with SenseME. There is no guarantee that this plugin will continue to work if Big Ass Solutions releases new firmware/software for the fan.

To use this plug-in simply download this ZIP file and uncompress it, then double-click on the SenseME.indigoPlugin file to install it in Indigo.  Once installed, simply create a new Indigo "SenseME Fan" device.  In the device settings, enter the name of the fan and its IP address, both of which can be found in the SenseME smartphone app.

Once the SenseME Fan device is created simply create actions or triggers as you would for any other Indigo device.

If you are interested in learning more about the SenseME API for communicating with the fan then see this post. The source code for the plugin is also hosted on github.

 

17Jul/150

Hacking Big Ass fans with SenseME to control them remotely

Big Ass Solutions (I love that name) has an advanced ceiling fan called Haiku that includes an optional wifi-enabled component called SenseME, which is designed to be controlled by a smartphone app. Big Ass Solutions does not currently make an API available for SenseME, which is very unfortunate for folks who would like to incorporate their fans into third party home automation systems.

DISCLAIMER: What follows is information that I gleaned solely by analyzing the network traffic between the SenseME app and a Haiku fan.  None of this information is provided or supported by Big Ass Solutions, and it may change at any moment if Big Ass Solutions decides to do so. Use this information solely at your own risk. I make no guarantees whatsoever as to the current accuracy of this information. I also make no guarantees that by using this information you won't irreparably damage your Haiku fan (bricking the SenseME, etc).

Fortunately, they use a relatively simple protocol for controlling the fans. To figure out exactly how the smartphone app and the fan communicate with one another I simply ran wireshark or tcpdump to trace network traffic to/from my iPhone. Fortunately Apple makes it fairly easy to capture packet traces of iPhones by creating a remote virtual interface (RVI) on a Mac.  All it requires is XCode, which you can download from the Mac App Store.  I won't go into details of setting up an RVI since Apple provides fairly easy instructions on how to do it.

By tracing the network activity of the SenseME app I was able to quickly determine that the app and the fan communicate via UDP on port 31415, and the commands are all in a fairly simple plaintext format.  A command sent from the app to the fan is just a text string that looks like this:

<ALL;DEVICE;ID;GET>

Responses sent from the fan back to the app are in a similar format, but uses parenthesis instead:

(Living Room;LIGHT;PWR;ON)

The number & meaning of each parameter in the command or response varies depending on the command/response.

When the smartphone app starts up it broadcasts a <ALL;DEVICE;ID;GET> message on UDP port 31415 so that all the fans on the same network can receive it.  The fans, in response, send a series of responses back as a number of parenthesis-delimited strings to the IP address that issued the request.  In this way the smartphone app gets a snapshot of the entire current state of the fan.

When the SenseME app sends a command to a specific fan then the first parameter in the message is typically the MAC address of the fan.  It appears that the fan will also respond if the first parameter is the name of the fan, so the following two commands should effectively be identical, assuming "Living Room" is the name given to the fan with the MAC address 20:F8:5E:AB:31:1B:

<20:F8:5E:AB:31:1B;FAN;SPD;GET;ACTUAL>
<Living Room;FAN;SPD;GET;ACTUAL>

The fan will send some status messages via UDP broadcast so that all devices on the network that are listening on port 31415 can get updates. This way if you happen to have two or more smartphones all running the SenseME app and one of them changes the speed of the fan then all the apps are notified of the new fan speed.

Here are a few of the more basic commands that I've made use of in my testing/analysis of the fan.  Remember that the SenseME app sends commands enclosed in <> and the response(s) from the fan are enclosed in ().  I've also colored the commands in blue and the responses in red:

Set fan speed to 3:

Command from app: <Living Room;FAN;SPD;SET;3>
Responses from fan:
(Living Room;FAN;SPD;ACTUAL;3)
(Living Room;FAN;PWR;ON)
(Living Room;FAN;SPD;CURR;3)

Turn the fan off:

Command from app: <Living Room;LIGHT;PWR;OFF>
Responses from fan:
(Living Room;LIGHT;LEVEL;SCALE;0)
(Living Room;LIGHT;LEVEL;ACTUAL;0)
(Living Room;LIGHT;PWR;OFF)
(Living Room;LIGHT;LEVEL;CURR;0)
(Living Room;LIGHT;PWR;OFF)
(Living Room;LIGHT;LEVEL;CURR;0)

Turn the fans motion detector on:

Command from app: <Living Room;FAN;AUTO;ON>
Responses from fan:
(Living Room;FAN;AUTO;ON)
If the motion detector senses motion then this may be immediately followed by:
(Living Room;FAN;PWR;ON)
(Living Room;FAN;SPD;CURR;3) 
(Living Room;FAN;AUTO;ON)

As you can see from the above examples it's not uncommon to receive multiple responses from a single command sent to the fan. In some cases it's also possible to see the exact same response twice, like receiving "LIGHT;LEVEL;CURR;0" when the light is turned off.

I'm currently only interested in basic functionality like turning the fan on/off, adjusting the speed, and turning features like the motion sensor on/off so I haven't delved into a lot of these responses.  There are some responses like "(Living Room;LIGHT;LEVEL;SCALE;16383)" that I haven't bothered to try to understand, or why you might receive both a "FAN;SPEED;CURR" and "FAN;SPEED;ACTUAL" when they seem to always appear together and provide the same data.

This should provide enough of a basic primer for how to interact with Haiku Fans that have the SenseME option installed.  Good luck!

 

Tagged as: , No Comments
30Dec/140

pdmaint

We use PagerDuty where I work at Care.com to manage on-call notifications, escalations, etc. It's a great tool to manage alerts from tools and services like Nagios, New Relic, and dozens of others. They also provide a handy dandy REST API, and it should be no surprise that somebody then wrote a Python module to encapsulate it (thanks DropBox!).  Thanks to that I wrote a handy-dandy command line tool called pdmaint for my company to schedule maintenance windows in PagerDuty. Since we've found it incredibly useful I was able to get the powers-that-be to let us open source it.  So you can find pdmaint over at Github if you're interested.  There's a full set of documentation there as well.