Category Archives: Linux

Posts about and around the operating system Linux and all open source stuff I use or write

Get photos from google+ using the command line in linux

I used to have picasawebsync.py as my prefered tool in getting a backup copy of my photos and videos from google+, but it stopped working (for me). GoogleCL to the rescue.

To get all photos from the automatic backup just type

google -u yourusername picasa get "Auto Backup"

in your terminal.  The first time you run it, you will need to open a URL that GoogleCL gives you.

What I am missing is a “sync” feature, as all it does is download.

LogicMachine telnet user script

The following code enables you to open a telnet connection and send commands. I use it to connect to my Pioneer sound system. Add it to a user script.

telnet-lm

-- send Telnet command

function telnet(host, port, command)
local socket = require("socket")
local tcp = assert(socket.tcp())
res, err = tcp:connect(host, port)
res, err = tcp:send(command)

while true do
local s, status, threebytes = tcp:receive(3)
if status == "closed" then break end
end
tcp:close()
end

Usage

All you need to do now is call the function from your KNX-Object script. Example:

require('user.telnet')
telnet('192.168.0.24', 8102, 'PF\r\n\r\nclose\r\n\r\n')

The PF command tells my Pioneer to turn off. I’m not sure if a close command is necessary, but all the returns are. The IP address and port have to be changed to what you need.

Batch change color of SVG icon set

CC-SA 3.0
Iconset in LM3

I ran across this cool set of icons that can be used in home automation projects. The latest firmware from openrb allows me to use SVGs as Icons in the logic machine re:actor. Only drawback is that for each state I would like to change the color of the icon. The iconset is set in white as default color.

When you open any of the SVGs from the KNX User Forum you will find that the color is set as a standard #000000 HTML color value for white. All we would need to do is switch these from that to for example #FFFFFF for them to be black. To do this on one file the code would be:
sed -i -e's/\"#.\{6\}/\"#000000/g' -e 's/#.*;/#FFFFFF;/g' icon.svg

where icon.svg is the file we want to turn into black lines.

If we then want to change all, we need a small bash script to loop all the files in a directory and apply the change. That would look like this:
for f in *.svg;
do
echo "Changing color of $f ..."
sed -i -e's/\"#.\{6\}/\"#000000/g' -e 's/#.*;/#FFFFFF;/g' "$f";
done

It is a good Idea to rename the files with a prefix that describes the color. That way you will have them sorted by color in the logic machine. Just change Black to any color you have chosen.
for f in *.svg ; do mv "$f" "Black $f" ; done

The logic machine likes the files to be zipped if you are going to upload a batch. I used this command to generate it:
zip black.zip *

Now you can go into the logic machine and upload black.zip.

Logic Machine reactor in infinite boot loop

Two days ago my Logic Machine stopped working. The main led blinked for a few seconds and then it would reboot. I contacted the openrb support and was told what I had already thought. The SD card in the Logic Machine had gone corrupt and I needed a new one. I bought a new 4 gig card and opened the Logic Machine using a screw driver. Pushing out the main board was easy and the SD card is sitting prominently in the middle. To get it out you need to push the metal holder away from the SD card, in a sliding motion. The card can then easily be replaced with a new one.

To flash the firmware to the new card you need to download the recovery image from here. Unzip it with

gunzip recovery.img.gz

Then flash it to the SD card using

dd if=recovery.img of=/dev/sdb

(the sdb should be the device of your SD card!). It takes a few minutes as the unziped image is 3.5 Gig large.

After placing the newly burned SD card into the Logic Machine you can reach it on 192.168.0.10 and then upload the reactor.img to finish the process. I then as a precaution did a factory reset by holding the reset button down for 10 secs (the red led will start blinking) and then pushing it again for 10 second (the red led will start blinking faster).

I had a fairly recent backup of my system, such that I could start living again. The whole process took about an hour to finish.