Our Open Source Unicorn

Yoav:

What Ryan said.

Originally posted on Ryan Boren:

I must invoke the ultimate verb followed by yeah, because fuck yeah sounds about right when you get valued at a billion dollars for giving away most of your intellectual property and doing something that you’d do anyway because it is a part of your soul and your identity, because it was born of your nobler ambitions and you were lucky enough to be allowed to pursue them.

View original

First harvest

 

We’ve been eating from the lettuces and arugula for some time now, but getting the first carrots out of the ground was something quite special. Jonathan and I couldn’t resist taking a few bites before I got my camera. The peas were brilliant too, unlike everything I’ve ever tasted. And I think the zucchini is probably going to be next – the plants have started flowering this week.

 

Spring time in the vegetable garden

A few months ago I started a vegetable garden in our back yard. It took quite a bit of work, but it was a lot of fun and it’s incredibly satisfying to see the fruits (and vegetables) of your labor grow.

I originally planted some lettuces, broccoli, cress, carrots, rocket, and parsley, and later added some zucchini and green peas. Most of these have grown pretty nicely:

I’ve now started working on some new garden beds, where I’ll plant summer veggies like tomatoes and peppers.

Reverse engineering the leynew WF510 light bulb adapter

A few weeks ago I ordered some WF510 WIFI enabled E27 adapters. The WF510 is a device you place between your light fixture and your light bulb, that allows you to control the light with an iOS/Android app. At $56 per lot of 3, they’re the poor man connected light bulb.

WF510 adapters

The reason I bought those adapters was to see if I could find out how the app controls the device, and build a better (open source!) app or web service around that. I always wanted to get more experience with home automation and device control.

When the package arrived yesterday, I was quick to plug one of the devices in and fire up Wireshark to see what was happening. Here’s what I found out:

All communications to and from the device are  over UDP port 5000 (The app send its packets directly to 255.255.255.255:5000). The packets contain bits of comma separated text encoded around the ascii table. I’m not sure if this method of encoding is known and documented, or if it’s proprietary to the manufacturer, but it works like this:

  • Each column of 32 characters in the table is encoded separately (i.e ` through DEL, and @ to _ )
  • For each set, the first 4 characters are shifted 12 places ahead. So @ becomes L and a becomes m, and vice versa.
  • The next 4 characters are shifted 4 places ahead: d becomes h and g becomes k, and vice versa
  • Chars in positions 16 to 19 are shifted 12 places ahead as well. So p becomes | and P becomes \, and vice versa.
  • Chars in positions 20-23 are shifted 4 places ahead, so t becomes x and { becomes w

This took me a little while to figure out, but once I did the device no longer had any secrets for me.

Device setup:

To setup the device you connect to its own WIFI Access point (named WF510-MACADDRESS). You then sends it the credentials for your home network.
Here’s the translated exchange between the app and the device:

App:
search //knock knock, who's there

Device:
search,ACCF23022B80,leynew,WF510,room,\r\nOK-  // I'm ACCF23022B80, manufactured by leynew, model WF510, room(?)

App:
ACCF23022B80,setonoff,0,254, // can you turn off so I can see you

Device
setonoff,0\r\nOK- // sure

App
ACCF23022B80,setonoff,1,254, // and on again?

Device
setonoff,1\r\nOK- //sure

App
ACCF23022B80,setnet,{network ssid},{network password},WPA2PSK,AES, // Here's the network you need to connect to, with WPA2PSK security and AES encryption (possible values are also WPAPSK and TKIP respectively)

Device Control

Turn light off
ACCF23022B80,setbrightness,0,254,

Turn light on
ACCF23022B80,setbrightnes,100,254,

Dim light to 50%
ACCF23022B80,setbrightness,50,254,

What’s next?

I plan to build a library to control the devices – not sure about the stack I’m going to use, but it’s definitely going to be something I haven’t used before.