So for me this all started with just wanting my porch lights to automatically turn on at dusk and off at dawn. A day/night sensor ~should~ be the easy solution, but neither fixture would accommodate one, and given that I rent my house, I couldn't just go install new fixtures or install timer switches.

Some time ago I saw a post about how to root the hub, and given Home Depot had a sale going on, it was the cheapest option and the obvious choice. Appalled at the absolute bloat (seriously, a 45 MB app to turn light bulbs on and off, just, really?!) and terrible reliability of the wink app (scheduler worked correctly 1 out of 7 days), it was time to start hacking.

*** Update: These tutorials are outdated. See my project log "Firmware update & rootwink forums" for the new stuff.***

Obtaining root proved to be more of a challenge than the HaD blog post seemed to indicate, but after a couple hours of tweaking and Google searches, I was logged in as root. (BTW, the first two command of this XDA forums post were what finally got me logged in as root. ) Next, I had to figure out how to control the bulbs via the "aprontest" command. Again, Google was of little help here, and the usual "--help" command line argument didn't give any examples (a stack of arguments are required to make it function), so I had to figure it out via trial and error message. Below is the "help" execution, for reference:

Usage: aprontest [OPTION]...
Send commands and list information about connected devices

Operations:
  -a            Add a new home automation device
  -n            Manually add a home automation device to the database only.  USE WITH CAUTION.
                Only supports zigbee at this time.
  -d            Delete a home automation device
  -f            Force delete a home automation device from the database only.  USE WITH CAUTION.
                Only supports zigbee at this time.
  -u            Update the state of a home automation device with a new value
  -e            Force a refresh of a home automation device
  -g            Set a generic callback for a radio for one minute of radio
                testing
  -l            List general information about automation devices, or specific
                information about one device
  --set-name    Set user-readable name for a device

Other Options:
  -r     Specify a radio for an Add Device or Generic Callback operation.
                One of lutron, zwave, zigbee, kidde
  -m        Specify a master device ID for a Delete, Update, Refresh, or
                List operation
  -t        Specify an attribute ID for an Update operation
  -v     Specify a new value to set for an Update operation

Kidde Specific Operations:
  -k        Set Kidde system ID

Z-Wave Specific Operations:
  --zwave_controller_reset      Reset the zwave controller. USE WITH CAUTION.
                                Existing z-wave network will be lost.
  --zwave_remove_failed         Remove a failed zwave device.
  --zwave_replace_failed        Replace a failed zwave device.
  --zwave_learn_mode            Enter Learn Mode on the Zwave Controller.
  --zwave_controller_shift      Hand off control to another (new) Zwave controller.
  --zwave_exclusion_mode        Enter Exclusion Mode on the Zwave Controller.

So first, to add a device (again the smartphone app completely failed here), the command is:

aprontest -a -r zigbee

Then the hub searches for any new zigbee devices and adds them. To view all paired devices, use

[root@flex-dvt ~]# aprontest -l
Found 3 devices in database...
MASTERID |     INTERCONNECT |                         USERNAME
       1 |           ZIGBEE |                front porch light
       2 |           ZIGBEE |              kitchen porch light
       3 |           ZIGBEE |                        Engr unit
Note: you can name the device (USERNAME column) with
aprontest -m 3 --set-name "living room"
which will change the name of device #3 ("Engr unit) to living room. Note: -m 3 specifies device 3
[root@flex-dvt ~]# aprontest -m 3 --set-name "living room"
[root@flex-dvt ~]# aprontest -l
Found 3 devices in database...
MASTERID |     INTERCONNECT |                         USERNAME
       1 |           ZIGBEE |                front porch light
       2 |           ZIGBEE |              kitchen porch light
       3 |           ZIGBEE |                      living room
Next, each device has its own attributes you can set. In the case of the bulb, there is power (ON or OFF, case sensitive) and brightness (1 to 255). View as shown.
[root@flex-dvt ~]# aprontest -m3 -l
Device has 2 attributes...
living room
ATTRIBUTE |               DESCRIPTION |   TYPE | MODE |          GET |          SET
        1 |                    On_Off | STRING |  R/W |          OFF |          OFF
        2 |                     Level |  UINT8 |  R/W |          127 |          127

