Home Automation: Turn it on again

In Pi three ways I wrote:

what happens when you combine an RF transmitter, smart sockets with RF receivers, and a Raspberry Pi?

I’m still finding out what can be done, but this is what I’ve discovered so far.

tellstick_classic

This is what I bought:

bye bye standby kit

First, I set up each of the smart plugs, and paired them with the remote control.

This is already a big improvement: my home office has bookshelves filled with LED lights, but with inaccessible switches. Being able to turn them all on and off from the remote is awesome, but I’d really like them to turn on automatically, for example at sunset. So I need some compute power in the loop. Time for the Pi.

The Pi is running Raspian. I followed the installation instructions for telldus on Raspberry Pi. See also R-Pi Tellstick core for non-Debian instructions.

Next I tried to figure out the correct on/off parameters in tellstick.conf for the smart plugs. The Tellstick documentation is a bit sparse. Tellstick on Raspberry Pi to control Maplin (UK) lights talks about physical dials on the back of the remote control; sadly the Bye Bye Standby remote doesn’t have this.

Each plug is addressed using a protocol and a number of parameters. In the case of the Bye Bye Standby, it apparently falls under the arctech protocol, which has four different models, and each model uses the parameters “house” and sometimes “unit”.

Taking a brute-force approach, I generated a configuration for every possible parameter for the arctech protocol and codeswitch model:

for house in A B C D E F G H I J K L M N O P ; do
    for unit in {1..16} ; do
      cat <<EOF
device {
   id = $count
   name = "Test"
   protocol = "arctech"
   model = "codeswitch"
   parameters {
      house = "$house"
      unit = "$unit"
   }
}
EOF
   done
done

I then turned each of them on and off in turn, and waited until the tellstick spoke to the plugs:

count = 0
((count++))
for house in A B C D E F G H I J K L M N O P ; do
    for unit in {1..16} ; do
        echo "id = $count, house = $house, unit = $unit"
        tdtool --on $count
        tdtool --off $count
        ((count++))
    done
done

This eventually gave me house E and unit 16 (and the number of the corresponding automatically generated configuration, 80):

tdtool --on 80
Turning on device 80, Test – Success

bye bye standby plugs

But this only turned on or off all three plugs at the same time. I wanted control over each plug individually.

I stumbled upon How to pair Home Easy plug to Raspberry Pi with Tellstick, and that gave me enough information to reverse the process. Instead of getting the tellstick to work out what code the plugs talk, in theory I need to get the tellstick to listen to the plug for the code.

So this configuration should work, in combination with the tdlearn command:

device {
    id = 1
   name = "Study Right"
   protocol = "arctech"
   model = "selflearning-switch"
   parameters {
      house = "1"
      unit = "1"
   }
}

However this tiny footnote on the telldus website says: 

4Bye Bye Standby Self learning should be configured as Code switch.

So it seems it should be:

device {
    id = 1
   name = "Study Right"
   protocol = "arctech"
   model = “codeswitch"
   parameters {
      house = "1"
      unit = "1"
   }
}

… which is exactly what I had before. Remembering of course to do service telldusd restart each time we change the config, I tried learning again:

tdtool --learn 1
Learning device: 1 Study Right - The method you tried to use is not supported by the device

Well, bother. Looking at the Tellstick FAQ:

Is it possible to receive signals with TellStick?

TellStick only contains a transmitter module and it’s therefore only possible to transmit signals, not receive signals. TellStick Duo can receive signals from the compatible devices.

So it seemed like I was stuck with all-on, all-off unless I bought a TellStick Duo. Alternatively, I could expand my script to generate every possible combination in the tellstick.conf, and see if I can work out the magic option to control each plug individually. But since there are 1 to 67108863 possible house codes, this could take some time.

Rereading Bye Bye Standby 2011 compatible? finally gave me the answer. You put the plug into learning mode, and get the Tellstick to teach the right code to the plug by sending an “off” or an “on” signal:

tdtool --off 3

So setting house to a common letter and setting units to sensible increments, I can now control each of the plugs separately.

Next up: some automation.

This entry was posted in Computing, Home Automation, Planet, Research and tagged , , , , . Bookmark the permalink.

Comments are closed.