Easily finding RF codes from pilight-debug
I’ve been following this excellent article on setting up a Raspberry Pi and using it to remotely control your home devices (the original article is aiming at a ceiling fan, I’m just using some Etekcity Outlet Switches).
Everything was pretty easy to follow until it came to using pilight-debug to capture the codes my remote was sending to the switches. The output of pilight-debug has a lot of noise in it, and I got very quickly bored with trying to spot likely looking codes manually, trying them and repeatedly failing.
So I wrote up a quick Python script that replays the output and pauses between signals so you can easily identify the right code to use.
It’s super simple to use: simply redirect output of pilight-debug to a file, then pass that filename as an argument to replay.py, like this:
pi@raspberrypi:~ $ sudo pilight-debug > out.txt
pi@raspberrypi:~ $ python replay.py out.txt
The script will print the code it is sending, send it, then sleep for a second. If the code works (in my case, turning a switch on/off), simply Ctrl+C out and the last code printed will be the one you want!