Note that brightness (Level) is set to 127 (about half power). Now, for the lengthy update command to actually turn the thing on or off and change brightness:

[root@flex-dvt ~]# aprontest -m3 -u -t1 -v ON
Update device with master ID 3, setting value ON
i: [23416.2af31460] apronHandleMessage() (sdk/sd:156): Got response for command 0
i: [23416.2af31460] apronHandleMessage() (sdk/sd:170): Got callback for command 0
i: [23416.2af31460] apronHandleMessage() (sdk/sd:200): SDK received nodeData_t callback type 2
Update callback: Status 0 on updating master ID: 3
[root@flex-dvt ~]# aprontest -m3 -u -t2 -v 255
Update device with master ID 3, setting value 255
i: [23420.2af31460] apronHandleMessage() (sdk/sd:156): Got response for command 0
i: [23420.2af31460] apronHandleMessage() (sdk/sd:170): Got callback for command 0
i: [23420.2af31460] apronHandleMessage() (sdk/sd:200): SDK received nodeData_t callback type 2
Update callback: Status 0 on updating master ID: 3
[root@flex-dvt ~]# aprontest -m3 -l
Device has 2 attributes...
living room
ATTRIBUTE |               DESCRIPTION |   TYPE | MODE |          GET |          SET
        1 |                    On_Off | STRING |  R/W |           ON |           ON
        2 |                     Level |  UINT8 |  R/W |          255 |          255

Above, I both turned bulb 3 on and set its brightness to full. The first command, -m3 specifies device 3, -u specifies update operation, -t1 specifies attribute 1, and -v ON is the new value for attribute 1. The second command, -m3 specifies device 3, -u specifies update operation, -t2 specifies attribute 2, and -v 255 is the new value for attribute 2.

Now, for the crontab. The cron daemon is installed by default but is neither setup nor running. To get it going, first you'll need to create the directories for the crontab config file. The full path should be /var/spool/cron/crontabs. After those folders are in place, create a text file in the crontabs folder called root (use vi as your text editor). Once created, you can view it with crontab -l and edit it with crontab -e (which will open it in vi). Note that the times are in UTC. Below is mine as an example:

[root@flex-dvt ~]# crontab -l
#
#-     -     -   -    - cmd to execute
#|     |     |   |    |
#|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
#|     |     |   +------- month (1 - 12)
#|     |     +--------- day of the month (1 - 31)
#|     +----------- hour (0 - 23)
#+------------- min (0 - 59)
#
# vi quick help: i = edit, esc = cmd mode, :wq = save & quit
#
# Set brightness
29      2       *       *       *       aprontest -m 1 -u -t 2 -v 127
29      2       *       *       *       aprontest -m 2 -u -t 2 -v 127
# Turn on
30      2       *       *       *       aprontest -m 1 -u -t 1 -v ON
30      2       *       *       *       aprontest -m 2 -u -t 1 -v ON
# Turn off
0       8       *       *       *       aprontest -m 1 -u -t 1 -v OFF
0       8       *       *       *       aprontest -m 2 -u -t 1 -v OFF
# Breakfast club or special event
0       13      3       4       *       aprontest -m 1 -u -t 1 -v ON
45      13      3       4       *       aprontest -m 1 -u -t 1 -v OFF

Next, you'll need to get the cron daemon running. Simply execute crond and you're up and running! You can also add crond to a startup script such as rc.local to automatically start it if the hub reboots.

What next?

I would like to do 3 things:

1. A faster way to control lights than having to SSH the hub every time. I'm already aware of OpenHAB, but its smartphone app isn't compatible with my old Android 2.3 phone (which is dumb, because an old smartphone would make an excellent remote control for such a system). Anyone know how to create script shortcuts on Android, such as an icon on the desktop that executes a curl command when clicked?

2. A means to control DIY IOT devices with the hub. In particular, I would like to make an automatic window blinds controller. Anyone have some thoughts?

3. Hub firmware. I can't find any documentation on what firmware versions are good, or, for that matter, how to tell which one I'm running.