Hacklet Build Status

A library, written in Ruby, for controlling the Modlet (smart) outlet.

If you haven't heard of the Modlet before, it's an outlet cover which allows you to convert any standard US outlet into a smart outlet. This means that you can control whether each socket is on or off as well as determine how much energy it's using with a sampling frequency of 10 seconds.

There are alot of other similar products but this is the first one that I've seen that costs $50 and includes control as well as monitoring of both sockets independently.

Checkout the companion project hacklet-remote if you're interested in controlling your modlet with IFTTT.

Why

So why write another client?

Unfortunately the client software included with the device isn't available on all platforms (Linux) and it's pretty heavyweight for what it does.

The goal of this project is provide all the same functionality of the bundled client but in a lightweight manner without dependencies on external services.

Installation

Mac

brew install libftdi
gem install hacklet

Linux (Ubuntu/Debian)

apt-get install libftdi1
gem install hacklet
echo 'ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8c81", SUBSYSTEMS=="usb", ACTION=="add", MODE="0660", GROUP="plugdev"' | sudo tee /etc/udev/rules.d/99-thinkeco.rules

Windows

Note: These directions haven't been confirmed. If you can confirm them or improve them, please create an issue or send a pull request.

  1. Install 7zip in order to extract Zadiag.
  2. Download Zadig for XP or later.
  3. Extract Zadig and run it.
  4. Click Options -> List all Devices to populate the device list.
  5. Open the device dropdown and look for the "Thinkeco" device and select it.
  6. Select the libusbK driver and press the Replace Driver button.
  7. Download and unzip libftdi
  8. Run gem install hacklet

If something isn't clear here, take a look at libFTDI under Windows as this was summarized from there.

Getting Started

# Add the device to the network, keep a copy of the network ids (ie 0xDEED)
hacklet commission

# Get the samples from the top socket on the device registered as 0xDEED
hacklet read -n 0xDEED -s 0

# Turn the top socket off
hacklet off -n 0xDEED -s 0

# And back on again
hacklet on -n 0xDEED -s 0

Contributing

All contributions are welcome (bug reports, bug fixes, documentation or new features)! All discussion happens using issues so if you are interested in contributing:

  • Search to make sure an issue doesn't already exist.
  • If it doesn't, create a new issue and describe your proposal.

If you're interested in following the status of the project, simply "watch" the repository on Github and you'll receive notices about all of the new issues.

If your curious about how the hardware works or the specifics of the protocol checkout out the developer wiki.

Contribution Workflow

  • Fork the repository
  • Install dependencies bundle install
  • Create a feature branch git checkout -b short-descriptive-name
  • Run tests bundle exec rake
  • Write your feature (and tests)
  • Run tests bundle exec rake
  • Create a pull request